Monitor cisco switch port status Gigabit

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.
borrierulez
Posts: 24
Joined: Wed Mar 16, 2016 4:59 am

Monitor cisco switch port status Gigabit

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Monitor cisco switch port status Gigabit

Post 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?
Former Nagios Employee
borrierulez
Posts: 24
Joined: Wed Mar 16, 2016 4:59 am

Re: Monitor cisco switch port status Gigabit

Post 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?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitor cisco switch port status Gigabit

Post 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?
Former Nagios employee
borrierulez
Posts: 24
Joined: Wed Mar 16, 2016 4:59 am

Re: Monitor cisco switch port status Gigabit

Post 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...
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitor cisco switch port status Gigabit

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
borrierulez
Posts: 24
Joined: Wed Mar 16, 2016 4:59 am

Re: Monitor cisco switch port status Gigabit

Post 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 :)
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Monitor cisco switch port status Gigabit

Post by rkennedy »

Can you also post your check_snmp command definition?
Former Nagios Employee
borrierulez
Posts: 24
Joined: Wed Mar 16, 2016 4:59 am

Re: Monitor cisco switch port status Gigabit

Post by borrierulez »

check_command check_snmp!-C Public -o ifOperStatus.436441088 -r 1 -m RFC1213-MIB
borrierulez
Posts: 24
Joined: Wed Mar 16, 2016 4:59 am

Re: Monitor cisco switch port status Gigabit

Post 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!
Locked