From 5e5ced6fe57a50ecfe21388663e4ee0d78323074 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Sun, 22 Apr 2012 14:28:02 -0400 Subject: [PATCH] CC-3701: Need to differentiate between a service being down vs not-monitored (airtime-check-system) -fixed --- .../application/models/Systemstatus.php | 20 ++++++++++++++++++- utils/airtime-check-system.php | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php index 679b57c19..81969d9d6 100644 --- a/airtime_mvc/application/models/Systemstatus.php +++ b/airtime_mvc/application/models/Systemstatus.php @@ -43,6 +43,16 @@ class Application_Model_Systemstatus "memory_perc"=>"0%", "memory_kb"=>"0", "cpu_perc"=>"0%"); + + $notMonitored = array( + "name"=>$p_serviceName, + "process_id"=>"NOT MONITORED", + "uptime_seconds"=>"-1", + "status"=>false, + "memory_perc"=>"0%", + "memory_kb"=>"0", + "cpu_perc"=>"0%" + ); $notRunning = array( "name"=>$p_serviceName, @@ -66,8 +76,16 @@ class Application_Model_Systemstatus $status = $monitor->item(0)->nodeValue; if ($status == "2"){ $data = $starting; + } else if ($status == 1){ + //is monitored, but is it running? + $pid = $item->getElementsByTagName("pid"); + if ($pid->length == 0){ + $data = $notRunning; + } else { + //running! + } } else if ($status == 0){ - $data = $notRunning; + $data = $notMonitored; } } diff --git a/utils/airtime-check-system.php b/utils/airtime-check-system.php index 736aac80c..a91fa4efa 100644 --- a/utils/airtime-check-system.php +++ b/utils/airtime-check-system.php @@ -222,6 +222,7 @@ class AirtimeCheck { global $showColor; $RED = "[0;31m"; + $ORANGE = "[0;33m"; $GREEN = "[1;32m"; $color = $GREEN; @@ -229,6 +230,9 @@ class AirtimeCheck { if ($value == "FAILED"){ $color = $RED; self::$AIRTIME_STATUS_OK = false; + } else if ($value == "NOT MONITORED"){ + $color = $ORANGE; + self::$AIRTIME_STATUS_OK = false; } if ($showColor)