MRTG and HDDTemp on Gentoo

Here is my simple how to on installing MRTG with HDDTemp(for S.M.A.R.T Drives) I have also attached all my config files.

emerge -av net-analyzer/net-snmp media-libs/gd net-analyzer/mrtg app-admin/hddtemp

Run thee commands to create the directories that MRTG will use

/usr/bin/mkdir /etc/mrtg
/usr/bin/mkdir /etc/cron.mrtg
/usr/bin/mkdir -p /var/www/localhost/htdocs/mrtg

Next edit /etc/snmp/snmpd.conf it should look like so. Of Course change ME to your name and include the correct email address as well.

com2sec local public
com2sec local public
group MyROGroup v1 local
group MyROGroup v2c local
group MyROGroup usm local
view all included .1 80
access MyROGroup “” any noauth exact all none none
syslocation MyLocation
syscontact Me

Edit /etc/conf.d/snmpd and add “-c /etc/snmp/snmpd.conf” into the SNMPD_FLAGS section.

Now you want to start the SNMPD service. and add it to system startup.

/etc/init.d/snmpd start
/sbin/rc-update add snmpd default

Now for the MRTG goodness. You need to run the config maker with this command. Take note that it is all 1 line.

/usr/bin/cfgmaker –output=/etc/mrtg/traffic.cfg –ifdesc=ip –ifref=descr –global “WorkDir: /var/www/localhost/htdocs/mrtg” –global “Options[_]: bits,growright” [email protected]

Once you have done that Download this tar and untar it into your /etc/. If done correctly you should have a folder named /mrtg located in your /etc directory. You might want to look over the files to make sure they are to your likings.

Next you want to download this file and untar them into /etc/cron.mrtg/.

You want to make sure that the files have all the right permissions so use these commands

/bin/chmod +x /etc/cron.mrtg/*
/bin/chmod +x /etc/mrtg/*.sh

Now start HDDTemp, I always use the restart command when starting a service. And also add it to the system startup.

/etc/init.d/hddtemp restart
rc-update add hddtemp default

Now you have to run each of the scripts a total of 3 times to start to get the data and such


No you have to create the MRTG Index file, use this command to do so. this is all one line. Also you may want to chage where it say “MediaCenter” to the name of your pc.

/usr/bin/indexmaker –output=/var/www/localhost/htdocs/mrtg/index.html –title=”MediaCenter” –sort=name –enumerate /etc/mrtg/traffic.cfg /etc/mrtg/cpu.cfg /etc/mrtg/mem.cfg /etc/mrtg/swap.cfg /etc/mrtg/ping.cfg /etc/mrtg/uptime.cfg
/etc/mrtg/hda-temp.cfg /etc/mrtg/hdb-temp.cfg

Now create the mrtg config file.

cfgmaker –global “WorkDir: /var/www/localhost/htdocs/mrtg/” –global “Options[_]: growright,bits” –ifref=ip [email protected] > /etc/mrtg/mrtg.conf

Last but not least you need to add the cron job. This will run the job every 5 mins.

crontab -e
*/5 * * * * /bin/run-parts /etc/cron.mrtg 1> /dev/null

If evertyhing went correctly you should be able to open your browser and then goto http://localhost/mrtg/ and see the graphs. There have been times where I have HAD to reboot befoer it would start working but usually it will start with no problems. Enjoy