Page 2 of 2

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 1:19 pm
by csptra
Thanks!

I will try that if my script doesn't work. I'm testing it now.

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 1:23 pm
by rkennedy
Np. You should be able to cut the text out of that spot from the parsing I did in the past. Take a look at https://github.com/rcknag/nagios-plugin ... rocurve.sh as a reference point if needed. Just parsing OID -> data to text with warning / critical thresholds added.

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 1:34 pm
by csptra
Hello,

One last question,it would seem to me that -l "text" wouldn't dynamically change for the various exit codes.

examples: Message queue OK: Message Count
Message Queue Warning: Message Count
Message Queue Critical: Message count

I think I would have to write a shell script or perl script nagios command for that.

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 3:42 pm
by rkennedy
It would not. What exactly are you looking to do at this point? Can you explain your use case?

We might be able to help further.

On a second thought here - if you're just trying to define warning / critical thresholds with SNMP, you can do so using -w/-c -

Code: Select all

[root@xi libexec]# ./check_snmp
check_snmp: Could not parse arguments
Usage:
check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]
[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]
[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
[-A authpasswd] [-x privproto] [-X privpasswd]

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 4:20 pm
by csptra
Hello,

I am needing to write a script, (I wrote it in bourne shell but need to re-write it in perl) to check to use mailq to see the message count and if it is over the warning or critcal thresh hold, then print a custom error or warning message depending on if it is a warning or critical or unknown.


everything is working, but have to re-write my script in perl and make it modular to be used against any server.


I just was curious if using the -l on check_snmp could have dynamic messages -l "text" based on the exit code, but I would guess not.

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 5:57 pm
by rkennedy
Got it.

Ah - no dynamic text like that with -l. You are correct here - this could change with a wrapper script if you added further logic on top of it, though.

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 6:00 pm
by csptra
Thank you rkennedy.

I appreciate all your help. I consider this thread closed and will open another one if I need any additional help.

Re: check_snmp plugin timeout error

Posted: Wed Feb 15, 2017 10:23 am
by rkennedy
No problem! Sounds good - closing this one out!