[mrtg] How to Daemonize
Steve Shipway
s.shipway at auckland.ac.nz
Thu Aug 28 00:16:04 CEST 2008
> 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
More information about the mrtg
mailing list