Change SNMP data
Re: Change SNMP data
Im not 100% sure how to do that, I will have to do some research and figure out how to write the script.
Re: Change SNMP data
@jolson actually wrote it already. Here's quick instructions -
Create a file in the /usr/local/nagios/libexec/ directory
Paste this as the contents -
Run chown nagios:nagios yourfile (change yourfile to the name of the file you just created) - this will change the permissions to nagios:nagios.
Now, run chmod +x yourfile (change yourfile to the name of the file you just created) - this will make it executable.
Finally, run /usr/local/nagios/libexec/yourfile - this should be the result you're looking for. Please post the output once you run it for us to see.
Let us know if you run into any issues!
Create a file in the /usr/local/nagios/libexec/ directory
Paste this as the contents -
Code: Select all
#!/bin/bash
output=$(/usr/local/nagios/libexec/check_snmp -H 10.2.50.251 -o 1.3.6.1.4.1.318.1.1.1.2.3.4.0 -C snmpstring -P 1 -l "Battery Actual Voltage" -u "V DC" -m powernet417.mib -w @682.5:882.5 -c @0:682.5)
exit=$?
if [ "$exit" == 0 ]
then
output2=$(echo "$output" | sed "s/./\.&/45")
output3=$(echo "$output2" | sed "s/./\.&/83")
echo "$output3"
exit 0
elif [ "$exit" == 1 ]
then
echo "$output"
exit 1
elif [ "$exit" == 2 ]
then
echo "$output"
exit 2
elif [ "$exit" == 3 ]
then
echo "$output"
exit 3
fiNow, run chmod +x yourfile (change yourfile to the name of the file you just created) - this will make it executable.
Finally, run /usr/local/nagios/libexec/yourfile - this should be the result you're looking for. Please post the output once you run it for us to see.
Let us know if you run into any issues!
Former Nagios Employee