We just installed mrtg on our Windows Server 2012 and I am having trouble getting it to run as a service. I'm following the guide here, but am still stuck.
First, if I run mrtg manually, whilst specifying a config file, it does work and does generate graphs.
But for the service, I placed the files srvany.exe
and instsrv.exe
in c:\mrtg\bin
(I removed the version number from the directory name, so it's all located now at c:\mrtg
).
instsrv MRTG c:\mrtg\bin\srvany.exe
And I merged the regedit file into the registry and I can see the keys are there if I go and look. You can see from the path to Perl that I've installed the 64 bit version of Perl.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG-PA500\Parameters]
"Application"="c:\\perl64\\bin\\wperl.exe"
"AppParameters"="c:\\mrtg\\bin\\mrtg --logging=eventlog c:\\mrtg\\bin\\mrtg-MyDevice.cfg"
"AppDirectory"="c:\\mrtg\\bin\\"
Now, after I do all of this, the service is indeed, created, but when I try to start it, it starts and stops.
So I created a domain account for the service and assigned it to the service and gave read/write/modify rights to the mrtg directory and it's web directory, but it still won't start.
What am I missing?
[update]
Also, if I use the commandline equivalent to what is set in the reg entry, then I get some weirdness.
c:\mrtg\bin>perl mrtg --logging=eventlog mrtg-mydevice.cfg
Use of uninitialized value in subroutine entry at C:/Perl64/lib/Win32/EventLog.pm line 73.
Argument "Started mrtg with config 'mrtg-mydevice.cfg'\n" isn't numeric in subroutine entry at C:/Perl64/lib/Win32/EventLog.pm line 46.
Use of uninitialized value in subroutine entry at C:/Perl64/lib/Win32/EventLog.pm line 199. Argument "WARN" isn't numeric in subroutine entry at C:/Perl64/lib/Win32/EventLog.pm line 199.
Daemonizing MRTG ...
Do Not close this window. Or MRTG will die
Use of uninitialized value in subroutine entry at C:/Perl64/lib/Win32/EventLog.pm line 73.
Use of uninitialized value in subroutine entry at C:/Perl64/lib/Win32/EventLog.pm line 199. Argument "WARN" isn't numeric in subroutine entry at C:/Perl64/lib/Win32/EventLog.pm line 199.
[update]
I just found this, which states that svrany.exe is not really fit for Windows 7 (or Server 2012 after that). I know some of the links on the mrtg site are pretty old. Maybe I just can't use srvany
?
But I think I probably have some configuration issue.