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
This commit is contained in:
Adam Amstrong
2010-04-24 23:53:11 +00:00
parent 2b5fbd67f2
commit ef8ee99000
2 changed files with 8 additions and 3 deletions

View File

@@ -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)) {

View File

@@ -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";