Parallels H-Sphere Documentation System Administrator Guide

 

The Multi Router Traffic Grapher (MRTG)

(H-Sphere 2.5 and up)
 
 

Related Docs:   Dedicated Servers (Admin Guide) MRTG in Dedicated Hosting H-Sphere Installation Packages

Last modified: 11 Jul 2007

 

WARNING: This documentation covers Parallels H-Sphere versions up to 3.1. For the latest up-to-date Parallels H-Sphere documentation, please proceed to the official Parallels site.

In H-Sphere 2.5 and up the MRTG software is used for the dedicated hosting feature. This software is installed to H-Sphere as a logical server from hsphere-mrtg-rrd-X-X package, where X-X is the latest available version.

Mrtg service is managed by supervise, similarly to clamd, spamd, ftpd, and bind. Apache service with configured VirtualHost for mrtg service is required which is provided by Apache configuration in version 2.5 and up.

 

RRD Tool Integration

Mrtg works with RRDtool which improves its performance and graphing flexibility. RRDtool is used as the logger to MRTG. It stores data samples on each of the network switch interfaces (ports) in a separate RRD. To minimize size of the database files, RRD uses the consolidation mechanism. It guarantees that the database does not grow over time and that old data is automatically eliminated. However this leads to degradation of accuracy. For the sake of high degree of data accuracy, space for 10080 samples (35 days) is allocated. The DSBandwidthLoader daily cron acquires data from RRDs and stores it into the hsphere database.

 

Managing MRTG Service

For Linux:

/etc/init.d/mrtg stop | start | restart | stat

For FreeBSD:

/usr/local/etc/rc.d/mrtg.sh stop | start | restart | stat

 

Configuration Directory and File

Mrtg configuration directory is /hsphere/local/config/mrtg.

/hsphere/local/config/mrtg/mrtg.conf - mrtg configuration file. It has an include for /hsphere/local/config/mrtg/ports/index.conf which in its turn contains includes for files corresponding to each opeational switch port. Such files are generated dynamically via CP interface when switch ports are assigned to dedicated servers.

 

Scripts Processing Data

/hsphere/local/config/mrtg/scripts/getstatistics - gathers data from each port file.
/hsphere/local/config/mrtg/scripts/setstartbill - sets the start billing period date.
/hsphere/local/config/mrtg/scripts/formgraph - draws traffic graphs.

 

RRD Files

Mrtg writes RRD files to /hsphere/local/config/mrtg/rrd directory. In its subdirectories image files with bandwidth representations for chosen periods are located:

  • ~httpd/htdocs/rrd/d - day
  • ~httpd/htdocs/rrd/w - week
  • ~httpd/htdocs/rrd/m - month
  • ~httpd/htdocs/rrd/y - year

 

The Problem with Calculating Large (>100mbps) Bandwidth Traffic

It is a known issue that MRTG with 32-bit counters doesn't calculate correctly the traffic when bandwidth exceeds 100 Mbps. A solution is to switch to 64-bit counter by choosing SNMPv2c/SNMPv3 protocols. This, however, may not work because some devices don't support these protocols.

To switch to SNMPv2c/SNMPv3, you need to manually customize the ~cpanel/shiva/shiva-templates/common/ds/mrtg_target.config template.

  1. Log into the CP server as cpanel user.
  2. Copy the default template ~cpanel/shiva/shiva-templates/common/ds/mrtg_target.config to the custom ~/shiva/custom/shiva-templates/common/ds/mrtg_target.config location. Please carefully follow the template customization procedure.
  3. Edit the first line with ${port}:${com_name}@${device}: according to the MRTG Reference.
    For example, to switch to SNMPv2c, the line will be like this:

    Target[${target}]: <if config.REVERSE_DEDICATED_SERVER_TRAFFIC != "TRUE">-</if>${port}:${com_name}@${device}:::::2

    For more advanced configuration please refer to MRTG Reference.

  4. Restart H-Sphere to apply customization.

Related Docs:   Dedicated Servers (Admin Guide) MRTG in Dedicated Hosting H-Sphere Installation Packages



© Copyright 2017. Parallels Holdings. All rights reserved.