check_snmp help

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.
Pikmin
Posts: 80
Joined: Tue Feb 17, 2015 5:32 pm

check_snmp help

Post by Pikmin »

Hi guys and girls,
I have Nagios Core installed and want to monitor the VLAN membership on Cisco switches, I also monitor the power used on the port and whether it's up or down in the same command, but VLAN is where my problem lies

This is the command I use (just the VLAN part) and works fine unless a port is a member of two VLANs in which case I only get the first VLAN- this is the first minor issue

Code: Select all

./check_snmp -H 192.168.130.152 -C public -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 -l "VLAN =" 
SNMP OK - VLAN = 192 | 'VLAN ='=192 
However, when I run this on a trunk port

Code: Select all

./check_snmp -H 192.168.130.152 -C public -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10123 -l "VLAN =" 
External command error: Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10123
I'm using groups when checking VLANs so I have checks for ports 1-24 for every switch. On some of them ports 23-24 are trunked. I'd like to keep using groups otherwise I would need separate checks for every switch. I guess my question is, is there another command that I'm not aware of that I could use to check VLAN membership where I won't get an error when run on a trunked port? Any recommendations are highly appreciated
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_snmp help

Post by Box293 »

Pikmin wrote:This is the command I use (just the VLAN part) and works fine unless a port is a member of two VLANs in which case I only get the first VLAN- this is the first minor issue

Code: Select all

    ./check_snmp -H 192.168.130.152 -C public -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 -l "VLAN ="
    SNMP OK - VLAN = 192 | 'VLAN ='=192
Can you please run this with the verbose flag -v and post back the output:

Code: Select all

./check_snmp -H 192.168.130.152 -C public -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 -l "VLAN =" -v
Also, you'll notice the fist line it outputs is the snmpget command, it'll be something like:

Code: Select all

/usr/bin/snmpget -Le -t 3 -r 5 -m ALL -v 1 [authpriv] 192.168.130.152:161 SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101
Can you also run this in debug mode (-D ALL) and post the output:

Code: Select all

/usr/bin/snmpget -Le -t 3 -r 5 -m ALL -v 1 [authpriv] 192.168.130.152:161 SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 -D ALL
Pikmin wrote:I'm using groups when checking VLANs so I have checks for ports 1-24 for every switch. On some of them ports 23-24 are trunked. I'd like to keep using groups otherwise I would need separate checks for every switch. I guess my question is, is there another command that I'm not aware of that I could use to check VLAN membership where I won't get an error when run on a trunked port? Any recommendations are highly appreciated
You might be able to exclude those specific switches in the switches using a ! to exclude them. You could put all these switches in a group and exclude the group:
https://assets.nagios.com/downloads/nag ... ricks.html
Excluding Hosts:
If you want to create identical services on numerous hosts or hostgroups, but would like to exclude some hosts from the definition, this can be accomplished by preceding the host or hostgroup with a ! symbol.

Code: Select all

define service{
		host_name             HOST1,HOST2,!HOST3,!HOST4,...,HOSTN
		hostgroup_name                HOSTGROUP1,HOSTGROUP2,!HOSTGROUP3,!HOSTGROUP4,...,HOSTGROUPN
		service_description   SOMESERVICE
		other service directives ...
		}
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pikmin
Posts: 80
Joined: Tue Feb 17, 2015 5:32 pm

Re: check_snmp help

Post by Pikmin »

Thank you! I had no idea about the exclude directive.

Code: Select all

[/./check_snmp -H 192.168.130.152 -C public -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 -l "VLAN =" -v           /usr/bin/snmpget -Le -t 1 -r 5 -m ALL -v 1 [authpriv] 192.168.130.152:161 SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 = INTEGER: 192
SNMP OK - VLAN = 192 | 'VLAN ='=192
http://pastebin.com/raw.php?i=WYjND4ed
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_snmp help

Post by Box293 »

Sorry I made a mistake with the snmpget command I got you to run, I left out the community argument.

Try:

Code: Select all

/usr/bin/snmpget -Le -t 3 -r 5 -m ALL -v 1 -c public 192.168.130.152:161 SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 -D ALL
Replace public with your community.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pikmin
Posts: 80
Joined: Tue Feb 17, 2015 5:32 pm

Re: check_snmp help

Post by Pikmin »

User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_snmp help

Post by Box293 »

Nothing is standing out in that output.

I've noticed your original command does not define an SNMP version so it is defaulting to v1. I'm interested to see what happens when you run it with v2c, try this command:

Code: Select all

./check_snmp -H 192.168.130.152 -C public -P 2c -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 -l "VLAN =" 
Also, can you do a walk:

Code: Select all

snmpwalk -c public -v 2c 192.168.130.152 SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pikmin
Posts: 80
Joined: Tue Feb 17, 2015 5:32 pm

Re: check_snmp help

Post by Pikmin »

Code: Select all

[root@ndnagios libexec]# ./check_snmp -H 192.168.130.152 -C public -P 2c -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10120 -l "VLAN =" 
SNMP OK - VLAN = 152 | 'VLAN ='=152 
[root@ndnagios libexec]# ./check_snmp -H 192.168.130.152 -C public -P 2c -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10121 -l "VLAN =" 
SNMP OK - VLAN = 182 | 'VLAN ='=182 
[root@ndnagios libexec]# ./check_snmp -H 192.168.130.152 -C public -P 2c -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10122 -l "VLAN =" 
SNMP OK - VLAN = Such Instance currently exists at this OID | 
[root@ndnagios libexec]# ./check_snmp -H 192.168.130.152 -C public -P 2c -o SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10123 -l "VLAN =" 
SNMP OK - VLAN = Such Instance currently exists at this OID | 

Code: Select all

[root@ndnagios libexec]# snmpwalk -c public -v 2c 192.168.130.152 SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10101 = INTEGER: 192
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10102 = INTEGER: 192
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10103 = INTEGER: 192
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10104 = INTEGER: 192
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10105 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10106 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10107 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10108 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10109 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10110 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10111 = INTEGER: 182
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10112 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10113 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10114 = INTEGER: 192
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10115 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10116 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10117 = INTEGER: 182
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10118 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10119 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10120 = INTEGER: 152
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10121 = INTEGER: 182
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10201 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.68.1.2.2.1.2.10202 = INTEGER: 1
Looks like even with version 2 it doesn't actually find the trunk ports (22-24) only goes up to 21 in the above walk

show interfaces status
truncated
Gi0/20 IP PHONE connected 152 a-full a-10 10/100/1000BaseTX
Gi0/21 connected 182 a-half a-10 10/100/1000BaseTX
Gi0/22 Link to Access Swi connected trunk a-full a-1000 10/100/1000BaseTX
Gi0/23 Link to Access Swi connected trunk a-full a-1000 10/100/1000BaseTX
Gi0/24 Link to Access Swi connected trunk a-full a-1000 10/100/1000BaseTX
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_snmp help

Post by Box293 »

I think you are going to need to use the exclude directive for those switches with trunk ports.

I'm not sure how to proceed with the issue where multiple VLAN's are only reporting the first VLAN. Does anyone else out there have any ideas?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pikmin
Posts: 80
Joined: Tue Feb 17, 2015 5:32 pm

Re: check_snmp help

Post by Pikmin »

Thanks for all your help, aprreciate it.
For now I've decided to keep them all monitored but will keep in mind I have the exclude directive option

Ports that are not trunked output:
SNMP OK - VLAN = 34 Power = 0 Port Status = up(1)
SNMP OK - VLAN = 34 Power = 0 Port Status = up(1)
SNMP OK - VLAN = 34 Power = 0 Port Status = up(1)


Ports 21-24 only check for Power and Port Status, so I don't have to worry about VLAN error messages
Gi0/23 Description
SNMP OK - Power = 0 Port Status = up(1)
Gi0/24 Description
SNMP OK - Power = 0 Port Status = up(1)
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_snmp help

Post by hsmith »

Pikmin wrote:Thanks for all your help, aprreciate it.
For now I've decided to keep them all monitored but will keep in mind I have the exclude directive option

Ports that are not trunked output:
SNMP OK - VLAN = 34 Power = 0 Port Status = up(1)
SNMP OK - VLAN = 34 Power = 0 Port Status = up(1)
SNMP OK - VLAN = 34 Power = 0 Port Status = up(1)


Ports 21-24 only check for Power and Port Status, so I don't have to worry about VLAN error messages
Gi0/23 Description
SNMP OK - Power = 0 Port Status = up(1)
Gi0/24 Description
SNMP OK - Power = 0 Port Status = up(1)
Is there anything else we can do for you, or are you all right one this one for now?
Former Nagios Employee.
me.
Locked