librenms-librenms/html/includes/common/component-status.inc.php
Aaron Daniels 52455e1128 Component Update - Status
- Align the component status field with the Nagios standard
  0=ok, 1=warning, 2=critical
- Modify existing modules to report these status' (Cisco-OTV)
- Add/Modify Alerting Macros to use these status'
- Add the a component status widget
- update edit page to report these status'
2016-07-11 16:51:01 +10:00

42 lines
963 B
PHP

<?php
require_once "../includes/component.php";
$OBJCOMP = new component();
$common_output[] = '
<div>
<table id="component-status" class="table table-hover table-condensed table-striped">
<thead>
<tr>
<th data-column-id="status" data-order="desc">Status</th>
<th data-column-id="count">Count</th>
</tr>
</thead>
<tbody>
';
foreach ($OBJCOMP->getComponentStatus() as $k => $v) {
if ($k == 0) {
$status = 'Ok';
$color = 'green';
}
elseif ($k == 1) {
$status = 'Warning';
$color = 'grey';
}
else {
$status = 'Critical';
$color = 'red';
}
$common_output[] .= '
<tr>
<td><p class="text-left '.$color.'">'.$status.'</p></td>
<td><p class="text-left '.$color.'">'.$v.'</p></td>
</tr>
';
}
$common_output[] .= '
</tbody>
</table>
</div>
';