From ef8ee990002e20eca673341a2346399bee556b65 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sat, 24 Apr 2010 23:53:11 +0000 Subject: [PATCH] count services as being down in the RRD when the host is down (for filthy SLA calculations?) git-svn-id: http://www.observium.org/svn/observer/trunk@1077 61d68cd4-352d-0410-923a-c4978735b2b8 --- check-services.php | 7 ++++++- html/includes/graphs/service.inc.php | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/check-services.php b/check-services.php index 3656871460..6c3c79b586 100755 --- a/check-services.php +++ b/check-services.php @@ -8,6 +8,7 @@ $sql = "SELECT * FROM devices AS D, services AS S WHERE D.status = '1' AND S.dev $query = mysql_query($sql); while ($service = mysql_fetch_array($query)) { + if($service['status'] = "1") { unset($check, $service_status, $time, $status); $service_status = $service['service_status']; $service_type = strtolower($service['service_type']); @@ -35,7 +36,11 @@ while ($service = mysql_fetch_array($query)) { } else { unset($updated); } $update_sql = "UPDATE `services` SET `service_status` = '$status', `service_message` = '" . addslashes($check) . "', `service_checked` = '" . time() . "' $updated WHERE `service_id` = '" . $service['service_id']. "'"; mysql_query($update_sql); - + } else { + $status = "0"; + } + + $rrd = $config['rrd_dir'] . "/" . $service['hostname'] . "/" . safename("service-" . $service['service_type'] . "-" . $service['service_id'] . ".rrd"); if (!is_file($rrd)) { diff --git a/html/includes/graphs/service.inc.php b/html/includes/graphs/service.inc.php index c9c8b38d59..1c0f86d3e2 100755 --- a/html/includes/graphs/service.inc.php +++ b/html/includes/graphs/service.inc.php @@ -15,7 +15,7 @@ include("common.inc.php"); $rrd = $config['rrd_dir'] . "/" . $service['hostname'] . "/" . safename("service-" . $service['service_type'] . "-" . $service['service_id'] . ".rrd"); - $rrd_options .= " COMMENT:' Cur Max\\n'"; + $rrd_options .= " COMMENT:' Cur Avail\\n'"; $rrd_options .= " DEF:status=$rrd:status:AVERAGE"; $rrd_options .= " CDEF:percent=status,100,*"; $rrd_options .= " CDEF:down=status,1,LT,status,UNKN,IF"; @@ -25,7 +25,7 @@ include("common.inc.php"); $rrd_options .= " LINE1.5:percent#009900:'" . $service_text . "'"; # Ugly hack :( $rrd_options .= " LINE1.5:percentdown#cc0000"; $rrd_options .= " GPRINT:status:LAST:%3.0lf"; - $rrd_options .= " GPRINT:percent:AVERAGE:%3.0lf%%\\\\l"; + $rrd_options .= " GPRINT:percent:AVERAGE:%3.5lf%%\\\\l";