MRTG Setup

Install packages

yum install -y mrtg

Disable in virtual hosts

cd /etc/httpd/conf.d
mv mrtg.conf mrtg.conf.disable

Verify the mrtg clause of apache config

Edit configuration file /etc/mrtg/mrtg.cfg.

Restore long "Target" and "LocaMIBs" lines which are splitted in the example. Replace "< h1>" by "<h1>" (blanks were inserted deliberately to shut up wiki complaints).

Adjust storage and interface indexes. verify them using this query

snmpwalk -v2c localhost -c gcpub hrStorageDesc

Verify correctness of the file:

env LANG=C mrtg /etc/mrtg/mrtg.cfg --check

Create index page

env LANG=C indexmaker /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html

Warm-up mrtg (when run for the first 2-3 times, it displays errors) and make initial graphs by running mrtg a few times:

env LANG=C mrtg /etc/mrtg/mrtg.cfg
env LANG=C mrtg /etc/mrtg/mrtg.cfg
env LANG=C mrtg /etc/mrtg/mrtg.cfg

Fix /etc/cron.d/mrtg:

*/5 * * * * root /bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
             --lock-file /var/lock/mrtg/mrtg_l
             --confcache-file /var/lib/mrtg/mrtg.ok

MRTG Extensions

MRTG Polling script for NTP

I developed ntpstat.pl to show current NTP deltas.

MRTG Bugs

SNMPv3 bug

mrtg-2.14-5 distributed with CentOS 5 contains a bug. It uses one of two Perl SNMP interfaces via the mrtg.pm module: Net::SNMP or plain SNMP.The module tries to use Net::SNMP if it is available and initializes it. Later mrtg checks EnableSNMPv3 config parameter, and if it is "no", it additionally loads plain SNMP. Thus, initialization is ignored, including list of MIBs to be loaded.As as result, symbolic MIB names are ignored. As a workaround, always set EnableSNMPv3: yes

Duplicate IP address detected

SNMPd daemon prints on startup

Duplicate IP address detected, some interfaces may not be visible in IP-MIB

I performed SNMP walk to see which interfaces it publishes

$ snmpwalk -v2c localhost -c vnpub .1.3.6.1.2.1.2.2.1.2
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.3 = STRING: venet0
IF-MIB::ifDescr.7 = STRING: tun0

And checked indexes assigned to IP addresses

$ snmpwalk -v2c localhost -c vnpub .1.3.6.1.2.1.4.20.1 | grep EntAddr
IP-MIB::ipAdEntAddr.10.30.0.1 = IpAddress: 10.30.0.1
IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.4.2.5.6 = IpAddress: 4.2.5.6

Then compared with the ifconfig output

$ ifconfig -a | grep Link
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.30.0.1  P-t-P:10.30.0.2  Mask:255.255.255.255
venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.255
venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:4.2.5.6  P-t-P:4.2.5.6  Bcast:4.2.5.6 Mask:255.255.255.255

So actually it was not a SNMP problem but an OpenVZ feature: the venet0 interface was an alias to loopback.

Вложения

Комментарии

Отправить комментарий

Содержание этого поля является приватным и не предназначено к показу.
To prevent automated spam submissions leave this field empty.