SNMP on Ubuntu and FreeBSD


How to enable SNMP Monitoring on Ubuntu Server 12.04.2

Install SNMPD
$ sudo apt-get install snmpd

Create a backup file of snmpd.conf original file that we will edit later
$ sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori

Create the new snmpd.conf file
$ sudo vim /etc/snmp/snmpd.conf

Add the file with these lines

rocommunity public
syslocation "Your Location"
syscontact admin@domain.com

Then edit the /etc/default/snmpd file
$ sudo vim /etc/default/snmpd

Disable this line below by adding # in front of the line
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

And add a new line
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'

Restart the SNMPD service
$ sudo /etc/init.d/snmpd restart
* Restarting network management services


Install SNMP on FreeBSD

Install net-snmp from the ports collection
# cd /usr/ports/net-mgmnt/net-snmp
# make install clean
edit /etc/rc.conf and add the following line:
snmpd_enable="YES"
edit /usr/local/share/snmp/snmpd.conf and add the following:
syslocation home (replace home with the name you would like to use)
syscontact me@here.com (put in the systems admin e-mail address)
rocommunity 
public (replace with the read only name you would like to use)
rwcommunity private (change this to the writable password you would like to use)
master yes

Start the SNMP daemon
# /usr/local/etc/rc.d/snmpd.sh start

At this point, you up and running with a very basic snmp configuration. There's a handy utility called 'snmpconf' that can be run to help you generate the snmp.conf (optional) and snmpd.conf files. This will give you more options and help tighten up security.

Now, you should be able to snmpwalk your host using the following:
snmpwalk -v1 -c public 127.0.0.1



Post a Comment

0 Comments