Benjamin Renard commited on 2014-02-12 17:37:48
Showing 1 changed files, with 10 additions and 4 deletions.
... | ... |
@@ -30,12 +30,18 @@ then |
30 | 30 |
exit 3 |
31 | 31 |
fi |
32 | 32 |
|
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 ] |
|
33 |
+NETWORK_CODE=$( $GNOKII --config $CONFIG --getnetworkinfo 2> /dev/null|grep "^Network\s\+code\s\+:\s\+" |sed 's/^Network\s\+code\s\+:\s\+\([^(]*\).*$/\1/') |
|
34 |
+CELL_ID=$( $GNOKII --config $CONFIG --getnetworkinfo 2> /dev/null|grep "^Cell\s\+id\s\+:\s\+" | sed 's/Cell\s\+id\s\+:\s\+\(.*\)\s*$/\1/') |
|
35 |
+ |
|
36 |
+if [ "$NETWORK_CODE" == "" -o $( echo "$NETWORK_CODE"|grep -ic undefined ) -gt 0 ] |
|
37 |
+then |
|
38 |
+ # double check with Cell id |
|
39 |
+ if [ "$CELL_ID" == "" -o $( echo "$CELL_ID"|grep -ic "00000000") -gt 0 ] |
|
35 | 40 |
then |
36 |
- echo "CRITICAL - Not connected (Network : $NETWORK)" |
|
41 |
+ echo "CRITICAL - Not connected (Network code : $NETWORK_CODE / Cell id : $CELL_ID)" |
|
37 | 42 |
exit 2 |
38 | 43 |
fi |
44 |
+fi |
|
39 | 45 |
|
40 |
-echo "OK - Key : $KEY - SIM Unlocked - Network : $NETWORK" |
|
46 |
+echo "OK - Key : $KEY - SIM Unlocked - Network code : $NETWORK_CODE / Cell id : $CELL_ID" |
|
41 | 47 |
exit 0 |
42 | 48 |