Headwind SMS software products

About | Contact us

 
 

SMS alert

The online services become more and more complex and the server software must work 24 hours per day and 7 days per week. The server solutions are however not absolutely reliable, the software contains bugs which may cause the crash of the service, which causes complaints from service users. This makes an instant reaction on server failures very important.

If there are no operator on duty, how can you provide the quickest possible alert? If the operator has a mobile phone, the best solution is the SMS alert notification. The short GSM message is delivered instantly and the recipient reads it even if he is not in the office.

Headwind GSM Modem Driver provides the API for sending SMS through a GSM device, which can be used to send alerts on various server failures. The API can be used in VBScript to send short messages. Read this instruction to setup Headwind GSM Modem Driver on your server.

A sample script

This script checks the presence of a process in the computer memory and raises an SMS alert if the process has been crashed.

Set objArgs = WScript.Arguments

' Place the name of a remote server here
ServerName = "."
ProcessName = objArgs(0)
' This is a phone number to receive SMS
AdminPhone = "79212345678"

count=0
Set objWMIService = GetObject("winmgmts:\\" & ServerName & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process",,48)

For Each objItem in colItems
'    Wscript.Echo "Name: " & objItem.Name
    if LCase(objItem.Name) = LCase(ProcessName) then
        count=count+1
    end if
Next

if count < 1 then
' Raise SMS alert!
    Set objSMSDriver = CreateObject("HeadwindGSM.SMSDriver")
    Set objMsg = CreateObject("HeadwindGSM.SMSMessage")
    objMsg.To = AdminPhone
    objMsg.Body = "ALERT! No process '" + ProcessName + "'"
    objSMSDriver.Connect()
    objMsg.Send()
end if
               

This script is written in the VBScript language. Copy the script from the web page, paste it in the text editor and save it as "monitor_process.vbs". The script must be called from the command line in the following way:

cscript monitor_process.vbs "file.exe"

Here "monitor_process.vbs" is the name of the script, and "file.exe" is the name of the process in memory.

To setup the monitoring in Windows XP, you need to do the following steps:

  • place the monitoring command in the Windows batch file (for example, "monitor.bat"). Update the process name and write the full path to the script:
    cscript C:\monitoring\monitor_process.vbs "firefox.exe"
    This script will monitor that your web browser is opened.
  • Put this file in Windows scheduled tasks. Select Start, Control Panel, Scheduled Tasks and click "Add scheduled task". In the wizard, click "Browse" to find the monitoring command. When the wizard asks you for the running period, select "Daily". Proceed to the end and click "Finish". You may get an "Access denied" error message, but the task will be set up.
  • Double-click the task in the "Scheduled tasks" control panel.
  • Set the "Run only if logged in" check box. Please note that the script will work only if a user session will be opened on a server, because Headwind GSM Modem Driver requires access to the desktop.
  • Select "Schedule" tab and click "Advanced". Set the "Repeat task" checkbox and select the monitoring period in minutes. The "Duration" should be set to 24 hours.
  • Click "OK" and close the dialog box. The monitoring is ready. Check that the script is running (a black window appears shortly every minute). Kill the process and check that the script runs Headwind GSM Modem Driver and sends SMS to you.

Warning! The script will send SMS every time it runs and does not see the monitored process! You need to react instantly to prevent sending of multiple SMS!