mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
- 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'
42 lines
963 B
PHP
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>
|
|
';
|