[ZBX-25442] modbus.get returns different result using agent vs agent2 Created: 2024 Oct 23 Updated: 2025 Feb 10 Resolved: 2025 Feb 07 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G), Agent2 plugin (G) |
Affects Version/s: | 7.0.5 |
Fix Version/s: | 6.0.39rc1, 7.0.10rc1, 7.2.4rc1, 7.4.0alpha1 |
Type: | Problem report | Priority: | Trivial |
Reporter: | Andrew Sitnikov | Assignee: | Aleksejs Sestakovs |
Resolution: | Fixed | Votes: | 0 |
Labels: | regression | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | 5h | ||
Original Estimate: | Not Specified | ||
Environment: |
Linux / modbus |
Attachments: |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
||||||||||||
Issue Links: |
|
||||||||||||
Team: | |||||||||||||
Sprint: | S24-W48/49, S25-W2/3, S25-W4/5, S25-W6/7 | ||||||||||||
Story Points: | 0.5 |
Description |
Test host with 2 interface zabbix agent port 10050 zabbix agent port2 20050
Test item Item key modbus.get[tcp://10.6.4.51:502,1,4,13958,3,uint32,mle,0] Item type string
Result
First 3x - agent2 Last 3x - agent netstat -nlp | grep agent tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 706361/zabbix_agent tcp6 0 0 :::10050 :::* LISTEN 706361/zabbix_agent tcp6 0 0 :::20050 :::* LISTEN 992567/zabbix_agent |
Comments |
Comment by Andrew Sitnikov [ 2024 Oct 24 ] |
endianness tests with differents agents (correct value is 478)
|
Comment by Kamil Florowski (Inactive) [ 2024 Oct 25 ] |
Hi asitnikov , Is there any way we could reproduce the issue locally? Assuming we are starting from fresh installation of Zabbix? |
Comment by Kamil Florowski (Inactive) [ 2024 Oct 25 ] |
Additionally, could you increase logging level to 4 or 5 and capture the results from both agents so that we will be able to compare if there is any difference in querying the results. Thanks |
Comment by Andrew Sitnikov [ 2024 Oct 25 ] |
You must have Satec BFM136 device ;(
for agent I can't raise it, there will be a huge number of records. for agent2 it already 5
agent2 log 2024/10/25 12:57:15.787315 received passive check request: '{"request":"passive checks","data":[{{{} {"key":"modbus.get[tcp://10.6.4.51:502,1,4,13958,3,uint32,mle,0]","timeout":10}{}}}]}' from '127.0.0.1'* {}}}]}' from '127.0.0.1'* {}}}]}' to '127.0.0.1'* {}}}]}' to '127.0.0{*}.1' |
Comment by Kamil Florowski (Inactive) [ 2024 Oct 25 ] |
Hi, thank you for the logs. The difference in modbus.get results between Zabbix Agent and Agent2 suggests that you may be using two different item keys with distinct byte order configurations. For example:
The difference in byte order (mle vs. mbe) causes the discrepancy in values. Suggested Fix:Verify and align the item keys to use the same byte order setting (e.g., mle or mbe) across both agents to ensure consistent results. |
Comment by Andrew Sitnikov [ 2024 Oct 26 ] |
I'm not sure you understood the essence of the problem in my opinion, the same request through different agents should give the same result. please study the screenshots I provided again carefully |
Comment by Andrew Sitnikov [ 2024 Oct 27 ] |
More info (tcp dump attached)
root@zabbix:/home/sitnikov# systemctl stop zabbix-server root@zabbix:/home/sitnikov#tcpdump -i ens160 -nn -w 10.6.4.51_502.pcap host 10.6.4.51 and port 502 root@zabbix:/home/sitnikov# zabbix_get -s 127.0.0.1 -p 10050 -k 'modbus.get[tcp://10.6.4.51:502,1,4,13958,1,uint32,mbe,0]' 3875602432 root@zabbix:/home/sitnikov# zabbix_get -s 127.0.0.1 -p 20050 -k 'modbus.get[tcp://10.6.4.51:502,1,4,13958,1,uint32,mbe,0]' 474 root@zabbix:/home/sitnikov# zabbix_get -s 127.0.0.1 -p 10050 -k 'modbus.get[tcp://10.6.4.51:502,1,4,13958,1,uint32,mle,0]' 460 root@zabbix:/home/sitnikov# zabbix_get -s 127.0.0.1 -p 20050 -k 'modbus.get[tcp://10.6.4.51:502,1,4,13958,1,uint32,mle,0]' 3456172032
In raw the device return two words - 0x01e7 0x0000 (for example, this is electrical current may vary slightly over time between requests)
Correct value is ~487 (0x000001e7)
I now see that we have another problem with decoding this data (not in this ticket scope)
From device manual:
2.7.2 32-bit Long Integer Format 32-bit long integer data is transmitted in two adjacent 16-bit Modbus registers as unsigned (UINT32) or signed (INT32) whole numbers. The first register contains the low-order word (lower 16 bits) and the second register contains the high order word (higher 16 bits). The loworder word always starts at an even Modbus address. The value range for unsigned data is 0 to 4,294,967,295; for signed data the range is - 2,147,483,648 to 2,147,483,647. If your Modbus driver does not support a 32-bit long integer format, you can read the two 16- bit registers separately, and then convert them into a 32-bit value as follows (using C notation): 32-bit value = (signed short)high_order_register × 65536L + (unsigned short)low_order_register
but the main question remains the same: why agent and agent 2 decode the same data with the same parameters differently
P.S. agent 1 port: 10050, agent2 port 20050 |
Comment by Kamil Florowski (Inactive) [ 2024 Oct 28 ] |
Hi, could you please also attach the item config specified for agent 1 ( port 10050). Thanks |
Comment by Andrew Sitnikov [ 2024 Oct 28 ] |
yesterday's message contain all the information |
Comment by Kamil Florowski (Inactive) [ 2024 Oct 28 ] |
Sure, got it. Seems like a bug. Thank you for reporting that. I confirm and pass it to the respective team. |
Comment by Eriks Sneiders [ 2024 Oct 31 ] |
Looks like the correct parsing should be MBE as the data type is uint16, and seems like an issue with agent 1.
|
Comment by Aleksejs Sestakovs [ 2025 Feb 03 ] |
Available in versions:
|