Page 1 of 1

SNMP checks

Posted: Thu Nov 23, 2017 3:51 pm
by orani
I have some snmp checks running at a fortinet fortigate 100D. The result of the snmp is "snmp ok -1". i check the status of an interface. i found on internet that the "1" means that the interface is working and a device is connected to it. in nagios web interface how i can make it not to say "snmp ok -1" but for example "snmp ok-something else"???

Re: SNMP checks

Posted: Mon Nov 27, 2017 4:56 pm
by cdienger
This could be done with some scripting - effectively creating a new plugin or wrapper for a plugin. You would then configure nagios to use the command that's created.

Pseudocode:

Code: Select all

result_var=results_of_check_snmp
if result_var="ok -1"
echo "desired text"
exit 0

Re: SNMP checks

Posted: Mon Nov 27, 2017 5:14 pm
by orani
So if I understand correctly I should make a new snmp check for example “my_check_snmp” which would contain the original code of the “check_snmp” plugin plus the code you wrote above? And then I have to create a new check command in nagios using this new plugin and use this new check command for checking services that I want a different result from 1. Also I think that maybe I can use the pseudocode you wrote multiple times in my new check for different results such as 1,2 etc?

Re: SNMP checks

Posted: Tue Nov 28, 2017 4:44 pm
by npolovenko
@orani, That's right. You may be able to find what you're looking for on nagios exchange: https://exchange.nagios.org/index.php?o ... d=fortinet
Could you also share the snmptt.conf file with us?

Code: Select all

/etc/snmp/snmptt.conf

Re: SNMP checks

Posted: Wed Nov 29, 2017 12:21 am
by orani
I run the following:

Code: Select all

cp check_snmp check_snmp_interface
in my checks i replaced check_snmp with check_snmp_interface

and i added at check_snmp_interface the code you told me

But in nagios i get (No output on stdout) stderr:

I tried to view the check_snmp file at libexec but i cant read it (see below)

http://prntscr.com/hgnb4v

Re: SNMP checks

Posted: Wed Nov 29, 2017 5:34 pm
by npolovenko
@orani, RIght, check_snmp was probably written in C and you're looking at the compiled version. So you'd need to build or find another plugin on Nagios exchange and go from there. I highly recommend checking out the link that i provided in my previous post. You may find a plugin written in php or python and you'll be able to edit it.
Check out this tutorial: https://support.nagios.com/kb/article/n ... al-77.html Close to the bottom they explain how to modify snmptt.conf file to customize SNMP trap output. Not a solution for everything but you may be able to come up with something.
Just to throw in an extra option, you could contact our sales department for a custom feature request.