Jump to content

Recommended Posts

Posted (edited)

I would also be interested in checking out the code. Also I remembered a way to monitor individual service status on Windows servers using WMI I dont think that you can use it via php though just through ASP.

 

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")

For Each objService in colRunningServices 
   'in VBS script form
   'Wscript.Echo objService.DisplayName  & VbTab & objService.State
   'In ASP form
   Response.write objService.DisplayName  & VbTab & objService.State
Next

 

Just replace the * with your service name and the strComputer string with the name of the server.

Edited by SYNACK
Posted

Sure here is my code as well, its designed for windows/IIS not linux.

 

To get it working like my screenshot just copy the code into 3 columns on a single webpage. I grabbed the images from google image search to make it look pretty :)

 

Remember to rename to .php

printerstatus.txt

  • Thanks 1
Posted
Am a total idiot and can't get it working, what do I need to do at this end?

 

in both cases, all you do is rename the file from .txt to .php

and run it on a webserver on your network that has PHP installed.

Posted

All you need is a PHP webserver. Install WAMP if you dont want the hassle of setting it up yourself ;)

 

Then try and show the phpinfo page, if that shows you know php is working.

 

Then rename to .php and run the script, it will show red crosses for everything because its looking for my IP addresses. You need to edit the script to add your IP's or Names of devices.

Posted

Hello

 

I seem to be getting this error message:

Warning: exec() [function.exec]: Unable to fork [ping **.**.**.** -n 1 -w 1] in C:\Inetpub\wwwroot\status.php on line 51

 

I have put a dummy address in to and it says the address is online.

 

Any suggestions because i could see this being very helpful.

 

Thanks,

 

Ross

Posted
All you need is a PHP webserver. Install WAMP if you dont want the hassle of setting it up yourself ;)

 

Then try and show the phpinfo page, if that shows you know php is working.

 

Then rename to .php and run the script, it will show red crosses for everything because its looking for my IP addresses. You need to edit the script to add your IP's or Names of devices.

 

 

That didn't work, am giving up am useless when it comes to web sites, and IIS....

Posted

Have got the code to display ok (IIS) but it says everything is up even when I point it to names/ip address that do not exist? Am I missing something here? :confused:

 

Regards

JohnD

Posted

Hmm i cam getting the following error:

 

"PHP Notice: Undefined index: debug in C:\Inetpub\wwwroot\ns\index.php on line 67"

 

which is:

 

if( $_GET["debug"] == "true" ) { $namesonly = false; }

Posted

Guys, can I just throw my 2 cents worth in here?

 

We have a system kind of like what you've all been doing at our school (written myself etc, like much of you!), however i found a problem... once some of the brighter kids figured out that it pinged and connected to several servers to see if they were up (wasnt that hard really... it's the most obvious way of doing it), they spammed it by refreshing a page.

 

Now one person doing this doesnt dent the intranet server... but multiply that by a class and boy does it go down quick.

 

We solved this by making a php script which did all the checks, then put the results into a DB. This script is run once a minute and can only be run by the server.

 

Then the public side of the system, simply iterates through the database and shows the systems and their status.

 

This might not be a problem for your schools... but it was for ours as soon as the cat got out the bag!

Posted
Hmm i cam getting the following error:

 

"PHP Notice: Undefined index: debug in C:\Inetpub\wwwroot\ns\index.php on line 67"

 

which is:

 

if( $_GET["debug"] == "true" ) { $namesonly = false; }

 

it's a debug notice... you dont have to listen to it. nothing is wrong that will stop it working. Simple solution is, disable debug notices in your php.ini.

 

E.g. mine is

error_reporting  =  E_ALL & ~E_NOTICE

This shows all errors except for notices and coding standards warnings.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...