| 219 | |
| 220 | === Configuration of snmpd on your PC === |
| 221 | |
| 222 | For this exercise your group needs to verify that the snmpd service is running and responding to queries for all machines in your group. First enable snmpd on your machine, then test if your machine is responding, then check each machine of your other group members. |
| 223 | |
| 224 | Install the SNMP agent (daemon) |
| 225 | {{{ |
| 226 | $ sudo apt-get install snmpd |
| 227 | $ sudo apt-get install libsnmp-dev |
| 228 | }}} |
| 229 | ==== Configuration ==== |
| 230 | |
| 231 | We will make a backup of the distributed config, and then we will create our own: |
| 232 | {{{ |
| 233 | $ cd /etc/snmp |
| 234 | $ sudo mv snmpd.conf snmpd.conf.dist |
| 235 | $ sudo editor snmpd.conf |
| 236 | }}} |
| 237 | |
| 238 | Then, copy/paste the following (change pcX to your own pc number): |
| 239 | {{{ |
| 240 | # Listen for connections on all interfaces (both IPv4 *and* IPv6) |
| 241 | agentAddress udp:161,udp6:[::1]:161 |
| 242 | |
| 243 | # For SNMPv2: Configure Read-Only community and restrict who can connect |
| 244 | rocommunity NetManage 10.10.0.0/16 |
| 245 | rocommunity NetManage 127.0.0.1 |
| 246 | |
| 247 | # Information about this host |
| 248 | sysLocation NSRC Network Management Workshop |
| 249 | sysContact sysadm@pcX.ws.nsrc.org |
| 250 | |
| 251 | # Which OSI layers are active in this host |
| 252 | # (Application + End-to-End layers) |
| 253 | sysServices 72 |
| 254 | |
| 255 | # Include proprietary dskTable MIB (in addition to hrStorageTable) |
| 256 | includeAllDisks 10% |
| 257 | }}} |
| 258 | Now save and exit from the editor. |
| 259 | |
| 260 | Now we will add the same SNMPv3 user to your PC. We need to stop snmpd before adding the user, and restart it to read the above changes as well as the new user: |
| 261 | {{{ |
| 262 | $ sudo service snmpd stop |
| 263 | $ sudo net-snmp-create-v3-user -a SHA -A <class password> admin |
| 264 | $ sudo service snmpd start |
| 265 | }}} |
| 266 | |
| 267 | Check that snmpd is working: |
| 268 | {{{ |
| 269 | $ snmpstatus localhost |
| 270 | }}} |
| 271 | |
| 272 | Test your neighbors |
| 273 | {{{ |
| 274 | $ snmpstatus <Neighbor IP Address> |
| 275 | }}} |
| 276 | |
| 277 | === Adding MIBs === |
| 278 | |
| 279 | Remember when you ran: |
| 280 | |
| 281 | $ snmpwalk <IP Address> .1.3.6.1.4.1.9.9.13.1 |
| 282 | If you noticed, the SNMP client (snmpwalk) couldn't interpret all the OIDs coming back from the Agent: |
| 283 | |
| 284 | SNMPv2-SMI::enterprises.9.9.13.1.3.1.2.1 = STRING: "chassis" |
| 285 | SNMPv2-SMI::enterprises.9.9.13.1.3.1.6.1 = INTEGER: 1 |
| 286 | What is 9.9.13.1.3.1 ? |
| 287 | |
| 288 | To be able to interpret this information, we need to download extra MIBs: |
| 289 | |
| 290 | Download them now as follows: |
| 291 | {{{ |
| 292 | $ cd /usr/share/mibs |
| 293 | $ sudo mkdir cisco |
| 294 | $ cd cisco |
| 295 | |
| 296 | $ sudo wget http://www.ws.nsrc.org/downloads/mibs/CISCO-SMI.my |
| 297 | $ sudo wget http://www.ws.nsrc.org/downloads/mibs/CISCO-ENVMON-MIB.my |
| 298 | }}} |
| 299 | |
| 300 | Now we need to tell the snmp tools that we have the cisco MIBS it should load. So edit the file /etc/snmp/snmp.conf, and add the following two lines: |
| 301 | {{{ |
| 302 | mibdirs +/usr/share/mibs/cisco |
| 303 | mibs +CISCO-ENVMON-MIB:CISCO-SMI |
| 304 | }}} |
| 305 | Save the file, quit. |
| 306 | |
| 307 | Now, try again: |
| 308 | |
| 309 | $ snmpwalk <IP Address> .1.3.6.1.4.1.9.9.13.1 |