MRTG-Central was born out of the need to organize an increasingly large number of MRTG graphs and provide at-a-glance access to this information. MRTG-Central is a front-end to MRTG that creates a hierarchical menu structure in a navigation pane and organizes MRTG graphs into consolidated web pages. See the Sample Site to get an idea of how MRTG-Central works.The interface consists of three scripts:
NAVBAR.PL – Creates a hierarchical menu structure of web links (to MRTG pages or any other HTML content).
ALLDAY.PL – Creates consolidated web pages containing all MRTG graphs for a device.
ALERT.PL – Reads the THRESHDIR and creates a summary page of targets outside their thresholds.
Disclaimer #1: MRTG-Central is provided with no guarantees of any kind.Disclaimer #2: MRTG-Central requires a working MRTG implementation.Disclaimer #3: MRTG-Central may require extensive editing of your MRTG.CFG file. Review the “Edit MRTG.CFG to use MRTG-Central conventions” section below to determine whether MRTG-Central is right for you.Disclaimer #4: MRTG-Central was developed on a WIN32 system. The examples in this documentation use WIN32 conventions for drive and path names. Unix sites will need to make the necessary modifications.
MRTG-Central Installation and Configuration
MRTG-Central Setup OverviewFollow these steps to get MRTG-Central running:1. Download MRTGCEN.ZIP and extract files2. Create MRTGCEN web directory3. Create NAVBAR.TXT file4. Run NAVBAR.PL to create menu files5. Edit MRTG.CFG to use MRTGCEN conventions6. Run ALLDAY.PL to create consolidated web pages7. Add ALERT.PL to MRTG.CFG file
1. Download MRTGCEN.ZIP and extract filesThe MRTG-Central files can be downloaded from here.Extract to a local directory (i.e.; C:\Program Files\mrtg\contrib\mrtgcen).Click here to view an example directory structure.
2. Create MRTGCEN web directoryCreate a subdirectory under your web root to hold the MRTGCEN HTML files (i.e.; E:\inetpub\wwwroot\mrtg\mrtgcen).Click here to view an example directory structure.
3. Create NAVBAR.TXT fileThe NAVBAR.TXT file defines the menus displayed in the left pane of the MRTG-Central interface. Each line corresponds to a menu item and contains three tab-delimited fields: level, menu text, and link. The level must be one or more minus signs “-“ indicating that menu's location in the hierarchy. The menu text is simply the text that is displayed via HTML. The link is an URL to an MRTG HTML page, an ALLDAY HTML page, or any other web page or site.Click here to view an example NAVBAR.TXT file.
4. Run NAVBAR.PL to create menu filesThe NAVBAR.PL script reads the NAVBAR.TXT file and creates a series of NAVBARxx.HTML files to display the hierarchical menus.
Syntax for NAVBAR.PL:Perl “C:\Program Files\mrtg\contrib\mrtgcen\NAVBAR.PL" -webroot:f:\inetpub\wwwroot -adpath:mrtg\mrtgcen -mrtgpath:mrtg -cfg:"C:\Program Files\mrtg\config\navbar.txt"
Where “-webroot” is the absolute local path to the web root “-mrtgpath:” is the location of the MRTG WorkDir relative to the webroot “-adpath:” is the location of the MRTGCEN web directory relative to the webroot “-cfg:” is the location of the NAVBAR.TXT fileLaunch FRAMESET.HTML to view the menus.To make sure that your HTML files reflect the latest changes in your config files, run NAVBAR.PL and ALLDAY.PL each time MRTG is started.Click here to view an example MRTG.BAT file.
5. Edit MRTG.CFG to use MRTG-Central conventions- Organize MRTG targets into logical groups/subdirectoriesMRTG-Central consolidates targets into logical groups. It uses the directory structure in the MRTG.CFG file for this organization – specifically the “Directory[]” parameter. A typical configuration is to create a directory for each device (router/switch/server/…) and use the same “Directory[]” parameter for all the targets for a given device.Ex: Directory[s1cpu]: server1- Standardize the format of the Title parameterUse system name, dash, system description in the “Title[]” parameter. MRTG-Central parses on the dash. Each target for a given device should have the same title.Ex: Title[s1cpu]: SERVER1 – London Campus Email Server- Standardize the format of the PageTop parameterPageTop is split into two sections:
Section 1
Section 2.In PageTop-Section1 enter the system name, dash, target description. MRTG-Central parses on the dash.In PageTop-Section 2 enter the HTML to be displayed before the target’s graph or leave blank to have the graph displayed directly below the previous graph.Ex: PageTop[s1cpu]:SERVER1 – CPU Utilization
- Enter a short description in the Legend1 parameterEnter a short description of the target for "Legend1[]" or leave blank - This text is displayed to the left of the graph. You may want to include the “Options[]: nolegend” parameter so MRTG’s default web pages display correctly.Ex: Legend1[s1cpu]: CPUUtilizationClick here to view an example MRTG.CFG file and associated .INC files.
6. Run ALLDAY.PL to create consolidated web pagesThe ALLDAY.PL script reads the MRTG.CFG file and creates HTML files to display all the targets grouped together in the same “Directory[]”.
Syntax for ALLDAY.PL:Perl “C:\Program Files\mrtg\contrib\mrtgcen\ALLDAY.PL" -webroot:f:\inetpub\wwwroot -adpath:mrtg\mrtgcen -mrtgpath:mrtg -cfg:"C:\Program Files\mrtg\config\mrtg.cfg"
Where “-webroot” is the absolute local path to the web root “-mrtgpath:” is the location of the MRTG WorkDir relative to the webroot “-adpath:” is the location of the MRTGCEN web directory relative to the webroot “-cfg:” is the location of the MRTG.CFG fileThis will put a set of ALL-DAY/WEEK/MONTH/YEAR.HTML files in each "Directory[]".To make sure that your HTML files reflect the latest changes in your config files, run NAVBAR.PL and ALLDAY.PL each time MRTG is started.Click here to view an example MRTG.BAT file.
7. Add ALERT.PL to MRTG.CFG fileThe ALERT.PL script reads the contents of the THRESHDIR and creates a web page displaying all targets currently outside their thresholds. For information on defining thresholds, review the "Threshold" section of the MRTG Configuration Reference.Run ALERT.PL as a typical MRTG target by “including” ALERT.INC in the MRTG.CFG file.
Syntax for ALERT.PL:Perl “C:\Program Files\mrtg\contrib\mrtgcen\ALERT.PL" -webroot:f:\inetpub\wwwroot -adpath:mrtg\mrtgcen -mrtgpath:mrtg -cfg:"C:\Program Files\mrtg\config\mrtg.cfg"
Where “-webroot” is the absolute local path to the web root “-mrtgpath:” is the location of the MRTG WorkDir relative to the webroot “-adpath:” is the location of the MRTGCEN web directory relative to the webroot “-cfg:” is the location of the MRTG.CFG fileThis will put a MAIN.HTML file in the MRTGCEN directory. View this file by launching FRAMESET.HTML.Click here to view an example MRTG.CFG file and ALERT.INC file.
Customizing MRTG-Central
ALLDAY.CSS – This style sheet controls formatting throughout the MRTG-Central web site. Modify the style sheet to change background colors/images, font typefaces and sizes, and other style elements.LOGO.GIF – Copy your logo to this filename in the MRTG-Central directory. The logo is displayed in the navigation pane above the menus.BACK.GIF – Copy the background of your choice to this filename in the MRTG-Central directory. The background image is displayed in the MAIN.HTML and ALL-DAY.HTML pages.MAIN-TEMPLATE.HTML – This template is used to create the "front page" of the MRTG-Central site. Modify this HTML file to suit your preferences. The ALERT.PL script will replace the line “” with the table of active alerts.ALERT.WAV – Copy the sound of your choice to this filename in the MRTG-Central directory. ALERT.PL will cause this sound to be played whenever the alert list changes.