Installation Guide
------------------

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 Grigorjev
E-Mail: neo@chel.skbkontur.ru
ICQ: 161867489
WWW: http://novell.chel.ru
Forum: http://novell.chel.ru/forum

Idea by: Pavel Shirshov
--------

License: GNU GPL
--------

Requirements:
-------------

Operationg System: Linux, FreeBSD, virtually any unix like system.
Database:PostgreSQL 7.x/8.x
Web-server: Apache 2.0.x
Additional software things:
- PHP4 or PHP5
- PHP-GD
- PHP-PGSQL
- PHP-RRDTOOL
- RRDTOOL
- MRTG
- NET-SNMP

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
Output :
9599 ?? S 0:03.91 /usr/local/sbin/snmpd -p /var/run/snmpd.pid
9621 ?? Ss 0:00.43 /usr/local/sbin/snmptrapd -p /var/run/snmptrapd.pid

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/
cd 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 PostgreSQL user and database.
For instance:
psql -U pgsql template1
create user mrtg with createdb password '12345';
\c - mrtg
create database mrtg with encoding='WIN' template template0;

8. Run database script /mrtgwebcfg/sql/table.sql /mrtgwebcfg/sql/data.sql
For instance:
psql -a mrtg mrtg < table.sql
psql -a mrtg mrtg < data.sql
psql -U pgsql template1
alter user mrtg with nocreatedb;

9. Open your favourite Web-browser at: http://server/mrtgwebcfg/
Conglaturations, You have finished installation if You see main page of  MRTGViewer.
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:

[MRTG]
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:
a) MRTG configuration files (namely mrtg.cfg and mrtg.error.cfg) are being built from database into /tmp folder
b) 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
c) 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
Output:
mrtg.cfg
mrtg.error.cfg

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 MRTGViewer (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

Developer: Michael Grigorjev
E-Mail: neo@chel.skbkontur.ru
ICQ: 161867489
WWW: http://novell.chel.ru
Forum: http://novell.chel.ru/forum
