Author |
Post |
|
#1 Thu Nov 22, 2012 10:32, 149 months ago.
|
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
|
|
#2 Tue Feb 12, 2013 12:58, 147 months ago.
|
Member
Registered: Nov 2012
Location: Germany
Topic owner
|
I'm still stuck on this one. Any ideas anyone?
Regards, Daniel
|
|
#3 Mon Feb 18, 2013 20:48, 146 months ago.
|
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.
|
|
#4 Tue Feb 19, 2013 12:07, 146 months ago.
|
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.
|
|
#5 Mon Mar 04, 2013 18:32, 146 months ago.
|
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
|
|
#6 Mon Mar 04, 2013 20:23, 146 months ago.
|
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.
|
|
#7 Mon Jun 05, 2017 23:04, 94 months ago.
|
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
|