Professional Documents
Culture Documents
Mrtglib
Mrtglib
Mrtglib
N#NA#AM#ME#E
MRTG_lib.pm - Library for MRTG and support scripts
S#SY#YN#NO#OP#PS#SI#IS#S
use MRTG_lib;
my ($configfile, @target_names, %globalcfg, %targetcfg);
readcfg($configfile, \@target_names, \%globalcfg, \%targetcfg);
my (@parsed_targets);
cfgcheck(\@target_names, \%globalcfg, \%targetcfg, \@parsed_targets);
D#DE#ES#SC#CR#RI#IP#PT#TI#IO#ON#N
MRTG_lib is part of MRTG, the Multi Router Traffic Grapher. It was
separated from MRTG to allow other programs to easily use the same
config files. The main part of MRTG_lib is the config file parser but
some other functions are there too.
$MRTG_lib::OS
Type of OS: WIN, UNIX, VMS
$MRTG_lib::SL
_#S_#l_#a_#s_#h in the current OS.
$MRTG_lib::PS
Path separator in PATH variable
"readcfg"
"readcfg($file, \@targets, \%globalcfg, \%targetcfg [, $prefix,
\%extrules])"
Reads a config file, parses it and fills some arrays and hashes.
The mandatory arguments are: the name of the config file, a ref to
an array which will be filled with a list of the target names, a
hashref for the global configuration, a hashref for the target
configuration.
globaloption: value
targetoption[targetname]: value
aprefix*extglobal: value
aprefix*exttarget[target2]: value
E.g.
workdir: /var/stat/mrtg
target[router1]: 2:public@router1.local.net
14all*columns: 2
$globalcfg{configoption} = 'value'
$targetcfg{configoption}{targetname} = 'value'
See mrtg-reference for more information about the MRTG
configuration syntax.
14all*columns: 2
14all*graphsize[target3]: 500 200
The first part of the array is a perl expression to test the value
of the option. The test can access this value in the variable
"$arg". The second part of the array is an error message to display
when the test fails. The failed value can be integrated by using
the variable "$arg".
Config settings with an different prefix than the one given in the
"readcfg" call are not checked but inserted into _#
%_#g_#l_#o_#b_#a_#l_#c_#f_#g and
_#%_#t_#a_#r_#g_#e_#t_#c_#f_#g. Prefixed settings keep their prefix in
the config
hashes:
"cfgcheck"
"cfgcheck(\@target_names, \%globalcfg, \%targetcfg,
\@parsed_targets)"
The first three arguments are the same as for "readcfg". The fourth
argument is an arrayref which will be filled with the parsed target
defs.
to a hash:
$targetcfg{'option'}{'bits'}{'router1'} = 1
$targetcfg{'option'}{'growright'}{'router1'} = 1
"ensureSL"
"ensureSL(\$pathname)"
"log2rrd"
"log2rrd ($router,\%globalcfg,\%targetcfg)"
"datestr"
"datestr(time)"
"timestamp"
"timestamp()"
"setup_loghandlers"
"setup_loghandlers(filename)"
"expistr"
"expistr(time)"
Returns the time given in the argument formatted suitable for HTTP
Expire-Headers.
"create_pid"
"create_pid()"
"demonize_me"
"demonize_me()"
"populatecache"
"populatecache(\%confcache, $host, $reread, $snmpoptshash)"
Reads the SNMP variables _#i_#f_#D_#e_#s_#c_#r,
_#i_#p_#A_#d_#E_#n_#t_#I_#f_#I_#n_#d_#e_#x,
_#i_#f_#P_#h_#y_#s_#A_#d_#d_#r_#e_#s_#s,
_#i_#f_#N_#a_#m_#e from the _#h_#o_#s_#t and stores the values in _#
%_#c_#o_#n_#f_#c_#a_#c_#h_#e as
follows:
"readconfcache"
"my $confcache = readconfcache($file)"
"readfromconfcache"
"writeconfcache($confcache,$file)"
"writeconfcache"
"writeconfcache($confcache,$file)"
"storeincache"
"storeincache($confcache,$host,$method,$key,$value)"
"readfromcache"
"readfromcache($confcache,$host,$method,$key)"
"clearfromcache"
"clearfromcache($confcache,$host)"
"debug"
"debug($type, $message)"
A#AU#UT#TH#HO#OR#RS#S
Rainer Bawidamann <Rainer.Bawidamann@rz.uni-ulm.de>
(This Manpage)