Page 1 of 1

Having issues getting SNMP working

Posted: Thu Apr 21, 2016 2:30 pm
by jLinux
Hello! I'm somewhat new to Nagios. I've used it before at other companies, but this is the first time I'm setting it up from scratch, and I'm having issues with the SNMP checks.

I got the Nagios/Check_MK/OMD install done, and all seemed to go well, but when I add a host, the SNMP checks fail. I followed the instructions I found here: http://www.liquidweb.com/kb/how-to-inst ... on-centos/, and got SNMP installed (for now, the /etc/snmp/snmpd.conf is the exact same as whats in that article.)
[root@server plugins]# ./check_snmp -H 192.168.1.34 -P 2c -C 209ijvfwer0df92jd -o ifOperStatus.1 -P 1
External command error: Timeout: No Response from 192.168.1.34:161.
Debugging Details:
- I can tell that the snmpd service is running via ps
- I can see its listening on port 161/udp via lsof
- I added ALL: ALL: ALLOW to /etc/hosts.allow just to be sure that's not rejecting anything
- Firewall is open for 161/udp (I actually turned it off on both servers for troubleshooting)
- I can tell the connection from the nagios server to the client is made via watching the output of tcpdump and tailing /var/log/messages

If it helps, heres the output of some of the logs on the client that are generated when I execute the ./check_snmp above:
[root@server ~]# tail -n 0 -f /var/log/messages /var/log/secure /var/log/firewalld
==> /var/log/messages <==

==> /var/log/secure <==

==> /var/log/firewalld <==

==> /var/log/messages <==
Apr 21 15:28:41 silo-stg-a01 snmpd[11608]: Connection from UDP: [192.168.1.38]:39158->[192.168.1.34]:161
Apr 21 15:28:42 silo-stg-a01 snmpd[11608]: Connection from UDP: [192.168.1.38]:39158->[192.168.1.34]:161
Apr 21 15:28:43 silo-stg-a01 snmpd[11608]: Connection from UDP: [192.168.1.38]:39158->[192.168.1.34]:161
Apr 21 15:28:44 silo-stg-a01 snmpd[11608]: Connection from UDP: [192.168.1.38]:39158->[192.168.1.34]:161
Apr 21 15:28:45 silo-stg-a01 snmpd[11608]: Connection from UDP: [192.168.1.38]:39158->[192.168.1.34]:161
Apr 21 15:28:46 silo-stg-a01 snmpd[11608]: Connection from UDP: [192.168.1.38]:39158->[192.168.1.34]:161
Apr 21 15:28:46 silo-stg-a01 snmpd[11608]: Connection from UDP: [192.168.1.160]:59707->[192.168.1.34]:161
I found this thread: https://support.nagios.com/forum/viewto ... 0&p=104344 which apparently the solution was to add -P 2c to the command, which you can see I did above, but it didn't work.

If anyone has anything that can help, it would be much appreciated! Thanks

Re: Having issues getting SNMP working

Posted: Thu Apr 21, 2016 2:37 pm
by hsmith
Hello,

I'm going to start with the giant bold disclaimer. We do not support check_mk or OMD.

What I would do is do an SNMPWalk against your target server.

Here's an example of mine:

Code: Select all

[root@XI5 libexec]# snmpwalk 172.16.0.200 -c public -v2c -On
.1.3.6.1.2.1.1.1.0 = STRING: Linux myserver 4.3.3-301.fc23.x86_64 #1 SMP Fri Jan 15 14:03:17 UTC 2016 x86_64
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: (496) 0:00:04.96
.1.3.6.1.2.1.1.4.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
.1.3.6.1.2.1.1.5.0 = STRING: myserver
.1.3.6.1.2.1.1.6.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
.1.3.6.1.2.1.1.8.0 = Timeticks: (2) 0:00:00.02
.1.3.6.1.2.1.1.9.1.2.1 = OID: .1.3.6.1.6.3.11.3.1.1
.1.3.6.1.2.1.1.9.1.2.2 = OID: .1.3.6.1.6.3.15.2.1.1
.1.3.6.1.2.1.1.9.1.2.3 = OID: .1.3.6.1.6.3.10.3.1.1
.1.3.6.1.2.1.1.9.1.2.4 = OID: .1.3.6.1.6.3.1
.1.3.6.1.2.1.1.9.1.2.5 = OID: .1.3.6.1.6.3.16.2.2.1
....
This is an easy way to verify if SNMP is working.

Re: Having issues getting SNMP working

Posted: Thu Apr 21, 2016 2:40 pm
by jLinux
Right, I figured it wasn't supported, but I just added that it was part of what I installed, this snmp check is related to the nagios core I believe

Regarding the SNMP Check:
[root@server conf.d]# snmpwalk 192.168.1.34 -c 209ijvfwer0df92jd -v2c -On
.1.3.6.1.2.1.1.1.0 = STRING: Linux server.company.com 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: (140489) 0:23:24.89
.1.3.6.1.2.1.1.4.0 = STRING: root@localhost
.1.3.6.1.2.1.1.5.0 = STRING: server.company.com
.1.3.6.1.2.1.1.6.0 = STRING: Unknown
.1.3.6.1.2.1.1.8.0 = Timeticks: (1) 0:00:00.01
.1.3.6.1.2.1.1.9.1.2.1 = OID: .1.3.6.1.6.3.11.3.1.1
.1.3.6.1.2.1.1.9.1.2.2 = OID: .1.3.6.1.6.3.15.2.1.1
.1.3.6.1.2.1.1.9.1.2.3 = OID: .1.3.6.1.6.3.10.3.1.1
Alright, that seems to work fine.. So why wont Nagios's check_snmp plugin work. Odd

Re: Having issues getting SNMP working

Posted: Thu Apr 21, 2016 2:47 pm
by jLinux
Ok.. so when I go back to the debugger in check_mk (I know, not supported, im just using it for debugging), it looks like SNMPv2 is working, just not SNMPv1.. Does Nagios need SNMPv1 for anything?

http://d.pr/i/14hC3


Edit: So it was a stupid issue... I had -P 2c in the middle, and -P 1 at the end. And SNMPv1 is whats failing.
[root@mon-stg-a01 conf.d]# /opt/omd/versions/1.20/lib/nagios/plugins/check_snmp -H 192.168.1.34 -P 2c -C 209ijvfwer0df92jd -o ifOperStatus.1
SNMP OK - up(1) |
Is there any reason I would need SNMPv1 is v2 is working just fine?

Re: Having issues getting SNMP working

Posted: Thu Apr 21, 2016 3:25 pm
by hsmith
v2 should be just fine. You can use v1 for the snmpwalk version as well, and that will give you a hint about what's going on.

Re: Having issues getting SNMP working

Posted: Sat Apr 23, 2016 6:55 pm
by nozlaf
jLinux wrote:Is there any reason I would need SNMPv1 is v2 is working just fine?
entirely depends on the check commands you are running against it, nagios doesn't "talk" snmp it executes plugins which may talk SNMP but all the plugin does is return result and performance data to nagios

from what you have written here you don't need snmpv1

Re: Having issues getting SNMP working

Posted: Mon Apr 25, 2016 9:48 am
by rkennedy
Thanks @nozlaf!

@jLinux - let us know if you have any further questions.