Русская версия English version  
Documentation - MRTGWebCfg

MRTGWebCfg 2.x

Installation Guide

MRTG MRTG stands for 'Multi Router Traffic Grapher', which collects data via SNMP and visualises it using web interface.

For instance: Network interface load displaying (incoming, outgoing, maximum, average traffic) in minutely, hourly, daily scale and so on.

MRTGWebCfg is a tool written in PHP which does:

- MRTG configuration management through Web interface.
- RRD files analysis and visualising.
- Any MRTG graphic output.

Developer: Michael Grigorev
ICQ: 161867489

Idea by: Pavel Shirshov

License: GNU GPL


Operationg System: Linux, FreeBSD, virtually any unix like system.
Database:PostgreSQL 7.x/8.x or MySQL 4.x/5.x
Web-server: Apache 2.0.x
Additional software things:
- PHP4 или PHP5

FreeBSD installation guide:

1. Install and cofigure all mentioned above pieces of software
Pay special attention to net-snmp configuration, I supply my config in /snmp subfolder
2. Verify whether net-snmp is running:
ps -xw | grep snmp
9599 ?? S 0:03.91 /usr/local/sbin/snmpd -p /var/run/
9621 ?? Ss 0:00.43 /usr/local/sbin/snmptrapd -p /var/run/

3. Copy mrtgwebcfg folder into root folder of Apache.

4. Set mrtgwebcfg permission and ownership:
# chown -R www:wheel /root_directory_of_apache_installation/mrtgwebcfg/
# chmod -R 775 /root_directory_of_apache_installation/mrtgwebcfg/

5. Create backup folder for MRTG configuration:
# mkdir /usr/local/etc/mrtg/backup
# mkdir /usr/local/etc/mrtg/backup-err

6. Set it's permission and ownership:
# chown -R www:wheel /usr/local/etc/mrtg
# chmod -R 775 /usr/local/etc/mrtg

7. Create and populate PostgreSQL database as following:

7.1 Create PostgreSQL database named 'mrtg', user named 'mrtg' and assign him with the appropriate password.

For instance:
# psql -U pgsql template1
template1=# create user mrtg with createdb password '12345';
template1=# \c - mrtg
template1=# create database mrtg with encoding='WIN' template template0;
template1=# \q

7.2 Populate database with /mrtgwebcfg/sql/postgres-table.sql and /mrtgwebcfg/sql/postgres-data.sql scripts

For instance:
# psql -a mrtg mrtg < postgres-table.sql
# psql -a mrtg mrtg < postgres-data.sql
# psql -U pgsql template1
template1=# alter user mrtg with nocreatedb;
template1=# \q

7.3 Follow to the step 9 of the current manual.

8. Create and populate MySQL database as following:

8.1 Create user 'mrtg' with appropriate password and database 'mrtg'.

For instance:
# mysql -u root -p
mysql> create database mrtg;
mysql> connect mrtg;
mysql> grant all on mrtg.* to mrtg@localhost identified by '12345';
mysql> flush privileges;
mysql> \q

8.2 Populate database with /mrtgwebcfg/sql/mysql-table.sql and /mrtgwebcfg/sql/mysql-data.sql scripts

For instance:
# mysql -u root -p
mysql> \. /path/to/mysql-table.sql
mysql> \. /path/to/mysql-data.sql
mysql> \q

8.3 Follow to the step 9 of the current manual.

9. Open your favourite Web-browser at: http://server/mrtgwebcfg/
Conglaturations, You have finished installation if You see main page of MRTGWebCfg.
Please pay more attention if You see 'Testing Your php installation...', most probably You didn't install some required php module or other required piece of software.

10. Navigate in Web-browser to 'Control Panel' -> 'Edit MRTG Global Settings' and change WorkDir and ImageDir settings appropriately.
WorkDir specifies place where to store RRD files.
ImageDir specifies place where MRTGWebCfg will generate images.

Configuration file must include sections like these.

WorkDir = /root_directory_of_apache/mrtgwebcfg/rrd
ImageDir = /root_directory_of_apache/mrtgwebcfg/images

[MRTG Errors]
WorkDir = /root_directory_of_apache/mrtgwebcfg/rrd-err
ImageDir = /root_directory_of_apache/mrtgwebcfg/images-err

11. After fullfilling section number 10, navigate using web-interface to 'Control panel' and press 'Rebuild configuration' button.

The following things happen when You press that button:
а) MRTG configuration files (namely mrtg.cfg and mrtg.error.cfg) are being built from database into /tmp folder
б) Existing MRTG configuration files (again mrtg.cfg and mrtg.error.cfg) are being copied from /usr/local/etc/mrtg to /usr/local/etc/mrtg/backup and /usr/local/etc/mrtg/backup-err
в) Configuration files from /tmp are moved from /tmp to /usr/local/etc/mrtg

12. Make sure the following files are created:
ls /usr/local/etc/mrtg/ | grep mrtg

13. Edit /etc/crontab for automate mrtg run every 5 minutes:

For instance, /etc/crontab may contain the following lines

1-59/5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log
1-59/5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.error.cfg --logging /var/log/mrtg-err.log

Do not forget to create files /var/log/mrtg.log and /var/log/mrtg-err.log
touch /var/log/mrtg.log
touch /var/log/mrtg-err.log

Restart cron daemon
killall -HUP cron

14. In a while graphics must appear on the main page of MRTGWebCfg (http://server/mrtgwebcfg/).

This finishes MRTGWebCfg installation.

We also recommend to read further documentation 'Using MRTGWebCfg'. It contains step by step guide to add hosts, groups of hosts, templates and all the stuff related to using MRTGWebCfg.

Do not hesitate to contact developer in case of any question

Powered by NVStat Team © 2001 - 2016 Michael Grigorev