Hi all,
I'm having trouble with getting the SNMP to work with Nagios. I have Nagios® Core™ Version 4.0.8 on a Ubuntu Linux 14.04.1
The SNMP version is snmpd 5.7.2
I have it installed, I have cacti Installed in the same machine and the SNMP works fine with it, it captures traffic and read the Cisco devices with cacti, so, I have discarded Firewall issues or connectivity.
When I run $ sudo snmpwalk localhost -v 1 -c public , the command works fine and gives me the information on the server.
When I run $ sudo snmpwalk 1xx.x9.x2.x6 -c anything -v1
I get:
Timeout: No Response from 1xx.x9.x2.x6
If I run the snmp_check command from nagios libexec I get:
sudo ./check_snmp -H 1xx.x9.x2.x6 -C anything -o ifOperStatus.1 -P 1
External command error: Timeout: No Response from 1xx.x9.x2.x6:161.
I had removed the SNMP software several times, and install it again.
$ sudo /usr/sbin/snmpd -f
Error opening specified endpoint ""
Server Exiting with code 1
The configuration is the following..
***** /etc/snmp/snmpd.conf*****
###############################################################################
# Access Control
###############################################################################
com2sec readonly localhost public
group MyROGroup v1 readonly
group MyROGroup v2c readonly
view all included .1 80
access MyROGroup "" any noauth exact all none none
syslocation Wonderland
syscontact Alice
###############################################################################
# Embedded Subagents
###############################################################################
#perl do "tests/check_snmp_agent.pl";
************************ /etc/default/snmpd***********************************************************
# This file controls the activity of snmpd and snmptrapd
# Don't load any MIBs by default.
# You might comment this lines once you have the MIBs downloaded.
export MIBS=UCD-SNMP-MIB
# snmpd control (yes means start daemon).
SNMPDRUN=yes
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /var/run/snmpd.pid'
# snmptrapd control (yes means start daemon). As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run. See snmpd.conf(5) for how to do this.
TRAPDRUN=no
# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
If anyone has any ideas I really appreciated.. I've been struggling with this for quite long time now..
Thank you..
Problem with SNMP monitoring (timeout: No Response)
Problem with SNMP monitoring (timeout: No Response)
Last edited by Mauusss on Fri Mar 13, 2015 7:21 pm, edited 1 time in total.
Re: Problem with SNMP monitoring (timeout: No Response)
If the community string is set to public on the Cisco Device, try running the command like this to see if it works for you.
Code: Select all
sudo ./check_snmp -H 1xx.x9.x2.x6 -C public -o ifOperStatus.1 -P 1Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Problem with SNMP monitoring (timeout: No Response)
tgriep wrote:If the community string is set to public on the Cisco Device, try running the command like this to see if it works for you.
Code: Select all
sudo ./check_snmp -H 1xx.x9.x2.x6 -C public -o ifOperStatus.1 -P 1
Hi tgriep, Thank you for the quick response..
I did the test changing the SNMP community to "public" and it worked!!,
Then I did some more digging on it, and I found out that there are some symbols that if included in the SNMP community, the snmpd won´t take, like we have an SNMP community like ABC$2345Atha197% and it didn´t work, I changed it to the same removing the symbols, and it work, I change it to one like ABC$2345Atha197$ and it work, so the only thing common I found is that the percentage symbol (%) at the end doesn´t work.
Then I move to check the services with the snmpwalk, and the check_snmp from the command line , and I did got the correct result...
$sudo ./check_snmp -H 1xx.x9.x2.xx6 -C ABC$2345Atha197$ -o sysUpTime.0 -P1
SNMP OK - Timeticks: (1191209546) 137 days, 20:54:55.46 |
But I configure the command in the Nagios Object and I get the following error...
*****************configuration in Nagios object**********************************
define service{
use generic-service ; Inherit values from a template
host_name SWABC123
service_description Uptime
check_command check_snmp!-C ABC$2345Atha197$ -o sysUpTime.0 -P1
}
***********************RESULT IN NAGIOS WEBPAGE**************************
Current Status:
UNKNOWN
(for 0d 0h 46m 55s)
Status Information: check_snmp: Invalid SNMP version - 2c$
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]
I had tried with snmp version 1 and version 2c, and in the command line they work with the snmpwalk and with the check_snmp, but not in the Nagios webpage..
Some of the options I had tried..
check_snmp!-C ABC$2345Atha197$ -o sysUpTime.0 -P2c
check_snmp!-C ABC$2345Atha197$ -o sysUpTime.0 -P 1
check_snmp!-C ABC$2345Atha197$ -o sysUpTime.0
When I remove the -P 1 from the command in the Nagios Configuration, I get the following error..
External command error: sysUpTime.0$: Unknown Object Identifier (Sub-id not found: sysUpTime -> 0$)
If you have any more advice.. I would really appreciated.. your help has been really great.. and I feel like I'm one step closer..
Thank you..
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Problem with SNMP monitoring (timeout: No Response)
Hi Mauusss
By default the core install's check_snmp command definition is not configured to handle passing in the community string.
in /usr/local/nagios/etc/commands.cfg change the line that looks like this
to this
Then change your service definition check_command line to this:
Be aware that if you're already using that check_snmp command elsewhere this will likely break it so you may even want to just define a totally new command in your commands.cfg file
By default the core install's check_snmp command definition is not configured to handle passing in the community string.
in /usr/local/nagios/etc/commands.cfg change the line that looks like this
Code: Select all
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$Code: Select all
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -o $ARG1$ -C $ARG2$Code: Select all
check_command check_snmp!sysUpTime.0!ABC$2345Atha197$Re: Problem with SNMP monitoring (timeout: No Response)
Thank you.. jdalrymple!!
It worked just fine!!..
What I did so I can use the check_snmp command with other services was that in the /usr/local/nagios/etc/commands.cfg I create a new command like this..
and in the service definition, I define it like this..
now is working perfect..
Thank you again.. great help
It worked just fine!!..
What I did so I can use the check_snmp command with other services was that in the /usr/local/nagios/etc/commands.cfg I create a new command like this..
Code: Select all
# 'check_snmp_uptime' command definition
define command{
command_name check_snmp_uptime
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -o sysUpTime.0 -P1 -C $ARG1$
}Code: Select all
check_command check_snmp_uptime!ABC%67455snmp197$Thank you again.. great help