MRTG Implementation Manual
Table of Contents

 
 

4. Running MRTG tasks
 

4.1 Running command-line MRTG instances

The MRTG tasks run based on the .cfg file configuration. 
A separate MRTG instance should be started for each monitored host. 

The following options have to be added to the configuration file: 
  


  

Workdir: d:\inetpub\wwwroot\ 
 Htmldir: d:\inetpub\wwwroot\ \
Imagedir: d:\inetpub\wwwroot\
Logdir: d:\inetpub\wwwroot\
Icondir: /images/

Refresh: 300  //Browser’s refresh period in seconds
RunAsDaemon: Yes //run in background
Interval: 5 // run at 5min interval. The default value is 5min.

#  to get bits instead of bytes and graphs growing to the right
Options[_]: growright, bits
 

To start a MRTG instance, run the mrtg script as follows: 
Note: the mrtg script is located in the mrtg\bin\ folder.

> perl mrtg [config file]

Example: 

> perl d:\mrtg\bin\mrtg d:\mrtg\monitored-host.cfg

Note: the path to the mrtg script and mrtg config file should be specified if the command is executed in a different directory.

The MRTG instance will continue to run as long as the command window, where the process was stared, still exists. This method is dependable on the current user session and command prompt window. The processes cannot be started in background while no user is logged-on. 
 

4.2 Running MRTG instances as Windows NT/2000 Services
 

Running MRTG instances in background, even when no user is logged-on, is possible only by running the MRTG instances as a Service. 

To register and run the MRTG instances as a service, a third party application or Microsoft’s “RunAsService” service are required. 

The MRTG service registration requires the execution parameters. The following service registration example is provided using FireDaemon third–party service management application (A free copy can be downloaded from http://www.firedaemon.com/
 


 

In a complex environment, the MRTG setup can have multiple monitored hosts and each host can have its own settings (folders, time intervals). It is recommended to run a separate MRTG instances for each host, or group of hosts, with the same settings. 

Also, a separate service should be registered for each instance to obtain a higher level of control on each individual MRTG instance. 
 


<Next Chapter>