Checking APC UPS battery runtime
-
rdobbsmacu
- Posts: 36
- Joined: Tue Apr 28, 2015 3:11 pm
Re: Checking APC UPS battery runtime
after every script change I have been forcing the checks.
Here is you screenshot you asked for.
https://support.nagios.com/forum/downlo ... w&id=11456
Here is you screenshot you asked for.
https://support.nagios.com/forum/downlo ... w&id=11456
You do not have the required permissions to view the files attached to this post.
Re: Checking APC UPS battery runtime
This is bizarre, the only difference I'm doing over here is setting $runtime statically, as I don't have a UPS to test with.
Can you try modifying the 3 lines that echo the result to include the $runtime so that we can get some debugging? For example -
Can you try modifying the 3 lines that echo the result to include the $runtime so that we can get some debugging? For example -
Code: Select all
echo "Current Battery Runtime $(($min)) Minutes ($runtime)""|calles=$runtime;27000;12000"
Former Nagios Employee
-
rdobbsmacu
- Posts: 36
- Joined: Tue Apr 28, 2015 3:11 pm
Re: Checking APC UPS battery runtime
here is the output after that change
# ./check_apc_runtime 172.18.100.65
Current Battery Runtime 95 Minutes (570000)|calles=570000;27000;12000
in the interface is now displaying this Current Battery Runtime 0 Minutes (). still warning status.
# ./check_apc_runtime 172.18.100.65
Current Battery Runtime 95 Minutes (570000)|calles=570000;27000;12000
in the interface is now displaying this Current Battery Runtime 0 Minutes (). still warning status.
Re: Checking APC UPS battery runtime
Can you verify the permission of check_snmp?
Code: Select all
ls -l /usr/local/nagios/libexec/check_snmp
Former Nagios Employee
-
rdobbsmacu
- Posts: 36
- Joined: Tue Apr 28, 2015 3:11 pm
Re: Checking APC UPS battery runtime
-rwxr-xr-x 1 root root 251289 Apr 23 2015 /usr/local/nagios/libexec/check_snmp
Re: Checking APC UPS battery runtime
Can you try running the following, and then force a check? -
Code: Select all
chown apache:nagios check_snmp
Former Nagios Employee
-
rdobbsmacu
- Posts: 36
- Joined: Tue Apr 28, 2015 3:11 pm
Re: Checking APC UPS battery runtime
ok ran the chown and forced check no change.
Re: Checking APC UPS battery runtime
I cleaned up the code a little bit and quoted some values - can you give this a try?
Code: Select all
#!/bin/bash
if [ $# == 0 -o "$1" == "-h" -o $# -gt 1 ]; then
echo "Usage: ./snmp_upc.sh <host>"
exit 3
fi
CHK="/usr/local/nagios/libexec/check_snmp"
MIB=".1.3.6.1.4.1.318.1.1.1.2.2.3.0"
RUNTIME=$($CHK -H "$1" -C macu-pub -o "$MIB" | awk '{print $5}'| grep -o '[0-9]*')
MIN=$(expr $RUNTIME / 6000);
a=27000
b=12000
### If then beginning ###
### OK State ###
if [[ "$RUNTIME" -gt "$a" ]]
then
echo "Current Battery Runtime $(($MIN)) Minutes""|calles=$RUNTIME;27000;12000"
exit 0
### Warning State ###
elif [[ "$RUNTIME" -le "$a" ]]
then
echo "Current Battery Runtime $(($MIN)) Minutes""|calles=$RUNTIME;27000;12000"
exit 1
### Critical State ###
elif [[ "$RUNTIME" -le "$b" ]]
then
echo "Current Battery Runtime $(($MIN)) Minutes""|calles=$RUNTIME;27000;12000"
exit 2
### Catchall else ###
else
echo "Unkown error"
exit 3
fi
### Catchall close ###-
rdobbsmacu
- Posts: 36
- Joined: Tue Apr 28, 2015 3:11 pm
Re: Checking APC UPS battery runtime
OK I updated the script with what you gave.
Here is the command I ran and it's output from the command line
./check_apc_runtime 172.18.100.65
Current Battery Runtime 95 Minutes|calles=570000;27000;12000
in the web interface shows this after forcing check.
https://support.nagios.com/forum/downlo ... w&id=11477
Here is the command I ran and it's output from the command line
./check_apc_runtime 172.18.100.65
Current Battery Runtime 95 Minutes|calles=570000;27000;12000
in the web interface shows this after forcing check.
https://support.nagios.com/forum/downlo ... w&id=11477
You do not have the required permissions to view the files attached to this post.
Re: Checking APC UPS battery runtime
Could you please show us your command definition from the GUI? I am also interested in seeing your service definition. You can find them in 'Configure -> Core Config Manager'.
You do not have the required permissions to view the files attached to this post.