Setup SNMP for a CISCO Switch

Video Lecture

Setup SNMP for a CISCO Switch Setup SNMP for a CISCO Switch Setup SNMP for a CISCO Switch

Description

I am now going to configure Prometheus to query SNMP from my Cisco Switch.

My Cisco Switch is a 24 Port Cisco Catalyst 2950.

After doing a factory reset of the Switch, It has

  • SNMP enabled
  • The default gateway set to the IP address of my main network router that is connected to the internet

On my switch, I can telnet to it and see the configuration.

telnet 192.168.1.1
#enter the password
Switch>enable
#enter the next password
Switch#show config

The response shows that my switch is configured with an IP address, a default gateway, and an SNMP read only community.

interface Vlan1
 ip address 192.168.1.1 255.255.255.0
 no ip route-cache
!
ip default-gateway 192.168.1.254
snmp-server community public RO

On my internet firewall/router, I have created a new forwarding rule external port 161 to internal port 161 IP address 192.168.1.1

I have also verified that I can do some basic SNMP queries from the command line on my Prometheus server.

Test snmpget

snmpwalk -v2c -cpublic X.X.X.X 1.3.6.1.2.1.1

Test snmpwalk

snmpget -v2c -cpublic X.X.X.X 1.3.6.1.2.1.1.1.0

```

I then add my internet routers external IP address to the prometheus.yml configuration for the SNMP scrape target, and Prometheus is now able to query the SNMP properties of my switch through the SNMP exporter process.

I can verify that i am seeing data in Prometheus by querying the ifInOctets metric. This shows a new metric for every ethernet interface on my Switch.

SNMP Exporter if_mib Grafana Dashboard

I use the SNMP Stats dashboard from the Grafana community at https://grafana.com/grafana/dashboards.

This is a dashboard was written specifically for the if_mib module that is configured in the snmp.yml and referenced in the prometheus.yml for the SNMP job used by the SNMP Exporter.

This dashboard is very generic and will be a good starting point to work from.