mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 16:04:35 +02:00
- Use Nagios alerting: 0 = Ok, 1 = Warning, 2 = Critical
- Update documentation - Moved SQL for upstream changes
This commit is contained in:
@@ -219,13 +219,13 @@ if ($config['show_services']) {
|
||||
|
||||
<?php
|
||||
|
||||
if (($service_status[0] > 0) || ($service_status[2] > 0)) {
|
||||
if (($service_status[1] > 0) || ($service_status[2] > 0)) {
|
||||
echo ' <li role="presentation" class="divider"></li>';
|
||||
if ($service_status[2] > 0) {
|
||||
echo ' <li><a href="services/state=warning/"><i class="fa fa-bell-o fa-col-warning fa-fw fa-lg"></i> Warning ('.$service_status[2].')</a></li>';
|
||||
if ($service_status[1] > 0) {
|
||||
echo ' <li><a href="services/state=warning/"><i class="fa fa-bell-o fa-col-warning fa-fw fa-lg"></i> Warning ('.$service_status[1].')</a></li>';
|
||||
}
|
||||
if ($service_status[0] > 0) {
|
||||
echo ' <li><a href="services/state=critical/"><i class="fa fa-bell-o fa-col-danger fa-fw fa-lg"></i> Critical ('.$service_status[0].')</a></li>';
|
||||
if ($service_status[2] > 0) {
|
||||
echo ' <li><a href="services/state=critical/"><i class="fa fa-bell-o fa-col-danger fa-fw fa-lg"></i> Critical ('.$service_status[2].')</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ if (count($services) > '0') {
|
||||
<?php
|
||||
foreach ($services as $service) {
|
||||
$service['service_ds'] = htmlspecialchars_decode($service['service_ds']);
|
||||
if ($service['service_status'] == 1) {
|
||||
if ($service['service_status'] == 0) {
|
||||
$status = "<span class='green'>Ok</span>";
|
||||
}
|
||||
elseif ($service['service_status'] == 2) {
|
||||
elseif ($service['service_status'] == 1) {
|
||||
$status = "<span class='red'>Warning</span>";
|
||||
}
|
||||
elseif ($service['service_status'] == 0) {
|
||||
elseif ($service['service_status'] == 2) {
|
||||
$status = "<span class='red'>Critical</span>";
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -74,14 +74,14 @@ print_optionbar_end();
|
||||
$sql_param = array();
|
||||
if (isset($vars['state'])) {
|
||||
if ($vars['state'] == 'ok') {
|
||||
$state = '1';
|
||||
}
|
||||
elseif ($vars['state'] == 'critical') {
|
||||
$state = '0';
|
||||
}
|
||||
elseif ($vars['state'] == 'warning') {
|
||||
elseif ($vars['state'] == 'critical') {
|
||||
$state = '2';
|
||||
}
|
||||
elseif ($vars['state'] == 'warning') {
|
||||
$state = '1';
|
||||
}
|
||||
}
|
||||
if (isset($state)) {
|
||||
$where .= " AND service_status= ? AND service_disabled='0' AND `service_ignore`='0'";
|
||||
@@ -123,10 +123,10 @@ foreach (dbFetchRows($host_sql, $host_par) as $device) {
|
||||
}
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `services` WHERE `device_id` = ? $where", $sql_param) as $service) {
|
||||
if ($service['service_status'] == '0') {
|
||||
if ($service['service_status'] == '2') {
|
||||
$status = "<span class='red'><b>".$service['service_type']."</b></span>";
|
||||
}
|
||||
else if ($service['service_status'] == '1') {
|
||||
else if ($service['service_status'] == '0') {
|
||||
$status = "<span class='green'><b>".$service['service_type']."</b></span>";
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user