MRTG

Required & Optional Packages
Required: net-analyzer/net-snmp media-libs/gd net-analyzer/mrtg

Optional: www-servers/mini_httpd net-www/apache

Let's Begin
Start by:

Now let's edit :

Now start the daemon & add it to the default runlevel:

CPU
Now set up some files:

CPU-Temp
To get working CPU-Temp you must emerge net-analyzer/net-snmp with lm_sensors USE flag.

Swap
We're almost there

Ping.sh
Run each script 3 times (disregard the warnings)

Cronjob
Now just press [ctrl+d] or

Additional CronJob Options
In your *.cfg file, add the lines -

This option works well if you choose not to create a cron job.

Power Under Control
Open Mozilla or your browser of choice and browse:

or use your httpd server

Advanced Users
For other targets (and other stat), try with other object identifier (OID).

Polling
roberto@moira mrtg $ snmpwalk -v 1 -c public localhost mgmt.1.2.2.1.10.2 IF-MIB::ifInOctets.2 = Counter32: 140021440

Translating
roberto@moria mrtg $ snmptranslate -IR -Td mgmt.1.2.2.1.10.2 IF-MIB::ifInOctets.2 ifInOctets OBJECT-TYPE -- FROM     IF-MIB, RFC1213-MIB SYNTAX       Counter32 MAX-ACCESS   read-only STATUS       current DESCRIPTION  "The total number of octets received on the interface,    including framing characters.

Discontinuities in the value of this counter can occur at   re-initialization of the management system, and at other times as indicated by the value of   ifCounterDiscontinuityTime."
 * = { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) interfaces(2) ifTable(2) ifEntry(1) ifInOctets(10) 2 }

Most Important Files
/usr/share/doc/net-snmp /usr/share/doc/mrtg-*/contrib man mrtg man snmpd man snmpwalk man crontab man cat

If you have numerous config files in /etc/mrtg/ and want each host to have it's own unique html page, the following shell script can be used to create the html output files in the mrtg document root.


 * 1) !/bin/bash

DOCROOT="/var/www/localhost/htdocs/mrtg"

gen_index{ /usr/bin/indexmaker --output=$DOCROOT/$HOST.html --title=$1 --sort=name --enumerate $CFG }

for file in `ls /etc/mrtg/*.cfg

Discussion
Original forum discussion can be found here

UTF-8
IF your system is using UTF-8, you will get this: --- ERROR: Mrtg will most likely not work properly when the environment variable LANG is set to UTF-8. Please run mrtg in an environment where this is not the case. Try the following command to start:

env LANG=C /usr/bin/mrtg /etc/mrtg/mem.cfg --- So, just do as you're told for all files in : /etc/cron.mrtg/traffic /etc/cron.mrtg/cpu /etc/cron.mrtg/cpu-temp /etc/cron.mrtg/mem /etc/cron.mrtg/swap /etc/cron.mrtg/ping

Copy from Google.. cache after data lost on gentoo-wiki

Created by NickStallman.net, His Dark Materials - The Golden Compass, Computer Concept - Australian Web Hosting