[mrtg] Re: Setting up MRTG as a Windows Service

Paul Sobey Paul.Sobey at dpfm.com
Fri Jan 7 13:21:50 MET 2005


Not sure whether this helps anyone but I set up multiple services, e.g. MRTG-Servers, MRTG-Routers, and each one has the following set in the reg for srvany:

Application: C:\perl\bin\perl.exe
AppParamaters: c:\mrtg\bin\mrtg c:\mrtg\config\servers.cfg --logging c:\mrtg\log\mrtg-servers.log

... Or whatever the config should be. It means you see each daemon as a running service with net use, and when you stop the service srvany properly kills the perl process, saving you the hassle of doing it manually.

Incidentally, does anyone know how hard it would be to add support for Win32::Daemon into Mrtg? This would allow native running as a service, rather than faking it with srvany. I have a few written like this, works beautifully, and would allow proper cleanup of locks, etc. at service close...

Paul


-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch] On Behalf Of William Owen
Sent: 06 January 2005 21:21
To: mrtg at list.ee.ethz.ch
Cc: oetiker at ee.ethz.ch
Subject: [mrtg] Re: Setting up MRTG as a Windows Service

I have yet to look at the .bat file that you are using to run your service,
but if you run Win2k+, you might try using a .vbs file to kick off your
service.  If setup correctly, you can spawn a new perl instance for each
config file listed (or you can group them with an include: in a master
config as suggested).  For readability, I left the --logging stuff off.  I
actually use a modified version of this script from scheduled task that
creates a daily log file that can later be archived.

EX:

OPTION EXPLICIT

Dim oShell

Set oShell = Createobject("WScript.Shell")

oShell.run "perl C:\Path\to\mrtg C:\path\to\cfg1"
oShell.run "perl C:\path\to\mrtg C:\path\to\cfg2"

<snip>


*****************************************************************
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.
*****************************************************************

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