[mrtg] Re: Cron or deamon

Jerry Heidtke jheidtke at fmlh.edu
Wed Nov 20 16:02:33 MET 2002


Look in the MRTG Configuration Reference.

http://people.ee.ethz.ch/~oetiker/webtools/mrtg/reference.html

------------------------------------------------------------------
SYNTAX
MRTG configuration file syntax follows some simple rules:

Keywords must start at the beginning of a line. 

Lines which follow a keyword line which do start with a blank are appended
to the keyword line 

Empty Lines are ignored 

Lines starting with a # sign are comments. 

You can add other files into the configuration file using 
Include: file

Example:

 Include: base-options.inc If included files are specidifed with relative
paths, both the current working directory and the directory containing the
main config file will be searched for the files.
------------------------------------------------------------------

I have, for example, a file I call with cron called nt_a.cfg

Line from cron.cfg:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * d:\perl\bin\wperl d:\mrtg\bin\mrtg
--logging=d:\mrtgcfg\logs\nt_a.err d:\mrtgcfg\cfg\nt_a.cfg        #(all on
one line)

This file contains:

Include: d:\mrtgcfg\cfg\global-options.cfg
LogDir: d:\mrtgdata\nt
Include: d:\mrtgcfg\cfg\nt\AMCOMNT01.cfg
Include: d:\mrtgcfg\cfg\nt\ANSOSNT01.cfg
Include: d:\mrtgcfg\cfg\nt\APPNT01.cfg
.
.
.(8 more)

Each of the device-specific included files contains target definitions for
10-30 statistics, depending on the device type. I'm monitoring about a
hundred servers and hosts running Windows, NetWare, or *nix, as well as a
couple hundred routers, switches, UPSs, and other devices.

When mrtg launches, it builds, in memory, a large config made up of all the
smaller configs according to the order of the include commands and uses
that.

To determine the number of device-specific configs to include in each file,
consider what happens when a device is unresponsive. Mrtg waits for snmp
timeouts on each query, which extends the execution time greatly. I try to
limit the number of device-specific configs for each instance so it normally
finishes in less than a minute and that if one or two devices are down or
unreachable, the instance of mrtg will still finish in under five minutes.
That way, data collection continues uninterrupted for the remaining devices.
In your case, with 200 devices, I'd run 40 every minute, probably split into
4 instances with 10 devices each. So, you'd have 20 lines in cron.cfg or
crontab. Each minute, 4 instances of perl/mrtg would be launched. These
should finish in just a few seconds, if you're using rrd.

Hope this helps.

Jerry

-----Original Message-----
From: Bishop, Dean [mailto:dean.bishop at tcdsb.org]
Sent: Wednesday, November 20, 2002 8:39 AM
To: 'Jerry Heidtke'
Subject: RE: [mrtg] Re: Cron or deamon


Good morning,

	Could you please tell me how you "include from 5 to 20 configs" in
one?

	i am using cron to call my MRTG as well and am about to add about
200 devices.  This will be a bit cumbersome if i have to call them all
individually.

thanks,
dean

-----Original Message-----
From: Jerry Heidtke [mailto:jheidtke at fmlh.edu]
Sent: Wednesday, November 20, 2002 9:27 AM
To: 'Ambrose Li'; Rowan Reid
Cc: mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Cron or deamon



An additional consideration is that if you modify a config file, with cron
the modifications take effect automatically the next time that task is
executed. Running as daemon requires the daemon to be manually restarted for
the changes to be used.

I have 14 separate mrtg tasks started by cron each five minutes. These
configs simply set some global options and then include from 5 to 20 configs
for specific devices. I haven't seen any large performance hit from having
to start perl that often. Of course, CPU spikes to 100%, but only for a few
seconds. This is on a Compaq server, 1.4 MHz P4 running Windows 2000. The
server is also running a bunch of other management-related software, such as
Insight Manager 7, Web JetAdmin, and Big Brother.

All in all, I've found that using cron allows more control and
manageability. I use the cron service from aintx.

Jerry

-----Original Message-----
From: Ambrose Li [mailto:a.c.li at ieee.org]
Sent: Tuesday, November 19, 2002 7:55 PM
To: Rowan Reid
Cc: mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Cron or deamon



Back a number of months ago I tried both. My observations
(biased towards running mrtg on a "slower" machine and a
network with relatively "lighter" traffic):

The cron way to run mrtg generated graphs that are more "spiky",
I suppose because starting perl every x minutes would place a
heavier load on the system, so that's the "con" for the cron
way. The "pro" would be that you are guaranteed when the stats
are gathered.

The daemon way generated graphs that are smoother, apparently
implying that it places a much lighter load on the system -- for
a slow machine this makes perfect sense -- so that's the "pro".
The "con" is that if you restart mrtg once in a while, the stats
are gather at unequal intervals.



On Tue, Nov 19, 2002 at 03:53:08PM -0800, Rowan Reid wrote:


> Whats the best way to run mrtg, I noticed the readme specified
> a run as deamon option, is there an advantage to this ?
> Secondly, does mrtg get the max throuput variable from snmp
> etc, or is it specified
>

-- 
Ambrose Li  <a.c.li at ieee.org>
http://ada.dhs.org/~acli/cmcc/  http://www.cccgt.org/

DRM is theft - We are the stakeholders

--
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


Confidentiality Notice: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain confidential 
and privileged information.  Any unauthorized review, use, disclosure or 
distribution is prohibited.  If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.


--
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


Confidentiality Notice: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain confidential 
and privileged information.  Any unauthorized review, use, disclosure or 
distribution is prohibited.  If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.


--
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