Setup SNMP for a CISCO Switch
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.
snmpwalk -v2c -cpublic X.X.X.X 188.8.131.52.2.1.1
snmpget -v2c -cpublic X.X.X.X 184.108.40.206.220.127.116.11.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
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.