Hello all,
I have a problem with zabbix 1.1.2 and SMS notifications. Sometimes I get the message "Read something unexpected from GSM modem" and the SMS is sent twice.
I've traced the problem down to this:
Some times the GSM modem responds too quickly and the sms.c of zabbix gets 2 lines from the modem as 1 line, and so it doesn't get any input when it expects so.
When the problem happens i get these 2 lines on the debug file:
002065:20061124:103236 Read buffer [^M+CMGS: 192^M^MOK^M]
002065:20061124:103242 Read buffer []
When the sms is sent without problem i get these 2 lines:
002065:20061124:103325 Read buffer [^M+CMGS: 193^M]
followed by
002065:20061124:103325 Read buffer [^MOK^M]
If we look at the code we have:
At line 156 of src/libs/zbxsms/sms.c
if(ret == SUCCEED)
ret = read_gsm(f,"\r+CMGS: ", error, max_error_len);
if(ret == SUCCEED)
ret = read_gsm(f,"OK\r", error, max_error_len);
But to fix this problem one must modify the read_gsm function!!!
The fix should probably be to check if the buffer has grabbed more than 1 line at a time. If so, then it should check only the first line and keep the other lines in a private buffer to check them one at a time in each next call.
Is there anyone willing to write the patch?
--------------
I forgot to mention that the problem isn't specific to zabbix 1.1.2. Newer versions have the same problem as well. (sms.c is the same on 1.1.2, 1.1.3 and 1.1.4)
I have a problem with zabbix 1.1.2 and SMS notifications. Sometimes I get the message "Read something unexpected from GSM modem" and the SMS is sent twice.
I've traced the problem down to this:
Some times the GSM modem responds too quickly and the sms.c of zabbix gets 2 lines from the modem as 1 line, and so it doesn't get any input when it expects so.
When the problem happens i get these 2 lines on the debug file:
002065:20061124:103236 Read buffer [^M+CMGS: 192^M^MOK^M]
002065:20061124:103242 Read buffer []
When the sms is sent without problem i get these 2 lines:
002065:20061124:103325 Read buffer [^M+CMGS: 193^M]
followed by
002065:20061124:103325 Read buffer [^MOK^M]
If we look at the code we have:
At line 156 of src/libs/zbxsms/sms.c
if(ret == SUCCEED)
ret = read_gsm(f,"\r+CMGS: ", error, max_error_len);
if(ret == SUCCEED)
ret = read_gsm(f,"OK\r", error, max_error_len);
But to fix this problem one must modify the read_gsm function!!!
The fix should probably be to check if the buffer has grabbed more than 1 line at a time. If so, then it should check only the first line and keep the other lines in a private buffer to check them one at a time in each next call.
Is there anyone willing to write the patch?
--------------
I forgot to mention that the problem isn't specific to zabbix 1.1.2. Newer versions have the same problem as well. (sms.c is the same on 1.1.2, 1.1.3 and 1.1.4)
Comment