====== Snmpd_&_mrtg ======
SNMPD - Simple Network Management Protocol Daemon to respond to SNMP requests
MRTG - Multi Router Traffic Grapher
MRTG uses SNMPD to collect information on the Network Traffic of a Computer/ Router.
===== Setup Network Traffic Monitoring:=====
apt-get some tools and choose defaults:
apt-get install mrtg
apt-get install snmpd //Daemon Storing Data
apt-get install snmp //Daemon Collecting Data from various devices/servers
===== SNMPD Config on Client =====
Edit /etc/snmp/snmpd.conf and change the following:
change:
agentAddress udp:127.0.0.1:161
to:
agentAddress udp:161
change:
rocommunity public default -V systemonly
to:
# rocommunity public default -V systemonly
change:
#rocommunity public localhost
to:
rocommunity public localhost
add:
rocommunity public ip.address.of.snmp.monitoring.server
Removing as it was old sarge/etch config
com2sec paranoid default public
#com2sec readonly default public
#com2sec readwrite default private
to:
#com2sec paranoid default public
com2sec readonly 127.0.0.1 public
#com2sec readwrite default private
Edit /etc/default/snmpd and change the following:
SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid 127.0.0.1'
to
SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
Restart the snmpd server:
/etc/init.d/snmpd restart
===== MRTG Config on SERVER =====
Edit /etc/mrtg.cfg and add/replace with the following:
# Global configuration
WorkDir: /var/www/mrtg
WriteExpires: Yes
#For every machine
Target[[name-of-machine]]: 2:public@127.0.0.1
MaxBytes[[name-of-machine]]: 1250000
Title[[name-of-machine]]:
PageTop[[name-of-machine]]:
System:
kartbuilding on phidebian
Maintainer:
Stephen Burke
Description:
Debian PC
Max Speed:
10 Mbits/s
Ip:
136.201.1.250
#Above table html info to be in 1 space.
Run mrtg manually a few time to place logs - it will give errors on first 3-5 runs. There is an entry placed in /etc/cron.d for mrtg to take over then.
./mrtg -c /etc/mrtg.cfg
In the "Target" line you see the number 2 we found before, and in "MaxBytes" we have set how many bytes the device maximum can transfer (10Mbit * 1000000bit/Mbit / 8byte/bit = 1250000byte).
===== Additional Info and Debugging =====
snmpd listens on ipaddress:161 where 161 is udp. The following iptables firewall rule is needed:
iptables -A INPUT -p udp --dport 161 -j ACCEPT
**Helpful Info**
To generate an Automatic mrtg config:
cfgmaker public@ipaddress >> /etc/mrtg.cfg
To check snmb Info:
snmpwalk -v 1 -OS -c public localhost
Information got from:
http://apt-get.dk/mrts/
http://www.netadmintools.com/art390.html
http://myitforum.com/articles/16/view.asp?id=3928
http://www.debianhelp.co.uk/mrtg.htm
===== SNMP and APC UPSs =====
No final configs have been written.
snmpwalk on a UPS will not reveal all the information. Try the following to get more information:
snmpwalk -v 1 -c public Network_Name_of_UPS .1
Here are the relevant links (rare) which have been found:
https://lists.oetiker.ch/pipermail/mrtg/2005-May/030094.html
http://www.cuddletech.com/articles/snmp/node13.html
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch23_:_Advanced_MRTG_for_Linux
http://www.skolelinux.no/~klaus/sarge/x3579.html