MRTG: Difference between revisions

From CLONWiki
Jump to navigation Jump to search
Boiarino (talk | contribs)
No edit summary
Boiarino (talk | contribs)
No edit summary
Line 84: Line 84:
   /etc/init.d/mrtg start
   /etc/init.d/mrtg start


 
Cron job (???):
 
 
 
Cron job:


   [root@clasweb-bck etc]# ll */mrtg
   [root@clasweb-bck etc]# ll */mrtg
Line 96: Line 92:
   #0-59/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg
   #0-59/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg


 
Create configuration files using 'cfgmaker' (never worked for me):
 
Configuration:


   #example
   #example
Line 113: Line 107:
   DOES NOT WORK YET ...
   DOES NOT WORK YET ...


My current understanding about configuration:
Create configuration files manually (see examples):


   etc/mrtg.cfg - main config file, includes *.inc files
   etc/mrtg.cfg - main config file, includes *.inc files
   etc/*.inc - hardware-specific config files
   etc/*.inc - hardware-specific config files
Generate 'index.html' script in 'share' directory:
  /www/mrtg2.15.0/bin/indexmaker /www/mrtg2.15.0/etc/mrtg.cfg --prefix=htmls --show=none --output=/www/mrtg2.15.0/share/index.html
   share/index.html - main hadn-made html file, includes references to secondary hand-made html files in share/htmls
   share/index.html - main hadn-made html file, includes references to secondary hand-made html files in share/htmls
   share/htmls/*.html - hand-made and mrtg-generated html files
   share/htmls/*.html - hand-made and mrtg-generated html files
Line 122: Line 121:
   share/logs/*.log and *.old - mrtg-generated current files
   share/logs/*.log and *.old - mrtg-generated current files


There is a script to generate 'hand-made' *.html file:
  /www/mrtg2.15.0/bin/indexmaker /www/mrtg2.15.0/etc/mrtg.cfg -output=/www/mrtg2.15.0/share/htmls/MRTG.html


It will produce MRTG.html file for all channels. It can be splited on desired number of smaller files.
It will produce MRTG.html file for all channels. It can be splited on desired number of smaller files.

Revision as of 17:27, 4 January 2007

MRTG is included in RHEL4; if want to install separately do following:

 create user 'mrtg' with private group 'mrtg'
 mkdir /www/mrtg2.15.0
 chown mrtg.mrtg /www/mrtg2.15.0
 cd /usr/local/src
 chown mrtg.mrtg mrtg-2.15.0
 cd mrtg-2.15.0
 ./configure --prefix=/www/mrtg2.15.0
 make
 make install

Add MRTG-related part to apache config file /www/apache2.2.3/conf/httpd.conf:

 Alias /mrtg "/www/mrtg2.15.0/share"
 <Directory "/www/mrtg2.15.0/share">
   Options Indexes FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
 </Directory>

NOTE: temporary fix in:

 ERROR: CFG Error in "Interval": should be at least 5 Minutes (unless you use rrdtool)
 at /misc/clonweb/mrtg2.15.0/bin/../lib/mrtg2/MRTG_lib.pm line 772.

MRTG can be started by following command (do not start it yet !):

 env LANG=C /www/mrtg2.15.0/bin/mrtg /www/mrtg2.15.0/etc/mrtg.cfg

Copy contrib/mrtg-startup-script/mrtg to /etc/init.d/ and correct as following (do not forget to make unique second and third number after chkconfig):

 # chkconfig:    345 91 33
 # config:       /www/mrtg2.15.0/etc/mrtg.cfg
 MRTG="/www/mrtg2.15.0/bin/mrtg"
 CONFIG="/www/mrtg2.15.0/etc/mrtg.cfg"

Following commands can be used from now on (do not start it yet !):

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

Add 'mrtg' to the list of services to be started at boot time (enable level 5 only):

 chkconfig --add mrtg
 chkconfig --level 3 mrtg off
 chkconfig --level 4 mrtg off
 chkconfig --list mrtg

Copy/create config files (was copied from clasweb-bck):

 cd /www/mrtg2.15.0
 mkdir etc
 cd /www/mrtg2.15.0/etc
 scp clasweb-bck:/etc/mrtg/"*" .

Create 'web' directories:

 cd /www/mrtg2.15.0/share
 mkdir htmls
 mkdir images
 mkdir logs

Create desired index.html in /www/mrtg2.15.0/share, it will be used by browser if 'http://clonweb/mrtg/' URL typed; it was actually copied from clasweb-bck and adjusted:

 scp clasweb-bck:/var/www/html/mrtg.html .
 mv mrtg.html index.html
 emacs index.html

Copy old stuff from previous htmls/*, images/* and logs/* on clasweb-bck; it will preserve history: 'logs/*.log' contains recent history, while images/*.png contains longer history

 cd htmls
 scp clasweb-bck:/var/www/html/mrtg/Hall-B/htmls/* .
 cd ../images
 scp clasweb-bck:/var/www/html/mrtg/Hall-B/images/* .
 cd ../logs
 scp clasweb-bck:/var/www/html/mrtg/Hall-B/logs/* .

Start MRTG rigth the way to avoid interrupts in history:

 /etc/init.d/mrtg start

Cron job (???):

 [root@clasweb-bck etc]# ll */mrtg
 -rw-r--r--    1 root     root           54 Feb 15  2005 cron.d/mrtg
 -rwxr-xr-x    1 vvsap    clas         1140 Mar  2  2005 init.d/mrtg
 [root@clasweb-bck etc]# more  cron.d/mrtg
 #0-59/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg

Create configuration files using 'cfgmaker' (never worked for me):

 #example
 #cfgmaker --global 'WorkDir: /home/httpd/mrtg'  \
 #         --global 'Options[_]: bits,growright' \
 #         --output /home/mrtg/cfg/mrtg.cfg    \
 #          community@router.abc.xyz
 DOES NOT WORK YET ...
 /www/mrtg2.15.0/bin/cfgmaker --global 'WorkDir: /www/mrtg2.15.0/etc'  \
        --global 'Options[_]: bits,growright' \
        --output /www/mrtg2.15.0/etc/mrtg.cfg \
        mrtg@clonweb.jlab.org
 DOES NOT WORK YET ...

Create configuration files manually (see examples):

 etc/mrtg.cfg - main config file, includes *.inc files
 etc/*.inc - hardware-specific config files

Generate 'index.html' script in 'share' directory:

 /www/mrtg2.15.0/bin/indexmaker /www/mrtg2.15.0/etc/mrtg.cfg --prefix=htmls --show=none --output=/www/mrtg2.15.0/share/index.html
 share/index.html - main hadn-made html file, includes references to secondary hand-made html files in share/htmls
 share/htmls/*.html - hand-made and mrtg-generated html files
 share/images/*.png (and *.gif ?) - mrtg-generated monthly, dayly and yearly files
 share/logs/*.log and *.old - mrtg-generated current files


It will produce MRTG.html file for all channels. It can be splited on desired number of smaller files.