[mrtg] How to Daemonize

Michele Ferritto m.ferritto at gmail.com
Thu Aug 28 11:15:19 CEST 2008

2008/8/28 Steve Shipway <s.shipway at auckland.ac.nz>:
>> 1) on the mrtg startup scripts I've inserted a
>> "CONFIG="/etc/mrtg/*.cfg" to "catch" all the cfg files.
>>  If I do a "ps aux | grep mrtg" I see one single mrtg instance that
>> (it seems) processes all the files.
>> 2) I've create a master cfg files with "Include" directive and then
>> modified the above  variable with "CONFIG="/etc/mrtg/master.cfg"
>> As per the first solution I see the same "ps" output.
>> The result is the same in both cases, only the first cfg file loaded
>> is truly processed, the others rrd files remains untouched and nothing
>> is draw...
> Try doing it this way.
> Create your master.cfg file, and have something like:
> Forks: 10
> RunAsDaemon: yes
> Routers.cgi*Ignore: yes
> Include: /etc/mrtg/device1.cfg
> Include: /etc/mrtg/device2.cfg
> # and so on, remember you cannot use wildcards in the Include
> You should tune the Forks: statement to your system; higher values run quicker but use more CPU and memory, lower values may not finish within the 5-min window.  The Ignore line prevents routers2 from processing the file.
> Remember you cannot use wildcards in an Include: statement.
> Then, call MRTG with
> mrtg /etc/mrtg/master.cfg
> and all should be well.  You will not see the additional files on the command line, but you should see the files updating; you will get a number of threads corresponding to the Forks: setting.
> Steve

Thank you for the tip...

Just tried but the rrd files remain (all) untouched....
until now the only way is the crontab....

Here follow the "master file":

routers.cgi*Ignore: yes
Forks: 10
RunAsDaemon: Yes
Interval: 1
Include: /etc/mrtg/file1.cfg
Include: /etc/mrtg/file2.cfg


Michele Ferritto
Senior IT Engineer
R.L.U. #342460

More information about the mrtg mailing list