How to Install MRTG in Ubuntu
To Install MRTG in Ubuntu
MRTG is a tool that used to monitor the traffic load on network links. MRTG stands for Multi Router Traffic Grapher, which generates the HTML pages to provide a live visual representation. The external SNMP package is not required for the installation process. This article explains the installation of MRTG in Ubuntu.
Installation of MRTG
For installing MRTG, you need to install Apache and SNMP packages.
To install Apache and SNMP
Utilize the following command to install the Apache and SNMP packages.
root@linuxhelp:~# apt-get install apache2 snmpd snmp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
.
.
.
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ufw (0.34-2) ...
Open the configuration file of SNMP and uncomment the following lines as shown below,
root@linuxhelp:~# vi /etc/snmp/snmpd.conf
rocommunity public localhost
Restart the SNMP service to take effect.
root@linuxhelp:~# systemctl restart snmpd
Now its time to install the MRTG package.
root@linuxhelp:~# apt-get install mrtg
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libsnmp-session-perl
.
.
.
Processing 2 added doc-base files...
Processing triggers for man-db (2.7.4-1) ...
Setting up libsnmp-session-perl (1.13-1.1) ...
Setting up mrtg (2.17.4-2ubuntu2) ...
Then create a directory on the Document root location.
root@linuxhelp:~# mkdir /var/www/html/mrtg
Take backup of MRTG configuration file with the following command.
root@linuxhelp:~# cp /etc/mrtg.cfg /etc/mrtg.cfg.real
Now change the MRTG workdir location.
root@linuxhelp:~# vim /etc/mrtg.cfg
WorkDir: /var/www/html/mrtg
Here you need to create a configuration file for MRTG.
root@linuxhelp:~# cfgmaker public@localhost > /etc/mrtg.cfg
--base: Get Device Info on public@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2.10
--base: Populating confcache
--base: Get Interface Info
.
.
.
--base: Walking ifSpeed
--snpd: public@localhost: -> 1 -> ifSpeed = 10000000
--snpd: public@localhost: -> 2 -> ifSpeed = 1000000000
Once the config file is created then create an index file for the webserver.
root@linuxhelp:# indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html
Open the web browser and enter your /server IP/mrtg/ to view the presentation of MRTG graph.
MRTG Description
You can monitor Daily Graph.
Weekly graph
Monthly graph
Yearly Graph
Comments ( 1 )