S95snmp

Synopsys


#
# Configuring SNMPd to offer useful host information
#

Script


mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf-$VERSION
cat >/etc/snmp/snmpd.conf <<EOF
com2sec     notConfigUser    default  public
group       notConfigGroup   v1       notConfigUser
group       notConfigGroup   v2c      notConfigUser
view        systemview       included .1 80
access      notConfigGroup   ""       any noauth exact systemview none none
syslocation Manchester
syscontact  hostmaster@$NODENAME
#Net-SNMP-Specific items
load 5.0 6.0 7.0
disk / 3%
proc portmap  1 1 # only 1 portmap process
proc cron     1 1 # only 1 cron process
proc exim     1   # 1 or more exims
EOF
chkconfig --level 345 snmpd on

if [ "$OS" == "fc3" ]; then
cat >> /etc/rc.local <<EOF
# --- $VERSION Fix
# snmpd on fc3 breaks with i2c in
 rmmod eeprom
 rmmod i2c_sensor
 rmmod i2c_isa
 rmmod i2c_viapro
 rmmod i2c_core
EOF
fi

echo "%Post: snmpd configured                                "

Examples and Testing


# 
# Lots of useful information
#          <http://www.linux-mag.com/2002-06/guru_04.html>
# snmpget -v 2c -c public hostname system.sysDescr.0
# returns System Description
# snmpwalk -v 2c -c public 172.16.0.50 laLoad.{1|2|3}
# returns load average
# snmpwalk -v 2c -c public 172.16.0.50 dskTable
# returns the disk usage
# snmpwalk -v 2c -c public 172.16.0.50 prTable 
# tells us about the processes we are monitoring
# snmpwalk -v 2c -c public 172.16.0.50 host.hrSystem
# lots to do with the host and its uptime and boot
# snmpget -On -v 2c -c public 172.16.0.100 laLoad.2
# -On will return the brief oid as a full *numeric* oid
# snmpget -Of -v 2c -c public 172.16.0.100 laLoad.2
# -Of will return the brief oid as a full text oid



Marked up in XHTML - ©2005 Thoughtful Solutions Ltd.