Page 2 of 2

Re: SNMP Monitoring a VPN interface that changes

Posted: Tue May 02, 2017 10:47 pm
by tacolover101
rjesse wrote:Thanks everyone for the tips and samples, I have a working shell script outside of Nagios, I just need to figure out how to get it working inside Nagios as a plugin, some quick learning for me. I'll post my solution when i get it working.
within your shell script, nagios cares about a few things on output -
1. exit code (exit 0)
2. line of text here (echo "OK: TACOS STILL IN FREEZER" | tacos=101) - the first part is the text to be displayed in the nagios page, where as what's after | will be represented as performance data.
3. logic - you need to create logic based on your result somehow to determine what to inform nagios about. exit 0 = ok, exit 1 = warning, exit 2 = critical, exit 3 = unknown. add your echo of text accordingly

good luck!

Re: SNMP Monitoring a VPN interface that changes

Posted: Wed May 03, 2017 8:56 am
by dwhitfield
tacolover101 wrote: 3. logic - you need to create logic based on your result somehow to determine what to inform nagios about. exit 0 = ok, exit 1 = warning, exit 2 = critical, exit 3 = unknown. add your echo of text accordingly
Thanks @tacolover101!

One additional, advanced point about the exit codes. You can return other codes if it is useful for you. However, there has been talk of future versions adding additional exit codes. I don't know when/if that will happen, but if you did want to do this, I'd stay away from the lover numbers, else you might have compatibility issues in the future. To be clear, nagios is not going to know what to do with other exit codes, but they might be useful for *you*.