Topic Options
#29704 - 02/06/08 11:42 AM Service Status Email Notification
Uomo Del Ghiaccio Offline
OL Expert

Registered: 02/21/01
Posts: 666
It would be nice to have thae ability to set some administration email status notifications in the event that a critical service fails.

This would primarily be for services that control the inputs such as telnet, lpd or ftp.

If a installation uses let's say telnet to receive data, then have a setting that will send an email if the telnet service is not running.

This could be polled at a predetermined amount of time and then have a method to configure what services to monitor and the email addresses to send the notice to.

Thanks
_________________________
Uomo Del Ghiaccio
--------------------

Top
#29705 - 02/06/08 12:55 PM Re: Service Status Email Notification
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1926
Loc: Objectif Lune, Montreal, Qc
You can already implement this functionality fairly easily. Create a process that runs at whatever interval of time you prefer. In that process, insert a "Run External Program" task.

I'd recommend calling a good old batch file (.bat or .cmd) that would contain something like:
Code:
@Echo off
Echo LPR Service > C:\Services.txt
sc query pplpr6 | find /i /c "state" >> C:Services.txt
Echo Telnet Service >> C:\Services.txt
sc query pptelnet6 | find /i /c "state" >> C:Services.txt
(The first call to SC checks the status of the LPR service while the second one checks the Telnet service)
After this task, the file Services.txt would contain something similar to this:
Code:
LPR Service
        STATE              : 1  STOPPED
Telnet Service 
        STATE              : 4  RUNNING
You could then add a Folder Capture input to pick up the Services.txt file and process it according to your needs just like any other data file. (Which means you could send notification emails whenever you find the "STOPPED" status).

The good thing about this technique is that you aren't limited to just the PPSuite services. You can poll the status of any Windows Service with it.

Hope that helps,
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#29706 - 02/06/08 01:35 PM Re: Service Status Email Notification
Uomo Del Ghiaccio Offline
OL Expert

Registered: 02/21/01
Posts: 666
Phillipe,

I was thinking about it and wrote this small script to use inside of PlanetPress Watch.


Code:
 

Option explicit
Dim objFSO
Dim objOutputFile
Dim strTempName, strTempPath, strLine
Dim objHeaderFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
strTempPath = objFSO.GetFile(PW_GetJobFilename).ParentFolder.Path
strTempName = objFSO.GetTempName
Set objOutputFile = objFSO.GetFolder(strTempPath).CreateTextFile(strTempName)
'********************************************************************
' Variable declaration for Process Gathering
'********************************************************************
Dim objWMIService, objProcess, colProcess Dim strComputer, strList

strComputer = "."

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

Set colProcess = objWMIService.ExecQuery _ ("Select * from Win32_Process")

'********************************************************************
' Main Loop
'********************************************************************

For Each objProcess in colProcess
    if objProcess.Name = "TelnetService.exe" then
       strList = strList & vbCrlf & objProcess.Name & " is running = TRUE"
    end if
Next

objOutputFile.WriteLine(strList)

'********************************************************************
' Finalize
'********************************************************************
objOutputFile.Close
objFSO.DeleteFile PW_GetJobFilename, true objFSO.MoveFile strTempPath & "\" & strTempName, PW_GetJobFileName

 
This works, but it still would be nice to have it built into a future version.

Thanks
_________________________
Uomo Del Ghiaccio
--------------------

Top