Page 1 of 2
Monitor cisco switch port status Gigabit
Posted: Wed Mar 16, 2016 5:22 am
by borrierulez
Hey everyone,
I've just setup switch monitoring with snmp, the uptime check works so i know snmp is working, i can't get the port status to work:
check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
We have all cisco gigabit switches so i don't think the .1 notation is correct.
Has anyone have experience with this and what the notation could be?
Re: Monitor cisco switch port status Gigabit
Posted: Wed Mar 16, 2016 11:34 am
by rkennedy
What error are you seeing when you try to execute that check?
Are you able to post the result of a SNMP walk against the switch?
Re: Monitor cisco switch port status Gigabit
Posted: Thu Mar 17, 2016 3:20 am
by borrierulez
Ok,
My output is like this:
RFC1213-MIB::ifDescr.436207616 = STRING: "Ethernet1/1"
So when i issue this command: RFC1213-MIB::ifDescr.436207616 = STRING: "Ethernet1/1" it works!
But off course if i have to look up every port for every switch i have this isn't really practicle, can i put code somewhere that he does the lookup based on this string?
Re: Monitor cisco switch port status Gigabit
Posted: Thu Mar 17, 2016 4:49 pm
by tmcdonald
I'm a little confused here by what you are looking to achieve - your service should have a description so there is no need to reference anything after the service has been made. Are you asking how to automate the naming of the service for each port?
Re: Monitor cisco switch port status Gigabit
Posted: Thu Mar 17, 2016 5:32 pm
by borrierulez
Sorry,
Copy paste error...
So, when i issue the command from shell: ./check_snmp -C public -o ifOperStatus.436207616 -r 1 -m RFC1213-MIB i get a good response
when i do it in nagios cfg file: check_snmp! -C public -o ifOperStatus.436207616 -r 1 -m RFC1213-MIB i get a timout... So that's another issue...
What i want to accomplish is instead of manually looking up the nr and issuing the command for example: ifOperStatus.436207616 i want to issue it by string ifOperStatus.436207616.'Ethernet1/1' something like that
But also don't know why i get a timeout if i run it in nagios... Nagios is hard...
Re: Monitor cisco switch port status Gigabit
Posted: Thu Mar 17, 2016 6:02 pm
by Box293
borrierulez wrote:So, when i issue the command from shell: ./check_snmp -C public -o ifOperStatus.436207616 -r 1 -m RFC1213-MIB i get a good response
when i do it in nagios cfg file: check_snmp! -C public -o ifOperStatus.436207616 -r 1 -m RFC1213-MIB i get a timout... So that's another issue...
Your command example at the shell does not include -H xxx.xxx.xxx.xxx , perhaps this is a copy and paste error.
Can you post:
The command definition for check_snmp
The definition for this host
The definition for this service
borrierulez wrote:What i want to accomplish is instead of manually looking up the nr and issuing the command for example: ifOperStatus.436207616 i want to issue it by string ifOperStatus.436207616.'Ethernet1/1' something like that
This forum post sort of covers what you are talking about:
https://support.nagios.com/forum/viewto ... 3&start=30
But it still doesn't allow you to use the string.
Perhaps you need to create a bash script that does a snmpwalk and then takes the output to generate the configs.
Re: Monitor cisco switch port status Gigabit
Posted: Fri Mar 18, 2016 3:42 am
by borrierulez
Here you go:
define host{
use generic-switch ; Inherit default values from a template
host_name switchname ; The name we're giving to this switch
alias Cisco Core Switch 1 ; A longer name associated with the switch
address IPaddress ; IP address of the switch
hostgroups switches ; Host groups this switch is associated with
}
define service{
use generic-service ; Inherit values from a template
hostgroup_name switches
service_description Port 1/52 Link Status
check_command check_snmp!-C Public -o ifOperStatus.436441088 -r 1 -m RFC1213-MIB t 60
}
In the shell command I indeed use the -H
I already checked out the other post, learned a lot from it but indeed, need to find out how to write a batch script, you may have noticed i'm not a linux pro

Re: Monitor cisco switch port status Gigabit
Posted: Fri Mar 18, 2016 11:52 am
by rkennedy
Can you also post your check_snmp command definition?
Re: Monitor cisco switch port status Gigabit
Posted: Fri Mar 18, 2016 3:10 pm
by borrierulez
check_command check_snmp!-C Public -o ifOperStatus.436441088 -r 1 -m RFC1213-MIB
Re: Monitor cisco switch port status Gigabit
Posted: Mon Mar 21, 2016 6:28 am
by borrierulez
Ok, this was really weird, i had 2 community strings, the one I used was able to get the uptime but not the port status, i'm using the other community string now and everything works fine.
Thanks for the help everyone.
Ow yeah, i'm using the check_snmp_netint.pl plugin now, with that you can just use the portname string as a parameter and you can also scan all your admin up ports!