SNMP checks

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

SNMP checks

Post 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"???
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: SNMP checks

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: SNMP checks

Post 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?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: SNMP checks

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: SNMP checks

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: SNMP checks

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked