Added network check in nagios plugin
Benjamin Renard

Benjamin Renard commited on 2013-01-31 09:25:37
Showing 1 changed files, with 8 additions and 1 deletions.

... ...
@@ -30,5 +30,12 @@ then
30 30
 	exit 3
31 31
 fi
32 32
 
33
-echo "OK - Key : $KEY - SIM Unlocked"
33
+NETWORK=$( $GNOKII --config $CONFIG --monitor once 2> /dev/null|grep ^Network|sed 's/^Network: \([^(]*\).*$/\1/' )
34
+if [ "$NETWORK" == "" -o $( echo "$NETWORK"|grep -ic unknown ) -gt 0 ]
35
+then
36
+	echo "CRITICAL - Not connected (Network : $NETWORK)"
37
+	exit 2
38
+fi
39
+
40
+echo "OK - Key : $KEY - SIM Unlocked - Network : $NETWORK"
34 41
 exit 0
35 42