[mrtg] MRTG as Daemon, mrtg.cfg including files, variables overwritten

Daniel J McDonald dan.mcdonald at austinenergy.com
Fri Apr 27 16:57:06 CEST 2007


On Fri, 2007-04-27 at 09:32 -0500, falz wrote:
> I'm migrating MRTG to a new host, and moving to use the mrtg daemon
> instead of via cron. The daemon calls a single MRTG file, in which I'm
> including "real" cfg files:
> 
>  this is the main mrtg config file that the daemon calls. It will include no
> 
> WorkDir: /var/mrtg/www
> IconDir: ../mrtgicons/
> Options[_]: growright,nobanner,noinfo,bits
> RunAsDaemon: Yes
> Interval: 5
> Include: routers.cfg
> Include: switches.cfg
> 
> 
> In each of the included files, "WorkDir" is re-defined, but it's
> always overwritten with the LAST one that's defined.

Correct.  That is how the parser is written.

>  This is almost
> exactly like this person is doing. However, I do not want each host in
> its own directory, as was his solution:
> 
> https://lists.oetiker.ch/pipermail/mrtg/2003-September/025520.html
> 
> I see a few possible solutions:

> 2) Fix my include syntax and somehow force MRTG to not overwrite the
> WorkDir variable. Not sure if this is realistic or not, but it seems
> that the "Include" is documented anywhere that I can see.

Why not put 
Directory[_]: routers

at the top of the routers cfg, and Directory[_]: servers at the top of
the servers config.  Default directives are applied until supplanted.

-- 
Daniel J McDonald, CCIE # 2495, CISSP # 78281, CNX
Austin Energy
http://www.austinenergy.com



More information about the mrtg mailing list