Difference between revisions of "Host SNMP Configuration"

From Technologia Incognita
Jump to: navigation, search
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
 +
<p>
 
First install Net-SNMP :
 
First install Net-SNMP :
 +
</p>
  
root@ubuntu:~# apt-get install snmpd  
+
<p>
 
+
<i> root@ubuntu:~# apt-get install snmpd </i> <br>
 
+
<b>Ubuntu: make sure the SNMPDOPTS line in /etc/default/snmpd looks like this</b>
 
+
</p>
'''Ubuntu: make sure the SNMPDOPTS line in /etc/default/snmpd looks like this'''
 
 
 
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -p /var/run/snmpd.pid'
 
 
 
  
 +
<p>
 +
<i>SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -p /var/run/snmpd.pid'</i>
 +
</p>
  
Redhat: make sure the OPTIONS line in /etc/sysconfig/snmpd looks like this
+
<p>
 
+
<b>This also disables logging and as such gets rid of annoying "features" like</b><br>
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid"
 
 
 
This also disables logging and as such gets rid of annoying "features" like
 
 
 
 
snmpd[4990]: Connection from UDP: 1.2.3.4
 
snmpd[4990]: Connection from UDP: 1.2.3.4
 +
</p>
  
Replace the default /etc/snmp/snmpd.conf file with something like this, changing the community, location and contact fields
+
<p>
 +
<b>Replace the default /etc/snmp/snmpd.conf file with something like this, changing the community, location and contact fields</b>
 +
</p>
  
com2sec readonly  default        <COMMUNITY>
+
<p>
group MyROGroup v1        readonly
+
<i>com2sec readonly  default        techinc</i><br>
group MyROGroup v2c        readonly
+
<i>group MyROGroup v1        readonly</i><br>
group MyROGroup usm        readonly
+
<i>group MyROGroup v2c        readonly</i><br>
view all    included  .1                              80
+
<i>group MyROGroup usm        readonly</i><br>
access MyROGroup ""      any      noauth    exact  all    none  none
+
<i>view all    included  .1                              80</i><br>
syslocation <LOCATION>
+
<i>access MyROGroup ""      any      noauth    exact  all    none  none</i><br>
syscontact <CONTACT>
+
<i>syslocation Louwesweg 1 </i><br>
#This line allows Observium to detect the host OS if the distro script is installed
+
<i>syscontact Network Team</i><br>
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro  
+
<i>#This line allows Observium to detect the host OS if the distro script is installed</i><br>
 +
<i>extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro</i>
 +
</p>
  
Get the observium 'distro' script to identify your distribution via SNMP
+
<p>
 +
<b>Get the observium 'distro' script to identify your distribution via SNMP</b>
 +
</p>
  
wget http://www.observium.org/svn/observer/trunk/scripts/distro
+
<p>
mv distro /usr/bin/distro
+
<i>wget http://www.observium.org/svn/observer/trunk/scripts/distro/<br></i>
chmod 755 /usr/bin/distro
+
<i>mv distro /usr/bin/distro</i><br>
 +
<i>chmod 755 /usr/bin/distro</i>
 +
</p>
  
You should then be able to restart snmpd
+
<p>
 +
<b>You should then be able to restart snmpd</b>
 +
</p>
  
 +
<p>
 
root@server:~# /etc/init.d/snmpd restart  
 
root@server:~# /etc/init.d/snmpd restart  
 +
</p>
 +
 +
<p>
 +
<b>And then add the device to your Observium installation!</b>
 +
</p>
  
And then add the device to your Observium installation!
+
<p>
 
On devices with a large routing table
 
On devices with a large routing table
 +
</p>
  
 +
<p>
 
You may encounter sloppy SNMP responsiveness and high host load with too many routes installed in combination with netsnmp. Also see this Debian bugreport of a few years back. The last post seems to fix this issue, so if you are running full table, add these lines to snmpd.conf as well:
 
You may encounter sloppy SNMP responsiveness and high host load with too many routes installed in combination with netsnmp. Also see this Debian bugreport of a few years back. The last post seems to fix this issue, so if you are running full table, add these lines to snmpd.conf as well:
 +
</p>
  
view all    included  .1                              80
+
<p>
view all    excluded  .1.3.6.1.2.1.4.21
+
view all    included  .1                              80<br>
view all    excluded  .1.3.6.1.2.1.4.24
+
view all    excluded  .1.3.6.1.2.1.4.21<br>
 +
view all    excluded  .1.3.6.1.2.1.4.24<br>
 
view system included  .iso.org.dod.internet.mgmt.mib-2.system
 
view system included  .iso.org.dod.internet.mgmt.mib-2.system
 +
</p>

Latest revision as of 20:14, 3 December 2014

First install Net-SNMP :

root@ubuntu:~# apt-get install snmpd
Ubuntu: make sure the SNMPDOPTS line in /etc/default/snmpd looks like this

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -p /var/run/snmpd.pid'

This also disables logging and as such gets rid of annoying "features" like
snmpd[4990]: Connection from UDP: 1.2.3.4

Replace the default /etc/snmp/snmpd.conf file with something like this, changing the community, location and contact fields

com2sec readonly default techinc
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
view all included .1 80
access MyROGroup "" any noauth exact all none none
syslocation Louwesweg 1
syscontact Network Team
#This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro

Get the observium 'distro' script to identify your distribution via SNMP

wget http://www.observium.org/svn/observer/trunk/scripts/distro/
mv distro /usr/bin/distro
chmod 755 /usr/bin/distro

You should then be able to restart snmpd

root@server:~# /etc/init.d/snmpd restart

And then add the device to your Observium installation!

On devices with a large routing table

You may encounter sloppy SNMP responsiveness and high host load with too many routes installed in combination with netsnmp. Also see this Debian bugreport of a few years back. The last post seems to fix this issue, so if you are running full table, add these lines to snmpd.conf as well:

view all included .1 80
view all excluded .1.3.6.1.2.1.4.21
view all excluded .1.3.6.1.2.1.4.24
view system included .iso.org.dod.internet.mgmt.mib-2.system