Connecting Tech Pros Worldwide Help | Site Map

Monitor Services on Windows 2003 with PHP

Newbie
 
Join Date: Mar 2007
Posts: 14
#1: Apr 2 '07
So, this may not even be possible, but if so, I was hoping someone could point me in the right direction or give me the right terminology to use for searches of code example. Aside from monitoring ports with ping and what not, I'd like to be able to monitor specific installed services on a Windows 2003 machine. Is this possible with PHP? I'm not talking about FTP, IIS, or other Windows services, but rather custom and commercial installed software that run as services. Ideally I'd like PHP on the machine in question to look at the service status and report this to a remote MySQL database. Is this possible without having VBScript or something report to PHP which then reports out again?
Motoma's Avatar
Moderator
 
Join Date: Jan 2007
Location: Maine, USA
Posts: 2,904
#2: Apr 2 '07

re: Monitor Services on Windows 2003 with PHP


You may be able to exec() the sc command line utility to get the information you desire and regex/explode the output.

Quote:

Originally Posted by xerc

So, this may not even be possible, but if so, I was hoping someone could point me in the right direction or give me the right terminology to use for searches of code example. Aside from monitoring ports with ping and what not, I'd like to be able to monitor specific installed services on a Windows 2003 machine. Is this possible with PHP? I'm not talking about FTP, IIS, or other Windows services, but rather custom and commercial installed software that run as services. Ideally I'd like PHP on the machine in question to look at the service status and report this to a remote MySQL database. Is this possible without having VBScript or something report to PHP which then reports out again?

Newbie
 
Join Date: Mar 2007
Posts: 14
#3: Apr 3 '07

re: Monitor Services on Windows 2003 with PHP


So if I understand correctly, I'll need some .bat or other command in WMI/VBScript or other which can retrieve the status and write the output? I'm not particularly good with Windows scripting (not my servers so not my choice), so any guidance on the genre of commands I need to use? Thanks much in advance.
Motoma's Avatar
Moderator
 
Join Date: Jan 2007
Location: Maine, USA
Posts: 2,904
#4: Apr 3 '07

re: Monitor Services on Windows 2003 with PHP


Quote:

Originally Posted by xerc

So if I understand correctly, I'll need some .bat or other command in WMI/VBScript or other which can retrieve the status and write the output? I'm not particularly good with Windows scripting (not my servers so not my choice), so any guidance on the genre of commands I need to use? Thanks much in advance.

No, you should be able to call sc directly from PHP using the exec() call.
Reply