tgweb.cgi - CGI script for the networks statistics tool ToGather
http://.../cgi-bin/tgweb.cgi
tgweb.cgi
uses the information collected by togatherd
to create web pages and graphs. Both tgweb.cgi
and togatherd
use the same config file.
tgweb.cgi
looks for the config file in several places:
First the environment variable TOGATHER_CFG is checked. You can set this eg. with the ``EnvVar'' option in a .htaccess file:
TOGATHER_CFG=/var/netstat/config/router1.cfg
Next the file togather.cfg
is searched in the
- current dir - /usr/local/etc - /etc
The CGI creates and sends either html pages or pictures to STDOUT (like every CGI). What should be done is selected by standard CGI parameters.
If the CGI is called without parameters it will look for a 'startpage' setting. If none is found a list of available pages will be shown. If only one 'page' is defined this page will be shown. If no page is define a list of targets will be shown. Again if only one target is defined this target is shown.
The following parameters can be used to select a html page or a graph:
The parameter p selects a page. This can be every page or target or datasource declaration. If you want to select a target where a page declaration with the same name exists use the t parameter.
If you want to show a page for a declaration where another target or page with the same name exists you have to add a separate target or page declaration.
The parameter t selects a target. This can be every target or datasource declaration. If you want to show a page for a declaration where another target with the same name exists you have to add a separate target declaration.
g tells the CGI to send a graph instead of a html page. The argument to g is the name of a graph declaration. An additional t parameter is needed to select the target for which the graph should be generated and send. The t parameter can name a target or datasource declaration (the latter will only work if there is no target declaration with the same name).
There are some defaults for an easy start with togather:
If a page should be shown and no page declaration can be found but a target declaration with the same name exists a page for this target is shown.
If a target should be shown but no target declaration can be found but a datasource declaration with the same name exists a page for this datasource with default settings is shown.
The ToGather applications don't access a config file directly. Instead the
file is parsed once and a 'cache' is created which allows faster access.
The drawback is that at least the daemon togatherd
needs write access to this cache file which usually means write access to
the config files' directory.
Call togatherd -t configfile
after changing the configfile to recreate the cache if tgweb.cgi does not
have write access (eg. because it's running under a different user id).
togatherd(1),
tg_config(1),
tgmibb.cgi(1),
perl(1).
Rainer Bawidamann, Rainer.Bawidamann@rz.uni-ulm.de University of Ulm, University Computer Centre
This program is free software; you can redistribute it and/or modify it under the terms 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