By Edwin D. Viņas, SRSII, PREGINET Project
October 18, 2002
Advanced Science and Technology Institute, PHILIPPINES
Mobile: +639202612660
Email: edwinv@asti.dost.gov.ph
Tel/Fax: +632 4351071/ 4351052
"I was so engrossed in Perl programming today that I was able to accomplish another simple script which can be useful in network monitoring systems. MRTG is one of the most widely used network tools due to its easy to generate graphs showing the network's bandwidth utilization. As an experience, I find it difficult to view many graphs at the same time. Also, its difficult to hard-code an index page which would contain the links to all the graphs. I have thought of a script that when called via the browser would show me the graphs whether old and new. This way, I dont have to hard-code an MRTG index page. Also, I want it to have a Javascript function that will continuously scroll all the graphs like a presentation in the same page. Also, I want to check which links are updating and which are not. Non-updating MRTG files might mean a DOWN network link. This is what I did in this MRTG Viewer Script". --- Edwin D. Viņas <edwinv@asti.dost.gov.ph>
Download MRTG Viewer Version 1.0 mrtgviewer-v1.0.tar.gz
Please read the details below before installing it.
Visit it in action at: http://noc.asti.dost.gov.ph/cgi-bin/mrtg/asti-net.pl
####################################################################
# MRTG Viewer
# Version 1.0
# Released October 18, 2002
# By Edwin D. Viņas <edwinv@asti.dost.gov.ph>
# Copyright 2002 Edwin D. Vinas ASTI-Philippines, PREGINET Project
# This is a perl script for use in viewing and displaying mrtg graphs
# It opens the mrtg directory and displays what it finds in that directory.
# Then, it gets the last update time of the file or graph and compare it
# with the server time. Knowing which links are not updating provides a
# clue on which links maybe down. A non-updating file is represented with
# GREEN square while if it is down, the status is represented by a blinking
# RED icon. Also, there are options on ping/traceroute and links to
# request for trouble ticket when the link is suspected to be down.
# There is also a Javascript added for scrolling the mrtg graphs.
# License: This code is free. You can modify this or change it
# provided that you aknowledge the author by retaining his copyright.
# Requirements:
# - Perl, MRTG, Unix/Apache server, ping/traceroute scripts, ptts/otrs
####################################################################
LICENSE:
#################################################
# This program is a free software; you can redistribute is and /or
# modify it under the terms and of the GNU General Public License as
# published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#####################################################
PROGRAM USAGE:
1. This program is to be used in a network monitoring machine with MRTG installed already.
2. Once viewed or executed via the browser,
- this script will display server time using a displaytime.pl (c) by Bamm Gabriana
- an operational status table based on MRTG update time shown also
- an UP/DOWN gifs are also shown
- a ping/traceroute script is included too
- a trouble ticket form is also included
- a scrolling graphs is included to aid us in viewing those many MRTG graphs.
3. Development environment:
- FreeBSD-4.4
- Apache-1.3.26
- Perl 5 or higher
- CGI.pm module installed
- script is executed in the cgi-bin
- developed using VI, Notepad, IE5, Mozilla (Bayanihan)
* The Javascript doesn't work in Mozilla(bayanihan)
- an otrs is alos installed as a trouble ticketing system
INSTALLATION:
Please make sure that you have similar environment as listed above.
1. Copy the mrtgviewer.pl to /your/cgi-bin/.
2. chmod +x mrtgviewer.pl
3. Debug using perl -d mrtgviewer.pl
4. The Javascripts must be in the htdocs directory
5. chmod +x displaytime.pl
6. chmod +x ping.cgi, trace.cgi
7. Copy .gifs to your /images directory
***Some files need to be customized for your own design.
***Please edit them or you may want to make an installation for this.
***Problem? Email me at edwinv@asti.dost.gov.ph.
ACKNOWLEDGMENT:
This software would not have been finished without the support of DOST,
ASTI, PREGINET especially to the following people:
Bamm Gabriana - for sharing his displaytime.pl script
Christian Gueco - for his comments
Rene Mendoza - for comments also
Carla, Carlo, YanYan, Marc - for comments too. and to PREGI-TEAM
especially TERE who upset me while working :-)
=====================================================================================
If others think ten minutes ahead; Filipinos must think 10 years ahead; -- Edwin D. Vinas
=====================================================================================
Visit also Edwin D. Viņas Homepage and see other documentations and tutorials.