[mrtg] Re: MRTG "autoconfiguration" script
Cook, Garry
GWCOOK at mactec.com
Thu Jan 29 21:05:54 MET 2004
> I run MRTG on a whole bunch of systems to graph all sorts of stuff
> across both Windows and UNIXlike platforms. What's more, every so
> often I have to add additional MIBs to monitor, and update all of the
> config files with that new information.
>
[snip]
I have also recently written something along these lines, I call it
'automrtgd'. However, this is a shell script inteneded to be used as an
MRTG daemon. If anyone has any ideas on how give the daemon a
'stayalive' option, I'm all ears, as I'm currently running a separate
script from cron every five minutes to restart the daemon if it dies.
This script will also allow you to quickly add devices whithout having
to remember all of the options you want to pass to cfgmaker, and
automagically reconfigure all of your devices on a regular basis (to
catch new interfaces and whatnot) when run from cron with the
'autoconfig' option.
This one does use templates, and you can roll your own or I can forward
mine on if anyone is interested. The config options are currently geared
towards Cisco IOS and CatOS devices only, although I'm sure that most of
you can edit this to fit your needs. I plan to add Juniper devices in
the near future, if I can find the time to dig into JunOS deeper.
Standard warnings apply, I don't call myself a programmer, you can
probably do it better, blah blah blah, etc.
The file is called automrtgd and this is the output of the --help
option:
____________________________________________________________________
automrtgd is an MRTG daemon that accepts the following options:
{start|stop|restart|status|config|autoconfig}
When used with the 'config' option, automrtgd will prompt for
the information that it requires, create a config file for the
device, add an Include: statement to the master config file, and
create/add the device to the mrtg update file. The mrtg update
file will then be chmod 660 so that the SNMP community strings
are not world readable. automrtgd will then restart mrtg and
wait 7 minutes before extending any new .rrd files (allowing
the extended timeperiod graphs in routers2.cgi to work correctly).
The mrtg update file has the following format:
<MRTG_subdir> <device_name> <timezone> <IP> <community> <OS>
<MRTG_subdir> <device_name> <timezone> <IP> <community> <OS>
When used with the 'autoconfig' option, automrtgd will generate
new mrtg configuration files for all devices listed in the update
file, restart the mrtg process, wait 7 minutes, and then extend
any new .rrd files (which allows the extended timeperiod graphs
in routers2.cgi to work correctly). This can be run from cron as
often as you like, in order to update cfg files with new interfaces.
NOTE: In the current version the *config options will only work
with Cisco IOS and Catalyst OS devices.
This daemon assumes that you are running MRTG as the collector,
RRDTool on the backend, and routers2.cgi as the frontend. You'll
also want to store the rrdextend script and routers2.conf file
(distributed with routers2.cgi) in your rrdfile directory.
____________________________________________________________________
Enjoy!
Garry W. Cook, CCNA
Network Infrastructure Manager
MACTEC, Inc. - http://www.mactec.com/
303.308.6228 (Office) - 720.220.1862 (Mobile)
-- Attached file removed by Ecartis and put at URL below --
-- Type: application/octet-stream
-- Desc: automrtgd
-- Size: 12k (12348 bytes)
-- URL : http://www.ee.ethz.ch/~slist/p/automrtgd
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list