Reading “SNMP Mastery” by Michael W Lucas.
I have a weird hobby of reading easy tech books when resting, having time off from reading hard books.
“SNMP Mastery” is an easy book, you can read it in half a day and learn a bit of new knowledge about, well, network management which is unlikely to be useful, but you will understand what your company’s IT guys are talking about. His writing is light, very clear, and rich with both examples and metaphors (for which he extensively uses Lovecraftian jargon).
In this file I also copied a few examples about how to use SNMP to check some basic parameters. (If your home router supports SNMP.)
SNMP is a nice authenticated statistics collection and delivery tool. It is often used when a machine does not allow installing a dedicated monitoring agent, such as zabbiz-agent or monitoring-plugins.
Lucas’ book is very simple and consistently presented. I enjoyed reading it partially because I have been reading a lot of complicated stuff recently, and like reading simple stuff as a way of distraction.
1. Examples and notes
The most valuable thing to remember: you can (must) add user-creation lines into snmpd’s persistence file and restart snmpd. It will change this file, remove your lines and hash the password. This is a weird behaviour I have not seen before, so it is worth keeping in mind. Also, users have to be cloned from templates, which is also weird.
createUser user authalgo "authpassphrase" privalgo "privpassphrase" rwuser user
The rest is quite obvious.
snmpbulkwalk -v 3 -l priv -u template-lockywolf\ -A <pass> -a SHA-256\ -X <pass> -x AES128\ tcp:192.168.1.3
Get all stats
snmpbulkwalk -v 3 -l priv -u template-lockywolf\ -A <pass> -a SHA-256\ -X <pass> -x AES128\ localhost
Get one stat
snmpbulkwalk -v 3 -l priv -u template-lockywolf\ -A <pass> -a SHA-256\ -X <pass> -x AES128\ localhost IF-MIB::ifNumber.0
Explain the meaning of a MIB.
snmptranslate -Td IF-MIB::ifNumber.0
Print a table
snmptable -v 3 -l priv -u template-lockywolf\ -A <pass> -a SHA-256\ -X <pass> -x AES128\ localhost ipNetToMedia
Config utility
snmpconf
Set values
smtpset
Not all systems support smtpset, and each time it is worth debugging the issue separately.
But, in principle, it can be very efficient.
Agents contacting the manager
Run snmptrapd to collect data.