Closed brutevinch closed 7 years ago
Hi,
1) Modbus TCP 2) Zabbix 3.0 3) current Timeout is set to 10
Here is openhab config (maybe it can help you)
poll=30000 writemultipleregisters=true
tcp.sdm230_Voltage.connection=10.0.1.23:502:0 tcp.sdm230_Voltage.type=input tcp.sdm230_Voltage.valuetype=float32 tcp.sdm230_Voltage.length=2 tcp.sdm230_Voltage.start=0 tcp.sdm230_Voltage.id=1
tcp.sdm230_Current.connection=10.0.1.23:502:0 tcp.sdm230_Current.type=input tcp.sdm230_Current.valuetype=float32 tcp.sdm230_Current.length=2 tcp.sdm230_Current.start=6 tcp.sdm230_Current.id=1
tcp.sdm230_Power.connection=10.0.1.23:502:0 tcp.sdm230_Power.type=input tcp.sdm230_Power.valuetype=float32 tcp.sdm230_Power.length=2 tcp.sdm230_Power.start=12 tcp.sdm230_Power.id=1
It might be related to resource locking (there is no for TCP).
Can you try the following patch https://github.com/v-zhuravlev/libzbxmodbus/tree/TCP-always-lock (with locking enabled for TCP as well)?
git clone -b TCP-always-lock --recursive https://github.com/v-zhuravlev/libzbxmodbus.git
Run autogen.sh
./configure --prefix=/etc/zabbix --enable-zabbix-3
make
make install
Same thing =(
Ok, to 100% make sure it has nothing to do with resource sharing: In your Zabbix server (if it is possible to do so) please leave only single poller: StartPollers=1 and restart.
can you also run ipcs -s
while your Zabbix server with module loaded is runnning? and show me the output of it.
P.s. zbx agent working on same machine.
Strange, accodring to this it looks like that you might be using old version (<0.6) of the module anyway. In the new version you must see zabbix semaphore with nsems = 128 and not 1.
Try deleting your old modules from (/usr/local/lib i suppose) and in zabbix server config point to the new location:
LoadModulePath = /etc/zabbix/lib
Restart server. Check that ipcs -s
shows you the semaphore with nsems = 128.
If not going to work, which linux distro do you use?
Here is with new module: 0x7a021f65 655365 zabbix 600 128
in zabbix 2 of 3 data sources are "Connection timed out"
/usr/src # cat /etc/debian_version
8.7
chroot debian for Synology
even with single poller?
Ну если 1 поллер включается добавлением в конфиг сервера то да. Вот кусок конфига сервера: LoadModulePath = /etc/zabbix/lib LoadModule = libzbxmodbus.so Timeout = 10
StartPollers=1
uff....weird.
Ok, lets try it again:
git clone -b debug_enabled --recursive https://github.com/v-zhuravlev/libzbxmodbus.git
Run autogen.sh
./configure --prefix=/etc/zabbix --enable-zabbix-3
make
make install
Then in configuration file:
LogType=console
DebugLevel=1
In zabbix frontend: Disable all modbus items and leave only one active.
Stop the zabbix-server
rerun it with in the foreground:
zabbix_server -f
You should now see all the modbus debug messages from the libmodbus lib. Please attach it here. They should contain a part where it fails also.
You don't have any errors/timeouts with single item?
testing now. tell you later
ok. If there are no issues with single item -> try reenabling them
with enabled 2 items:
Waiting for a confirmation...
<00><01><00><00><00><07><01><04><04><43><65><5A><85> Connecting to 10.0.1.23:502 [00][01][00][00][00][06][01][04][00][06][00][02] Waiting for a confirmation... <25>here is with 3 items:
Waiting for a confirmation...
<00><01><00><00><00><07><01><04><04><41>Connecting to 10.0.1.23:502 Connecting to 10.0.1.23:502
It looks like that there is still more than one poller. Maybe do you have another StartPollers somewhere in the config file with not 1?
try: in your debug_enabled repo:
git pull
make install
new logging of zabbix_server -f now should provide pid
of the process.
here is full config:
LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 LogType=console DebugLevel=1 PidFile=/var/run/zabbix/zabbix_server.pid DBName=zabbix DBUser=zabbix DBPassword=XXXX AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts FpingLocation=/usr/bin/fping Fping6Location=/usr/bin/fping6 LogSlowQueries=3000
LoadModulePath = /etc/zabbix/lib LoadModule = libzbxmodbus.so Timeout = 10
StartPollers=1 AllowRoot = 1
Connecting to 10.0.1.23:502 [00][01][00][00][00][06][01][04][00][06][00][02] Waiting for a confirmation...
<00><01><00><00><00><07><01><04><04><3E><2F>how did you implement Modbus TCP server? It this your own code?
2247 hash:118 : 10.0.1.23 Unlocking pid:2247 hash:118 : 10.0.1.23 Locking Connecting to 10.0.1.23:502 [00][01][00][00][00][06][01][04][00][06][00][02] Waiting for a confirmation...
<00><01><00><00><00><07><01><04><04><3E><32><91>Here is gateway code
selfmade modbus tcp -> modbus rtu gateway on esp8266 (OpenHab polling fine without any problems)
Could it be that OpenHab actually also sometimes receive invalid data/timeout? Just it doesn't show you that?
Saw openhab traces. There is no errors and warnings and all data received every 30 sec without any errors too. =(
Every 30 sec.
So let's sum ip what we have:
try with disabled byte timeout:
in your debug_enabled repo:
git pull
make install
Hi, now I see some errors in openhab, please give some time to test it.
Sorry it was unstable buggy code.
@brutevinch , Did you fix it? Is it working with libzbxmodbus now? With(debug branch) or without(current main branch) TCP locking?
Rewrite gateway code to mqtt.
Происходит рандомно вот такая ерунда:
Через несколько минут данные могут начать поступать, а другие (из этих трех) прекратить.