Hi all,
I have a Siemens TC55 modem on COM1 to send SMS notifications.
However, sometimes it hangs and is unreachable.
Is there a way to test if the modem is still alive?
Test modem on COM port
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
You may setup Text Log test to check GSM log file, specified on SMS:GSM page of Options dialog.
E.g. Text Log test may check this log file for "Error:" string and start assigned actions.
Please check the manual for more information:
http://www.ks-soft.net/hostmon.eng/mfra ... tm#textlog
E.g. Text Log test may check this log file for "Error:" string and start assigned actions.
Please check the manual for more information:
http://www.ks-soft.net/hostmon.eng/mfra ... tm#textlog
Since reading the logfile for something that went wrong already isn't very predictive
I decided to write a small program to send a AT command to the COM port and waits for response.
If no response it will timeout in HM and set the test in "Unknown" status, which in turn triggers a email action.
Just wanted to share

If no response it will timeout in HM and set the test in "Unknown" status, which in turn triggers a email action.
Just wanted to share

-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
We wrote VB script that can send AT commands and check for response from GSM modem. It can be used with Shell Script test method:
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
Start CMD: cmd /c cscript /B /E:VBScript %Script% %Params%
Script requires four parameters: <COM port> <speed> <AT command> <Expected response>. E.g. COM2 19200 AT OK
This script works well on our Windows 7, however we couldn't manage to run it correctly on Windows XP
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
Code: Select all
Option Explicit
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
'---- entry point ----
Const ForReading = 1
Const ForWriting = 2
DIM fso, com, s, objArgs
Set objArgs = WScript.Arguments
IF objArgs.Count<>4 Then
WScript.StdOut.Write statusUnknown & "Expected parameters <COM port> <speed> <AT command> <Expected response> E.g.: COM2 19200 AT OK"
Wscript.Close
End if
Set fso = CreateObject("Scripting.FileSystemObject")
Set com = fso.OpenTextFile(objArgs(0) & ":" & objArgs(1) & ",N,8,1", ForWriting)
com.WriteLine(objArgs(2))
com.Close()
Set com = fso.OpenTextFile(objArgs(0) & ":" & objArgs(1) & ",N,8,1", ForReading)
com.ReadLine
s = com.ReadLine
if s = objArgs(3) then
WScript.StdOut.Write statusOk & s
else
WScript.StdOut.Write statusBad & s
end If
com.Close()
Script requires four parameters: <COM port> <speed> <AT command> <Expected response>. E.g. COM2 19200 AT OK
This script works well on our Windows 7, however we couldn't manage to run it correctly on Windows XP
