Bandit is correct, and if it does not exit normally, you would not get a message, but would still get the error\warning exit code sent to nagios.
hgtv....? I don't even want to know.
apc ups snmp check question
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: apc ups snmp check question
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: apc ups snmp check question
Ben and I were talking in PMs.
Attached in my try at the script. There are two variables you can change near the top that will change the exit text and whether they are ok, crit or warning. Let me know how this works out for you! I know you said this is all informational, but knowing your bosses, they will want some changed to warning status after you get it all setup.....enjoy!
Attached in my try at the script. There are two variables you can change near the top that will change the exit text and whether they are ok, crit or warning. Let me know how this works out for you! I know you said this is all informational, but knowing your bosses, they will want some changed to warning status after you get it all setup.....enjoy!
You do not have the required permissions to view the files attached to this post.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: apc ups snmp check question
You might get there doing it the way you are but you would need the APC MIB properly resolving the values and the output option of snmpget to be correct to show a value then you still need to check it.
A simple script off nagios exchange does the same thing. This is what I use and even gives more info when on battery.
http://exchange.nagios.org/directory/Pl ... le/details
A simple script off nagios exchange does the same thing. This is what I use and even gives more info when on battery.
http://exchange.nagios.org/directory/Pl ... le/details
Grumpy Olde IT Guy
Re: apc ups snmp check question
The problem is, he wants to check just this one OID and this OID only. Well, his bosses, not him. My plugin does that and no need for the mib as I tested it against a number of APC and it works fine and exits with the text he wanted, so not sure I understand your comment about the mib.rseiwert wrote:You might get there doing it the way you are but you would need the APC MIB properly resolving the values and the output option of snmpget to be correct to show a value then you still need to check it.
A simple script off nagios exchange does the same thing. This is what I use and even gives more info when on battery.
http://exchange.nagios.org/directory/Pl ... le/details
Regardless, his needs were very specific, other wise he had a plugin that did everything he'd like, but again, his bosses came into the picture, lol.
EDIT: Unless your reply was to the bash script, if so, disregard my comment in regards to the mib
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: apc ups snmp check question
i meant the scropt. I know it works. I think i need to plug in the community string, but I dont know where to insert it.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
Re: apc ups snmp check question
You mean my perl script? do a -h for help.benhank wrote:i meant the scropt. I know it works. I think i need to plug in the community string, but I dont know where to insert it.
Code: Select all
./check_apc_lastevent.pl -H ipaddress -C community2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: apc ups snmp check question
What I was saying about the MIB is that it will give you English no programming required
Example
./check_snmp -H 10.1.4.40 -o .1.3.6.1.4.1.318.1.1.1.3.2.5.0
SNMP OK - 1 | iso.3.6.1.4.1.318.1.1.1.3.2.5.0=1
Now we add the MIB
./check_snmp -H 10.1.4.40 -o .1.3.6.1.4.1.318.1.1.1.3.2.5.0 -m +PowerNet-MIB
SNMP OK - noTransfer(1) |
I almost never use check_snmp as this case illustrates the results are not a warn and crit range and need code to determine if to alert or not
The script I linked showed how to query one oid and control what is output and what exit code you want for each in about 15 lines of code.
Example
./check_snmp -H 10.1.4.40 -o .1.3.6.1.4.1.318.1.1.1.3.2.5.0
SNMP OK - 1 | iso.3.6.1.4.1.318.1.1.1.3.2.5.0=1
Now we add the MIB
./check_snmp -H 10.1.4.40 -o .1.3.6.1.4.1.318.1.1.1.3.2.5.0 -m +PowerNet-MIB
SNMP OK - noTransfer(1) |
I almost never use check_snmp as this case illustrates the results are not a warn and crit range and need code to determine if to alert or not
The script I linked showed how to query one oid and control what is output and what exit code you want for each in about 15 lines of code.
Grumpy Olde IT Guy
Re: apc ups snmp check question
Ahh, that would work fine for ben as it is just for informational reasons(until his bosses say to start alerting). I never noticed you could give check_snmp the mib. So until his bosses tell him to send alerts this will work fine, then he can use my perl script...so he has optionsrseiwert wrote:What I was saying about the MIB is that it will give you English no programming required
Example
./check_snmp -H 10.1.4.40 -o .1.3.6.1.4.1.318.1.1.1.3.2.5.0
SNMP OK - 1 | iso.3.6.1.4.1.318.1.1.1.3.2.5.0=1
Now we add the MIB
./check_snmp -H 10.1.4.40 -o .1.3.6.1.4.1.318.1.1.1.3.2.5.0 -m +PowerNet-MIB
SNMP OK - noTransfer(1) |
I almost never use check_snmp as this case illustrates the results are not a warn and crit range and need code to determine if to alert or not
The script I linked showed how to query one oid and control what is output and what exit code you want for each in about 15 lines of code.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: apc ups snmp check question
Sorry Bandit, I was replying to the original post and didn't see your solution. I wonder if the OP realized that this was the last failure condition. The last failure for my unit dates back years. Alerting on this would be bad since it will always be the last failure.
snmpwalk -v2c -c public 10.1.4.40 .1.3.6.1.4.1.318.1.1.1.3.2.5.0 -Oq
PowerNet-MIB::upsAdvInputLineFailCause.0 noTransfer
snmpwalk -v2c -c public 10.1.4.40 .1.3.6.1.4.1.318.1.1.1.4.1.1.0 -m +PowerNet-MIB -Oq
PowerNet-MIB::upsBasicOutputStatus.0 onLine
snmpwalk -v2c -c public 10.1.4.40 .1.3.6.1.4.1.318.1.1.1.3.2.5.0 -Oq
PowerNet-MIB::upsAdvInputLineFailCause.0 noTransfer
snmpwalk -v2c -c public 10.1.4.40 .1.3.6.1.4.1.318.1.1.1.4.1.1.0 -m +PowerNet-MIB -Oq
PowerNet-MIB::upsBasicOutputStatus.0 onLine
Grumpy Olde IT Guy
Re: apc ups snmp check question
ok fellas its time to make the donuts. I had to call it a day yesterday, but I will be putting these solutions to work and reprting the successful results later! hoo HAH!
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion