| 138 | |
| 139 | == Configuration of SNMP Agent on a Linux server == |
| 140 | |
| 141 | We also need to monitor the servers and workstations. Here we do this by installing and configuring a SNMP agent on a server. |
| 142 | |
| 143 | Install the SNMP agent (daemon) on your host |
| 144 | |
| 145 | {{{ |
| 146 | $ sudo apt install snmpd |
| 147 | $ sudo apt install libsnmp-dev |
| 148 | }}} |
| 149 | |
| 150 | Before making any changes to configurations files of a new installation it is a good practice to backup the original configuration. |
| 151 | |
| 152 | {{{ |
| 153 | $ cd /etc/snmp |
| 154 | $ sudo mv snmpd.conf snmpd.conf.orig |
| 155 | $ sudo nano snmpd.conf |
| 156 | }}} |
| 157 | |
| 158 | Now enter the below configurations, |
| 159 | |
| 160 | {{{ |
| 161 | # Listen for connections on all interfaces (both IPv4 *and* IPv6) |
| 162 | agentAddress udp:161,udp6:[::1]:161 |
| 163 | |
| 164 | # For SNMPv2: Configure Read-Only community and restrict who can connect |
| 165 | rocommunity <class passowrd> 192.248.6.0/24 |
| 166 | rocommunity <class passowrd> 127.0.0.1 |
| 167 | |
| 168 | # Information about this host |
| 169 | sysLocation LEARN Workshop |
| 170 | sysContact sysadm@ws.ac.lk |
| 171 | |
| 172 | # Which OSI layers are active in this host |
| 173 | # (Application + End-to-End layers) |
| 174 | sysServices 72 |
| 175 | |
| 176 | # Include proprietary dskTable MIB (in addition to hrStorageTable) |
| 177 | includeAllDisks 10% |
| 178 | }}} |
| 179 | Now save and exit from the editor. |
| 180 | |
| 181 | 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: |
| 182 | {{{ |
| 183 | $ sudo service snmpd stop |
| 184 | $ sudo net-snmp-create-v3-user -a SHA -A <class password> admin |
| 185 | $ sudo service snmpd start |
| 186 | }}} |
| 187 | |
| 188 | Check that snmpd is working: |
| 189 | {{{ |
| 190 | $ snmpstatus localhost |
| 191 | }}} |
| 192 | |
| 193 | Test your neighbors |
| 194 | {{{ |
| 195 | $ snmpstatus <Neighbor IP Address> |
| 196 | }}} |