Coder Social home page Coder Social logo

Comments (9)

RandomReaper avatar RandomReaper commented on July 28, 2024

Thank you for the report,

I currently quite overbooked, but if you could try to replace the line 90 from:
sender_stdout = p.communicate(input=s)[0]
to
sender_stdout = p.communicate(input=s.encode())[0]

from weewx-zabbix.

HoracioDos avatar HoracioDos commented on July 28, 2024

Hello.
I changed lines 89 and 91. It seems to work with: universal_newlines=True and text = True

        p = Popen(c, universal_newlines=True ,stdout=PIPE, stdin=PIPE, stderr=STDOUT)
        ...
        loginf(self.zabbix_sender + " result: " +sender_stdout)

I get this out output but it seems to be other problem. I test zabbix-sender manually

Dec 15 11:59:56 pi2weewx /weewxd[26457]: zabbix: /usr/bin/zabbix_sender result: Response from "XXX.XXX.XXX.XXX:10051": "processed: 0; failed: 32; total: 32; seconds spent: 0.000570"
                                         sent: 32; skipped: 0; total: 32

from weewx-zabbix.

RandomReaper avatar RandomReaper commented on July 28, 2024

If I remember correctly, processed 0 is because the item does not exists in zabbix.

You just masked the line I was asking you to change? I don't even know what you tested...

from weewx-zabbix.

HoracioDos avatar HoracioDos commented on July 28, 2024

Hello:
I tested what I answered before. I inserted universal_newlines=True in popen() in line 89, It also works with text= True and I removed decode() in line 91. I will test your change later.

        p = Popen(c, universal_newlines=True ,stdout=PIPE, stdin=PIPE, stderr=STDOUT)
        ...
        loginf(self.zabbix_sender + " result: " +sender_stdout)

Zabbix items were already created. I'll build a template if I have the time. I know why zabbix_sender is not working. I use PSK to cypher agent to server communication. I will add the config file that it is needed
-c /etc/zabbix/zabbix_agentd.conf

from weewx-zabbix.

HoracioDos avatar HoracioDos commented on July 28, 2024

Thank you for the report,

I currently quite overbooked, but if you could try to replace the line 90 from:
sender_stdout = p.communicate(input=s)[0]
to
sender_stdout = p.communicate(input=s.encode())[0]

Your solution works fine.
I added the config file parameter. It's working now with PSK.
I'm trying to figure out why zabbix_sender runs 3 times each time.
What's the units for send_internal?
Thanks!

from weewx-zabbix.

RandomReaper avatar RandomReaper commented on July 28, 2024

Fixed for python3 in 7ca4c9f.

from weewx-zabbix.

RandomReaper avatar RandomReaper commented on July 28, 2024

I think, but you should verify, the units are the same as the internal zabbix units (see http://weewx.com/docs/customizing.htm#Changing_the_unit_system).

from weewx-zabbix.

HoracioDos avatar HoracioDos commented on July 28, 2024

Hello!
I think Send_interval parameter is in seconds. As far as I understand, time difference result in your code (line 77) is in seconds. Is that correct?
Thanks!

from weewx-zabbix.

HoracioDos avatar HoracioDos commented on July 28, 2024

Send_Interval = 290 seconds works fine if I want to send values just once in the packet loop. This way matches with the archive interval.

Dec 17 14:56:02 pi2weewx python3[24347]: weewx[24347] INFO weewx.manager: Added record 2020-12-17 14:55:00 -03 (1608227700) to database 'weewx.sdb'
Dec 17 14:56:02 pi2weewx python3[24347]: weewx[24347] INFO weewx.manager: Added record 2020-12-17 14:55:00 -03 (1608227700) to daily summary in 'weewx.sdb'
Dec 17 15:01:04 pi2weewx python3[24347]: weewx[24347] INFO user.zabbix: Response from "xxx.xxx.xxx.xxx:10051": "processed: 32; failed: 0; total: 32; seconds spent: 0.001104" sent: 32; skipped: 0; total: 32
Dec 17 15:01:04 pi2weewx python3[24347]: weewx[24347] INFO weewx.manager: Added record 2020-12-17 15:00:00 -03 (1608228000) to database 'weewx.sdb'
Dec 17 15:01:04 pi2weewx python3[24347]: weewx[24347] INFO weewx.manager: Added record 2020-12-17 15:00:00 -03 (1608228000) to daily summary in 'weewx.sdb'
Dec 17 15:06:06 pi2weewx python3[24347]: weewx[24347] INFO user.zabbix: Response from "xxx.xxx.xxx.xxx:10051": "processed: 32; failed: 0; total: 32; seconds spent: 0.001014" sent: 32; skipped: 0; total: 32
Dec 17 15:06:06 pi2weewx python3[24347]: weewx[24347] INFO weewx.manager: Added record 2020-12-17 15:05:00 -03 (1608228300) to database 'weewx.sdb'
Dec 17 15:06:06 pi2weewx python3[24347]: weewx[24347] INFO weewx.manager: Added record 2020-12-17 15:05:00 -03 (1608228300) to daily summary in 'weewx.sdb'
Dec 17 15:11:14 pi2weewx python3[24347]: weewx[24347] INFO user.zabbix: Response from "xxx.xxx.xxxx.xxx:10051": "processed: 32; failed: 0; total: 32; seconds spent: 0.000860" sent: 32; skipped: 0; total: 32

from weewx-zabbix.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.