// Lesson 37 of 49 · IP services
SNMP and syslog
Monitoring devices with SNMP v2c and v3, and logging to a syslog server with the right severity levels.
2 min read#snmp#syslog#monitoring
SNMP — monitoring
SNMP lets a monitoring system (the manager, or NMS) read and sometimes change information on devices (the agents). Data is organised in the MIB; each value has an OID.
| Operation | Direction | Port |
|---|---|---|
| Get / GetNext / GetBulk | Manager polls agent | UDP 161 |
| Set | Manager changes a value | UDP 161 |
| Trap / Inform | Agent alerts manager (inform is acknowledged) | UDP 162 |
Versions
| Version | Security |
|---|---|
| v1, v2c | Community strings sent in clear text — read-only at most, and only on a protected network |
| v3 | Users with authentication (authNoPriv) and encryption (authPriv). Use this. |
! SNMPv2c read-only, limited by ACL
R1(config)# access-list 99 permit 192.168.1.30
R1(config)# snmp-server community <RO-STRING> RO 99
! SNMPv3 with authentication and encryption
R1(config)# snmp-server group NMS v3 priv
R1(config)# snmp-server user nmsuser NMS v3 auth sha <AUTH-PASS> priv aes 128 <PRIV-PASS>
R1(config)# snmp-server host 192.168.1.30 version 3 priv nmsuser
Syslog — logging
Devices produce log messages like:
*Oct 7 10:22:41.123 GST: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down
Format: %FACILITY-SEVERITY-MNEMONIC: description.
Severity levels (lower = more serious)
| Level | Name |
|---|---|
| 0 | Emergency |
| 1 | Alert |
| 2 | Critical |
| 3 | Error |
| 4 | Warning |
| 5 | Notification |
| 6 | Informational |
| 7 | Debugging |
A memory aid: Every Awesome Cisco Engineer Will Need Ice-cream Daily.
Setting a level logs that level and everything more severe (lower numbers).
Where logs go
R1(config)# logging host 192.168.1.40 ! syslog server, UDP 514
R1(config)# logging trap informational ! levels 0-6 to the server
R1(config)# logging buffered 64000 warnings ! keep levels 0-4 in RAM
R1(config)# logging console warnings
R1(config)# service timestamps log datetime msec
R1# show logging
R1# terminal monitor ! see logs in your SSH session
Logs are only useful with correct time — configure NTP first.
Key points
- SNMP polls on UDP 161, traps/informs on UDP 162.
- v2c communities are clear text; use SNMPv3 authPriv.
- Syslog severities 0 (emergency) to 7 (debugging); a level includes everything more severe.
- Send logs to a central server on UDP 514, with timestamps.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.