[ZBX-5464] zabbix can't get 0 from external script Created: 2012 Aug 17 Updated: 2017 May 30 Resolved: 2013 Feb 14 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 2.0.2 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | sles | Assignee: | Unassigned |
Resolution: | Cannot Reproduce | Votes: | 0 |
Labels: | externalchecks | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Centos 6.3/x86-64 |
Attachments: | 26052.tmp |
Description |
If external script returns 0 then I see in zabbix server log: 19516:20120817:093623.552 item [Lud-cr2801-1:pingloss.sh[-c 20, -q, -B1, -r1, -b1500, {HOST.CONN}]] became not supported: Received value [0]is not suitable for value type [Numeric (float)] If script returns 0.0 all is OK: 19516:20120817:095325.202 item [Lud-cr2801-1:pingloss.sh[-c 20, -q, -B1, -r1, -b1500, {HOST.CONN} ]] became supported I think this is wrong. |
Comments |
Comment by sles [ 2012 Aug 17 ] |
Oops! ]] became not supported: Received value [0.0 real situation is worse |
Comment by Alexander Vladishev [ 2012 Aug 21 ] |
Zabbix doesn't log CR and LF characters in the message "Received value [....". Possibly your script returns an empty line(s) before a value. Please reopen the issue if it not so. |
Comment by sles [ 2012 Aug 21 ] |
not so [root@zabbix externalscripts]# ./pingloss.sh -c 20 -q -B1 -r1 -b1500 192.168.22.220 |
Comment by sles [ 2012 Aug 21 ] |
not so |
Comment by Alexei Vladishev [ 2012 Aug 29 ] |
Please attach pingloss.sh here if possible. Thanks. |
Comment by sles [ 2012 Sep 10 ] |
Here it is: #!/bin/sh fping $* 2>&1 | awk '{ print $5 } ' | awk -F "/" ' { print $3 }' | awk -F "%" '{if ($1 == 0) { print "0.0"}else {print $1}}' Thank you! |
Comment by Andris Zeila [ 2013 Feb 05 ] |
For me the following script works fine: #!/bin/sh fping -c 1 -q -B1 -r1 -b1500 $@ 2>&1 | awk '{ print $5 }' | awk -F "/" '{ print $3 }' | awk -F "%" '{print $1}' It returns 0 which is read by server without problems. I checked the code - the decimal mark is not required for floating values. |
Comment by sles [ 2013 Feb 06 ] |
checked logs- 705:20130206:061256.677 item [Lud-cr2801-1:pingloss.sh[-c 20, -q, -B1, -r1, -b1500, {HOST.CONN}]] became not supported: Received value [0.0 |
Comment by Andris Zeila [ 2013 Feb 06 ] |
One question - is there really line feed character in the logs, or it was just inserted during copying this line? And another thing - could you pleas instead of copying pingloss.sh script output redirect to file and attach it here? |
Comment by sles [ 2013 Feb 08 ] |
Really it looks like: Received value [0.0] is not suitable so no line feed or carriage return here |
Comment by sles [ 2013 Feb 08 ] |
well, you are right, there is additional symbol at the end. |
Comment by Andris Zeila [ 2013 Feb 08 ] |
Yes, strange. LF/CR characters at the end should have been stripped by server. |
Comment by sles [ 2013 Feb 12 ] |
I changed script to just and there is no such problem ( at least I can't reproduce it), I guess script returns non-digit values in some situations and zabbix info about 0.0 in log is wrong, i.e. real bug is what zabbix writes to log |
Comment by Andris Zeila [ 2013 Feb 12 ] |
There is a potential problem if fping produces multiple lines of output (although I can't imagine how that could happen with this example, but maybe occasionally there could be some error or whatever message). In that case if the first line contains less than 5 fields, then the script would give output; Parser would fail because of the first empty line, but logger would strip the empty lines from message. This would lead to failed items with visually correct values in log files. So the suggestion would be to ensure that your script produces only single line of output (with head or tail for example). |
Comment by richlv [ 2013 Feb 12 ] |
should parser strip leading whitespace, too ? |
Comment by sles [ 2013 Feb 14 ] |
Hello! I added tail -n 1 to script, now I can't reproduce problem. |
Comment by Andris Zeila [ 2013 Feb 14 ] |
Great. Then I'm closing this one. |