[ZBX-3507] Triple SMS for each trigger action Huawei E1752 Created: 2011 Feb 04  Updated: 2017 May 30  Resolved: 2015 Mar 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 1.8.4
Fix Version/s: 2.0.15rc1, 2.2.10rc1, 2.4.5rc1, 2.5.0

Type: Incident report Priority: Major
Reporter: mof Assignee: Unassigned
Resolution: Fixed Votes: 6
Labels: sms
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux Debian Lenny i386
huawei E1752


Issue Links:
Duplicate
is duplicated by ZBX-9376 Triple SMS for trigger action Closed

 Description   

Whenever I have an sms action Zabbix send out three sms'.

Discussion and more details in forum thread.
http://www.zabbix.com/forum/showthread.php?t=20300

gammu identify
Device : /dev/ttyUSB0
Manufacturer : huawei
Model : unknown (E1752)
Firmware : 11.126.03.10.00



 Comments   
Comment by richlv [ 2011 Feb 07 ]

it sounds like zabbix interpreting modem response as an error, but modem still sending the message.

if you run server with debuglevel4, what communication can be seen there when sending the messages ?

Comment by Admin [ 2011 Mar 16 ]

I'm having the same issue with the triple SMS messages. But with a different distro and different modem version. I'm fairly new with zabbix, how would I go about settings the server into debug level 4? I don't recall seeing it in any config files. Also where would the log file be stored on the server? Thanks.

Comment by mof [ 2011 Apr 05 ]

To set the server to debug level 4, edit your zabbix_server.conf (or whatever you called it) and set DebugLevel=4, Then it should print out a whole lot more of information.

Also make sure you have defined a logfile eg. LogFile=/var/log/zabbix/zabbix_server.log in zabbix_server.conf

When I set debug to lvl 4, I get too much information to see spot any usefull information. Currently about 2-3M a seconds. Any suggestions for what I can grep after ?

Comment by Märt Reose [ 2012 Mar 08 ]

I am having the same problem, so I set in my conf:
LogFile=/home/zabbix/zabbix_server.log
DebugLevel=4

And then restarted the server. Now I killed the zabbix agent process on one of the servers to get an action triggered. On Dashboard it shows Details: SMS, Status: Not Sent. I am using the built in SMS function not a script. And yet I got 3 sms saying that the server has failed...

Contents of my log file:
1256:20120308:171317.676 Sending list of active checks to [127.0.0.1] failed: host [T-S007] not found
1250:20120308:171339.360 Zabbix Host [T-S003]: first network error, wait for 15 seconds
1253:20120308:171354.815 Zabbix Host [T-S003]: another network error, wait for 15 seconds
1253:20120308:171409.847 Zabbix Host [T-S003]: another network error, wait for 15 seconds
1253:20120308:171424.851 Zabbix Host [T-S003]: another network error, wait for 15 seconds
1253:20120308:171439.943 Disabling Zabbix host [T-S003]
1256:20120308:171517.689 Sending list of active checks to [127.0.0.1] failed: host [T-S007] not found
1265:20120308:171650.264 Executing housekeeper
1255:20120308:171717.729 Sending list of active checks to [127.0.0.1] failed: host [T-S007] not found
1265:20120308:171722.589 Deleted 118772 records from history and trends
1256:20120308:171917.744 Sending list of active checks to [127.0.0.1] failed: host [T-S007] not found
1256:20120308:172117.759 Sending list of active checks to [127.0.0.1] failed: host [T-S007] not found
1253:20120308:172240.277 Enabling Zabbix host [T-S003]

Also the USB device is /dev/ttyUSB0
Permissions are 770 and owner is set to zabbix user to make sure, that zabbix can access it. Also tried USB1 device as my usb modem generates 2 devices. And yet the same problem.

Modem: Huawei E220
Zabbix: 1.8.6
OS: Ubuntu 11.04

Comment by Roberto Alcantara [ 2012 May 04 ]

I have some problem, but i`m running CENTOS 5.

Comment by Admin [ 2012 May 04 ]

I had this too on:
Zabbix 1.8.1
Hosted on Centos 5.5
Huawei E220

I don't know if it's still the same on 1.8.11 as I've seen used an external script instead.

Comment by Admin [ 2012 Jun 12 ]

Just a note. I've start a completely fresh build on Centos 6.2 32bit with zabbix 2.0 and the same Huawei E220.

We still get the triple SMS problem.

Comment by Marcelo [ 2012 Jul 02 ]

I had the same problem on:

Zabbix server v2.0.0 (revision 27675) (21 May 2012)
Compilation time: May 27 2012 23:03:45

CentOS release 6.2 (Final) BST 2012 x86_64 x86_64 x86_64 GNU/Linux

USB Modem HUAWEI E220.

Comment by mof [ 2012 Jul 24 ]

I'm thinking a cause of this problem could be related to the SMS modem is so slow sending message.
When I use gammu to test the modem, it takes like 7-9 seconds to complete with reply from the network and all that.. But it's a wild guess

Does anybody know where in the code to look for the SMS action ?

Best
//Mof

Comment by Admin [ 2012 Jul 24 ]

I believe it's \src\zabbix_server\alerter\alerter.c

else if (MEDIA_TYPE_SMS == mediatype->type)

{ /* SMS uses its own timeouts */ res = send_sms(mediatype->gsm_modem, alert->sendto, alert->message, error, max_error_len); }

No idea where it stores it's own timeout.

I think another solution could be to change the alert.retries in the db. But I have absolutely not idea how.
alert.retries = atoi(row[16]);

Comment by mof [ 2012 Dec 23 ]

I just upgraded to latest Zabbix 2.0.4, now no SMS is sent out and I get the following error in event details:
Expected [+CMGS: ] received [+CMS ERROR: 305]

This error also occured in Zabbix 2.0.0. I don't think is related to the upgrade, because it stopped working suddenly - after upgrading from 1.8.x to 2.0.0 I still got triple sms's.

Comment by Vladimir [ 2013 Nov 25 ]

To resolve this problem, I edit sms.c file and then rebuild rpm package.
Change code in send_sms function:

zbx_sms_scenario scenario[] =
	{
		{ZBX_AT_ESC	, NULL		, 0},	/* Send <ESC> */
		{"AT+CMEE=2\r"	, ""/*"OK"*/	, 5},	/* verbose error values */
		{"ATE0\r"	, "OK"		, 5},	/* Turn off echo */
		{"AT\r"		, "OK"		, 5},	/* Init modem */
		{"AT+CMGF=1\r"	, "OK"		, 5},	/* Switch to text mode */
		{"AT+CMGS=\""	, NULL		, 0},	/* Set phone number */
		{number		, NULL		, 0},	/* Write phone number */
		{"\"\r"		, "> "		, 5},	/* Set phone number */
		{message	, NULL		, 0},	/* Write message */
		{ZBX_AT_CTRL_Z	, ""		, 40},	/* Send message */
		{NULL		, "+CMGS: "	, 5},
		{NULL		, ""		, 5},
		{NULL		, ""		, 1},	/* ^Z */
		{NULL		, NULL		, 0}
	};

This code resolve the problem.
P.S. Sorry for the bad English.

Comment by Aleksandr Ljutsko [ 2014 Oct 07 ]

Please, fix the bug (source sms.c) and rebuild official packages (Debian, RH) on http://repo.zabbix.com

enviroment: modem Huawei E173, OS: Centos 6.5

Comment by Aleksandrs Saveljevs [ 2015 Mar 25 ]

raivon, do I understand correctly that the reasoning behind your patch is that Huawei modems do not output "OK" after "+CMGS: " line? If so, would you classify that as proper behavior for a self-respecting modem?

Comment by E. Ranta [ 2015 Mar 26 ]

When do you plan to fix it ? Almost five years.. without NOTHING!
Now version 2.4.4 is affected, and previous, 2.4.3, was affected, too.

Comment by Aleksandrs Saveljevs [ 2015 Mar 26 ]

eranta, one way you could help this issue is by providing the DebugLevel=4 log of the alerter process that catches the problematic SMS sending process. Note that since 2.4.0 you can change logging level at runtime, see http://blog.zabbix.com/zabbix-2-4-features-part-6-runtime-loglevel-changing/.

Another way you could help is by trying to send an SMS using AT commands on your modem, the same way Zabbix does it (see src/libs/zbxmedia/sms.c), and posting here the dialog between you and the modem, together with the timing between your commands and modem responses, and together with conjectures on what might be the cause of the problem.

Yet another way is simply showing us the error message that appears in the "Info" column for non-sent SMS messages.

Comment by Aleksandrs Saveljevs [ 2015 Mar 26 ]

In any case, the problem seems to be that after Zabbix completes its AT+CMGS command with ^Z, Huawei immediately replies with CR, but the response line containing "+CMGS: " is only output after a bit of time. Since we expect to read a reply to a command in one go, rather than in several steps spread in time, we consider SMS sending as failed, while it has actually been sent successfully.

Comment by Aleksandrs Saveljevs [ 2015 Mar 26 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-3507 (2.0) by trying to read modem response until we have a printable character, which would indicate a response to a command.

Comment by Aleksandrs Saveljevs [ 2015 Mar 27 ]

Fixed in pre-2.0.15 r52909, pre-2.2.10 r52910, pre-2.4.5 r52911, pre-2.5.0 (trunk) r52912.

Comment by Oleksii Zagorskyi [ 2015 Oct 03 ]

It caused ZBX-9928 regression.

Generated at Sat Apr 20 12:50:43 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.