Zionetrix::Git
Repositories
Help
Report an Issue
gnokii-admin-scripts
Code
Commits
Branches
Tags
Search
Tree:
b5e826d
Branches
Tags
master
gnokii-admin-scripts
check_gnokii
initial commit
Benjamin Renard
commited
b5e826d
at 2012-07-25 17:04:50
check_gnokii
Blame
History
Raw
#!/bin/bash # # Nagios plugin to check Gnokii USB modem state # # Author : Benjamin Renard <brenard@easter-eggs.com> # Date : Wed, 25 Jul 2012 18:33:33 +0200 # # Path to gnokii binary (default : /usr/bin/gnokii) GNOKII=/usr/bin/gnokii # Path to gnokii config file (default : /etc/gnokiirc) CONFIG=/etc/gnokiirc KEY=$( $GNOKII --config $CONFIG --identify 2>/dev/null|tr '\n' " "|grep IMEI|sed 's/IMEI *: \([0-9]*\) Manufacturer *: \(.*\) Model *: \(.*\) Product name.*Revision.*/\2 \3 \(IMEI \: \1\)/' ) if [ ! -n "$KEY" ] then echo "CRITICAL - USB key not detected" exit 2 fi PINSTATUS=$( $GNOKII --config $CONFIG --getsecuritycodestatus 2>/dev/null|grep "Security code status"|sed 's/Security code status: //' ) if [ "$PINSTATUS" == "waiting for PIN." ] then echo "CRITICAL - SIM Locked ! You have to unlocked SIM !" exit 2 elif [ "$PINSTATUS" != "nothing to enter." ] then echo "UNKNOWN - PIN status unkwown : $PINSTATUS" exit 3 fi echo "OK - Key : $KEY - SIM Unlocked" exit 0