SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Thu Mar 28, 2024 21:16
SMSTools3 Community » Help and support Bottom

alarm on socket timeout?

Login and Post Reply

Page:  1

Author Post
Member
Registered:
Nov 2012
Location: Germany
Operating system name and version: Oracle Linux 6.2
Version of smsd: 3.1.15
Smsd installed from: package repository
Name and model of a modem / phone: 2 x MCTBA-G2-EN2-ED-EN
Interface: socket/Ethernet

Hi.

I was wondering if there is a possibility to monitor/react on socket timeouts like


or


?

I guess alarmhandler won't do the job right?

Thanks

Member
Registered:
Nov 2012
Location: Germany
Topic owner
I'm still stuck on this one. Any ideas anyone?

Regards,
Daniel

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
I did not understand the problem, sorry :(.

When you get those messages, alarmhandler is also called if it's defined in the smsd.conf.

What alarmhandler does, depends on the handler itself. Smstools just calls it, and does nothing more.

Member
Registered:
Nov 2012
Location: Germany
Topic owner
I don't see that alarmhandler is called at all though it is defined in smsd.conf...

Here is my smsd.conf:
devices = GSM_Net1,GSM_Net2
logfile = /smspool/smsd/log/smsd.log
loglevel = 7
alarmhandler = /usr/local/bin/alarm.sh
alarmlevel = 7
checked = /smspool/smsd/sms/checked
failed = /smspool/smsd/sms/failed
incoming = /smspool/smsd/sms/incoming
outgoing = /smspool/smsd/sms/outgoing
sent = /smspool/smsd/sms/sent
hangup_incoming_call = yes

[GSM_Net1]
device = @10.74.3.10:5000
keep_open = yes
incoming = no
baudrate = 2400
rtscts = no
cs_convert = yes
report = no
regular_run_interval = 60
regular_run_cmd = AT+CSQ
regular_run_cmd = AT+CREG?
regular_run_cmd = AT+COPS?
regular_run_statfile = /dev/shm/sms_stat_Net1

[GSM_Net2]
device = @10.74.3.11:5000
keep_open = yes
incoming = no
baudrate = 2400
rtscts = no
cs_convert = yes
report = no
regular_run_interval = 60
regular_run_cmd = AT+CSQ
regular_run_cmd = AT+CREG?
regular_run_cmd = AT+COPS?
regular_run_statfile = /dev/shm/sms_stat_Net2
 
 
'smsdconf' Syntax Highlight powered by GeSHi


Let's say the modems become unresponsive and regular run cmd produce this output:


I don't see that alarmhandler is called. SMS are checked but nothing else happens. Is there any misconfiguration in my config file?

The alrmhandler script is world-executable and based on your example alarmhandler script, simply pasting the output to a log file which is world-writeable.

Member
Registered:
Nov 2012
Location: Germany
Topic owner
Hi Keke,

Have you found the time to have a closer look at the config?
I can't get alarmhandler to work with my configuration.

Kind regards,
Daniel

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Sorry for the delay. :(

You are right, "put_command expected" messages are not given to alarmhandler. This is because those errors are not usually permanent and therefore fatal. If the modem gets broken, or needs hardware reset or anything, you could track the message "Modem is not ready to answer commands" and do something when it exists.

For example, in some system I run this kind of alarmhandler:

#!/bin/bash

LOG="/var/log/smstools/alarmhandler.log"
CONTROLFILE="/var/lib/smsd/application/control"

# $1 the keyword ALARM
# $2 a date in the format yyyy-mm-dd
# $3 a time in the format hh:mm:ss
# $4 the alarm severity (1 digit number)
# $5 the modem name or SMSD
# $6 the alarm text

echo "$2 $3,$4, $5: $6" >> $LOG

if echo -n "$6" | grep "Modem is not ready to answer commands" >/dev/null; then

  if [ ! -f $CONTROLFILE ]
  then
    DATE=`date +"%Y-%m-%d %T"`
    echo "${DATE},1, $5: Alarmhandler created request for reset." >> $LOG
    echo "APPLICATION RESET 358401111111 $5 $DATE" > $CONTROLFILE
  fi
fi
 
'bash' Syntax Highlight powered by GeSHi


When any modem stops answering, power-off is needed. Smstools itself does not do that. An external watchdog process monitors if that CONTROLFILE exists, and when it exists with correct content, smsd is stopped by the watchdog. After stopping, USB I/O is used to remove the mains from the modems. After couple of seconds mains is switched back, and smsd is restarted. Notification SMS is created, and administrator will receive it.

Perhaps in your case something like this can do the job.

About the socket error, it is called once, but not all errors are given to the alarmhandler. This is because there was no need to repeat those calls. When the socket is permanently unavailable, modem process should stop after trying for some time. External watchdog or Nagios can be used to monitor the process list, and do the actions which are necessary when one or more modem processes are not running. I have some code for the monitoring, please let me know if samples are required.

Member
Registered:
May 2017
Location: Praha, Czech Republic
Hi Keke,

can we have a sample script watcgdog which will reset the modem or do USB i/o to recycle the mains.

Thanks

Login and Post Reply

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.