From 9cdf9d9ee39bade1b6c242ca4fb458a1de2c76a7 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Tue, 16 Jul 2013 10:06:24 -0400
Subject: [PATCH] - Display/email reason for service restart/reload failure (if init script doesn't suppress error messages).

---
 server/lib/classes/monitor_tools.inc.php |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index b5ca043..c84311c 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -117,7 +117,6 @@
 					$relname = "UNKNOWN";
 				}
 				$distver = $ver.$lts." ".$relname;
-				swriteln("Operating System: ".$distver."\n");
 			} elseif(trim(file_get_contents('/etc/debian_version')) == '4.0') {
 				$distname = 'Debian';
 				$distver = '4.0';
@@ -133,10 +132,10 @@
 				$distver = 'Squeeze/Sid';
 				$distid = 'debian60';
 				$distbaseid = 'debian';
-			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
+			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || strstr(trim(file_get_contents('/etc/debian_version')), '7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
 				$distname = 'Debian';
 				$distver = 'Wheezy/Sid';
-				$distid = 'debian70';
+				$distid = 'debian60';
 				$distbaseid = 'debian';
 			} else {
 				$distname = 'Debian';
@@ -303,7 +302,7 @@
 		$state = 'ok';
 
 		//* Fetch the data for all users
-		$dfData = shell_exec('repquota -au');
+		$dfData = shell_exec('repquota -au 2>/dev/null');
 
 		//* Split into array
 		$df = explode("\n", $dfData);
@@ -331,7 +330,7 @@
 		}
 
 		//** Fetch the data for all users
-		$dfData = shell_exec('repquota -ag');
+		$dfData = shell_exec('repquota -ag 2>/dev/null');
 
 		//* split into array
 		$df = explode("\n", $dfData);
@@ -486,7 +485,7 @@
 		$state = 'ok';
 
 		/** Fetch the data of ALL devices into a array (needed for monitoring!) */
-		$dfData = shell_exec('df -hT');
+		$dfData = shell_exec('df -hT 2>/dev/null');
 
 		// split into array
 		$df = explode("\n", $dfData);
@@ -1149,6 +1148,7 @@
 			$data['output'] = shell_exec('tw_cli info c0');
 
 			$state = 'ok';
+			if(is_array($data['output'])) {
 			foreach ($data['output'] as $item) {
 				if (strpos($item, 'RAID') !== false) {
 					if (strpos($item, ' VERIFYING ') !== false) {
@@ -1191,6 +1191,7 @@
 						$this->_setState($state, 'critical');
 					}
 				}
+			}
 			}
 		}
 
@@ -1308,7 +1309,7 @@
 				system('which iptables', $retval); // Debian, Ubuntu, Fedora
 				if ($retval === 0) {
 						/*  Get the data of the log */
-						$data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S');
+						$data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S 2>/dev/null');
 
 						/*
 						 * At this moment, there is no state (maybe later)
@@ -1324,7 +1325,7 @@
 				system('which ip6tables', $retval); // Debian, Ubuntu, Fedora
 				if ($retval === 0) {
 						/*  Get the data of the log */
-						$data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S');
+						$data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S 2>/dev/null');
 
 						/*
 						 * At this moment, there is no state (maybe later)

--
Gitblit v1.9.1