Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

The MRTG 2.16.2 Windows Installation Guide

Rumi, December 22, 2009December 22, 2009

SYNOPSIS

Installing MRTG on a Windows box is not quite as “click and point” as some might want it to be. But then again, it is not all that difficult if you follow the instructions below.

My setup was MRTG 2.16.2 Perl 5.8.8.819

PREREQUISITES

To get MRTG to work on Windows you need the following:

  • A current copy of Perl. For Example ActivePerl 5.8.8 from ActiveState http://www.activestate.com/store/activeperl/download/
  • The latest version of MRTG from http://oss.oetiker.ch/mrtg/pub. Look for mrtg-2.16.2.zip or better. The archive also contains a precompiled copy of rateup.exe for Win32.

INSTALLING

I suggest you do the following from the machine that will be running MRTG, which, in this case, is also a web server. All examples are for doing things to a LOCAL machine.

First
Unzip MRTG to C:\mrtg-2.16.2 on the Windows machine of your choice.

Next
Install Perl on the same Windows machine. You might want to make sure that the Perl binary directory is listed in your system path.

 C:\Perl\bin;%SystemRoot%\system32;%SystemRoot%;...

You can manually check this by going to [Control Panel]->[System]->[Environment]

To see if everything is installed properly you can open a Command Shell and go into c:\mrtg-2.16.2\bin. Type:

 perl mrtg

This should give you a friendly error message complaining about the missing MRTG configuration file. Now, you have successfully installed MRTG and Perl.

CONFIGURING MRTG

Now it is time to create a configuration for MRTG. But before we begin you need to know a few things. Take an opportunity to gather the following information:

  • The IP address or hostname and the SNMP port number, (if non standard), of the device you want to monitor.
  • If you want to monitor something other than bytes in and out, you must also know the SNMPOID of what you want to monitor.
  • Finally you need to know the read-only SNMP community string for your device. If you don’t know it, try public, that is the default.

For the rest of this document we will be using device 10.10.10.1 ( a CISCO Catalyst 5000) with Community string public. We are interested in monitoring traffic, and the CPU load. Let’s begin.

The first thing we do in setting up MRTG is making a default config file. Get to a cmd prompt and change to the c:\mrtg-2.16.2\bin directory. Type the following command:

 perl cfgmaker public@10.10.10.1 --global "WorkDir: c:\www\mrtg" --output mrtg.cfg

This creates an initial MRTG config file for you. Note that in this file all interfaces of your router will be stored by number. Unfortunately, these numbers are likely to change whenever you reconfigure your router. In order to work around this you can get cfgmaker to produce a configuration which is based on Ip numbers, or even Interface Descriptions. Check cfgmaker

If you get an error message complaining about no such name or no response, your community name is probably wrong.

Now, let’s take a look at the mrtg.cfg file that was created.

In Perl, a # is a comment, synonymous with REM in DOS.

Add the following to the top of the mrtg.cfg file:

 WorkDir: c:\www\mrtg

This is where the web pages are created, usually a web root.

 ######################################################################
 # Description: LCP SUWGB
 # Contact: Administrator
 # System Name: LC-Bridge
 # Location: Here
 #.....................................................................

TargetDevice’s IP Address:Interface Number:Community:IP Address

 Target[10.10.10.1.1]: 1:public@10.10.10.1

This is the interface speed (Default is 10 megabits; for 100Mbit devices use 12500000 and so on…)

 MaxBytes[10.10.10.1.1]: 1250000

 Title[10.10.10.1.1]: LC-Bridge (sample.device): ether0

This section determines how the web page headers will look

 PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
  <TABLE>
  <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
  <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
  <TR><TD>Interface:</TD><TD>ether0(1)</TD></TR>
  <TR><TD>IP:</TD><TD>sample.device(10.10.10.1)</TD></TR>
  <TR><TD>Max Speed:</TD>
  <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
  </TABLE>

  Target[10.10.10.1.2]: 2:public@10.10.10.1
  MaxBytes[10.10.10.1.2]: 1250000
  Title[10.10.10.1.2]: LC-Bridge (): ulink0
  PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
   <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
   <TR><TD>Interface:</TD><TD>ulink0(2)</TD></TR>
   <TR><TD>IP:</TD><TD>()</TD></TR>
   <TR><TD>Max Speed:</TD>
   <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
   </TABLE>

  #---------------------------------------------------------------

And that’s a very basic MRTG config file. You can run this and see your results by going into the c:\mrtg-2.16.2\bin directory and typing:

 perl mrtg mrtg.cfg

It is normal to get errors for the first two times you run this command. The errors will alert you about the fact that there have not been any log files in existence before.

If you take a look at those web pages they are not very exciting (yet). You need to have the MRTG files run every five minutes to produce the desired results. Just run it again after a few minutes. You should now be able to see the first lines in your graphs.

5 Mins Graph Updates:

This is the tricky part I just added up to my own flavor 😉 Copy the following code and save the file on a text file and I saved it as “start.pl” and save path will be MRTG\BIN directory. This will actually updates the graph in every 5 mins.

$interval=300; while (1) { sleep( $interval – time() % $interval );

system ‘perl mrtg mrtg.cfg’;

}

Now execute start.pl by double clicking on it. A black command prompt window alike will appear- keep it running. The only problem is, every time you restart the server either you have to double click on this start.pl or once log in need to copy the file in start directory.

It will not behave like a regular windows service- you need at least to login!

However, I used third party software like “Alwaysup” and make the script to the service list. So, literally it’s working now as a service!!! 🙂 Handy isn’t it????

Other than 5 min graph update, content source: http://oss.oetiker.ch/mrtg/doc/mrtg-nt-guide.en.html
Configurations (Windows)

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes