Another way to do this?

G

Guest

I have a function I've written that monitors an application (server). If it
goes down, I send out an email SMTP within our WAN.

Is there a way to monitor this app from a different PC witihin our WAN?
Here's the function I've been using:

Private Function IsProcessRunning(ByVal sProcessName As String) As Boolean
Dim pr As System.Diagnostics.Process

IsProcessRunning = False
For Each pr In Process.GetProcesses
Try
If Trim(UCase(pr.ProcessName)) = Trim(UCase(sProcessName))
Then
If Not pr.HasExited() AndAlso pr.Responding Then
IsProcessRunning = True
End If
End If
Catch ex As Exception
'Handle error
End Try
Next pr
End Function

How would I specify to check running processes on a different PC in our
network?
 
J

Jon Skeet [C# MVP]

Billg_sd said:
I have a function I've written that monitors an application (server). If it
goes down, I send out an email SMTP within our WAN.

Is there a way to monitor this app from a different PC witihin our WAN?
Here's the function I've been using:

Private Function IsProcessRunning(ByVal sProcessName As String) As Boolean
Dim pr As System.Diagnostics.Process

IsProcessRunning = False
For Each pr In Process.GetProcesses
Try
If Trim(UCase(pr.ProcessName)) = Trim(UCase(sProcessName))
Then
If Not pr.HasExited() AndAlso pr.Responding Then
IsProcessRunning = True
End If
End If
Catch ex As Exception
'Handle error
End Try
Next pr
End Function

How would I specify to check running processes on a different PC in our
network?

Note that you can call GetProcessesByName to find all processes with a
specific name, so that you don't have to loop through. Both
GetProcessesByName and GetProcess have overloads which allow you to
specify a remote computer name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top