Commit 6ad4bf47 by JR Dalrymple

It ocurred to me that saving a state file on the pf hosting machine is going to…

It ocurred to me that saving a state file on the pf hosting machine is going to be dangerous and as such we're going a whole new route.

Just using plain old SNMP so it should work against non PF routers when I'm done making it more useful to the community at large.

copied useful parts of old check into new check and deleted old check
parent 04b7f042
#!/bin/sh #!/bin/sh
status=""
monthnow=$(date +%m)
daynow=$(date +%d)
HHMMnow=$(date +%H%M)
exitunknown() {
echo "UNKNOWN - $status"
exit 3
}
#SNMP OIDs we'll care about:
dateTimeNowOID="HOST-RESOURCES-MIB::hrSystemDate.0"
interfaceTableOID="IF-MIB::ifDescr"
interfaceInBytesOID="IF-MIB::ifInOctets"
interfaceOutBytesOID="IF-MIB::ifOutOctets"
monthlogic() { status=""
case "$monthnow" in
02) periodsecs=2419200;;
04 | 06 | 09 | 11) periodsecs=2592000;;
01 | 03 | 05 | 07 | 08 | 10 | 12) periodsecs=2678400;;
esac
dayreset= nagiosExit() {
echo $2
case $1 in
OK) exit 0;;
WARNING) exit 1;;
CRITICAL) exit 2;;
UNKNOWN) exit 3;;
*) exit 255;;
esac
} }
if [ "$#" -lt 1 ]; then
nagiosExit UNKNOWN "You must supply some parameters"
daylogic() {
# Basic error checking based on length alone
if [ $(expr "${resetdate}" : '.*') -ne 5 ]; then
status="You seem to have an improperly formatted date for reset."
exitunknown
fi fi
HHMMreset="$(echo "$resetdate" | cut -c2,3,4,5)"
echo $HHMMreset
periodsecs=86400
}
getnextreset() {
}
# GET ARGS # GET ARGS
while getopts r:i:w:h o while getopts r:i:w:h o
...@@ -72,14 +49,8 @@ case "$period" in ...@@ -72,14 +49,8 @@ case "$period" in
m | M ) monthlogic;; m | M ) monthlogic;;
d | D ) daylogic;; d | D ) daylogic;;
* ) status="You didn't specify a valid date" * ) status="You didn't specify a valid date"
exitunknown;; nagiosExit UNKNOWN "$status";;
esac esac
ifconfig $interface >/dev/null 2>&1
rc=$?
if [ $rc -ne 0 ]; then
status="The interface $interface isn't valid on this system."
exitunknown
fi
echo $warning nagiosExit "OK" "Wowsers, I have don't anything"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment