Having issues getting SNMP working

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
jLinux
Posts: 3
Joined: Thu Apr 21, 2016 12:25 pm

Having issues getting SNMP working

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Having issues getting SNMP working

Post 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.
Former Nagios Employee.
me.
jLinux
Posts: 3
Joined: Thu Apr 21, 2016 12:25 pm

Re: Having issues getting SNMP working

Post 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
jLinux
Posts: 3
Joined: Thu Apr 21, 2016 12:25 pm

Re: Having issues getting SNMP working

Post 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?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Having issues getting SNMP working

Post 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.
Former Nagios Employee.
me.
User avatar
nozlaf
Posts: 172
Joined: Sun Nov 09, 2014 9:50 pm
Location: Victoria, Australia

Re: Having issues getting SNMP working

Post 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
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Having issues getting SNMP working

Post by rkennedy »

Thanks @nozlaf!

@jLinux - let us know if you have any further questions.
Former Nagios Employee
Locked