randomreaper / weewx-zabbix Goto Github PK
View Code? Open in Web Editor NEWweewx plugin to push weather data to zabbix
License: Apache License 2.0
weewx plugin to push weather data to zabbix
License: Apache License 2.0
RainTotal is currently showing 55 every day, even without raining. It rained 0.4" the other day and the value did not increase.
Feb 15 09:44:55 john-PS583AA-ABA-a1020n weewx[4213]: zabbix: sandvine.lan weewx_rain_total 55.245
Weewx 3.9.1
The rest of the values seem to be correct and are updating properly from the correct sources.
Hello.
Logger function changed since Weewx 4.x,. You can make it backwards compatible and adopt the new one by changing from line 38 to 48
def logmsg(dst, msg):
syslog.syslog(dst, 'zabbix: %s' % msg)
def logdbg(msg):
logmsg(syslog.LOG_DEBUG, msg)
def loginf(msg):
logmsg(syslog.LOG_INFO, msg)
def logerr(msg):
logmsg(syslog.LOG_ERR, msg)
with this
# Test for new-style weewx v4 logging by trying to import weeutil.logger
import weeutil.logger
import logging
try:
log = logging.getLogger(__name__)
def logdbg(msg):
log.debug(msg)
def loginf(msg):
log.info(msg)
def logerr(msg):
log.error(msg)
except ImportError:
# Old-style weewx logging
import syslog
def logmsg(level, msg):
syslog.syslog(level, 'Zabbix Extension: %s' % msg)
def logdbg(msg):
logmsg(syslog.LOG_DEBUG, msg)
def loginf(msg):
logmsg(syslog.LOG_INFO, msg)
def logerr(msg):
logmsg(syslog.LOG_ERR, msg)
Thanks
Hello.
Zabbix extension fails to run.
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: loop data:
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_usUnits 16
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_dateTime 1608039616
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_inHumidity 46.0
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_inTemp 26.200000000000003
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_outHumidity 71.0
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_outTemp 20.200000000000003
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_pressure 1010.8000000000001
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_windSpeed 7.2
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_windGust 9.72
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_windDir 225.0
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_rain None
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_radiation 228.18595
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_UV 2.0
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_status 0
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_ptr 42176
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_delay 18
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_rxCheckPercent 100
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_outTempBatteryStatus 0
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_rainTotal 7.739999999999999
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_altimeter 1010.8909740144559
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_appTemp 20.332427851579602
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_barometer 1010.8000000000001
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_beaufort 1
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_cloudbase 662.3046501766602
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_dewpoint 14.767697700714633
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_heatindex 20.129444444444452
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_humidex 24.02561521575064
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_inDewpoint 13.652460445809679
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_maxSolarRad 942.3936622272251
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_rainRate 0.0
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_windchill 20.200000000000006
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: pi2weewx weewx_windGustDir None
Dec 15 10:40:16 pi2weewx /weewxd[16646]: zabbix: command line : ['/usr/bin/zabbix_sender', '-z', 'XXX.XXX.XXX.XXX', '-i', '-']
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] INFO weewx.engine: Main loop exiting. Shutting engine down.
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] DEBUG weewx.restx: Shut down WeatherCloud thread.
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] DEBUG weewx.restx: Shut down Windy thread.
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] DEBUG weewx.restx: Shut down PWSWeather thread.
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] DEBUG weewx.restx: Shut down Wunderground-RF thread.
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: Caught unrecoverable exception:
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** memoryview: a bytes-like object is required, not 'str'
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** Traceback (most recent call last):
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** File "/usr/share/weewx/weewxd", line 154, in main
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** engine.run()
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** File "/usr/share/weewx/weewx/engine.py", line 206, in run
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** self.dispatchEvent(weewx.Event(weewx.NEW_LOOP_PACKET, packet=packet))
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** File "/usr/share/weewx/weewx/engine.py", line 241, in dispatchEvent
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** callback(event)
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** File "/usr/share/weewx/user/zabbix.py", line 90, in loop
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** sender_stdout = p.communicate(input=s)[0]
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** File "/usr/lib/python3.7/subprocess.py", line 939, in communicate
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** stdout, stderr = self._communicate(input, endtime, timeout)
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** File "/usr/lib/python3.7/subprocess.py", line 1666, in _communicate
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** input_view = memoryview(self._input)
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** TypeError: memoryview: a bytes-like object is required, not 'str'
Dec 15 10:40:16 pi2weewx python3[16646]: weewx[16646] CRITICAL __main__: **** Exiting.
Thanks
Hello.
Would you consider to replace this line 91. I didn't learn how to make a pr yet.
loginf(self.zabbix_sender + " result: " +sender_stdout.decode())
with
loginf(' '.join(sender_stdout.decode().split()))
to get a better output format. you will get something like this
Response from "XXX.XXX.XXX.XXX:10051": "processed: 32; failed: 0; total: 32; seconds spent: 0.000852" sent: 32; skipped: 0; total: 32
Thanks
Hello.
I installed the extension today and weewx service fails to run due to this error. I found it in many lines in the code. I finally fixed. I don't know if it is related to python3.
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: Caught unrecoverable exception:
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** inconsistent use of tabs and spaces in indentation (zabbix.py, line 89)
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** Traceback (most recent call last):
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** File "/usr/share/weewx/weewxd", line 148, in main
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** engine = weewx.engine.StdEngine(config_dict)
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** File "/usr/share/weewx/weewx/engine.py", line 81, in __init__
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** self.loadServices(config_dict)
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** File "/usr/share/weewx/weewx/engine.py", line 153, in loadServices
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** obj = weeutil.weeutil.get_object(svc)(self, config_dict)
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** File "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** mod = __import__(module)
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** File "/usr/share/weewx/user/zabbix.py", line 89
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** sender_stdout = p.communicate(input=s)[0]
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** ^
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** TabError: inconsistent use of tabs and spaces in indentation
Dec 15 10:05:14 pi2weewx python3[9962]: weewx[9962] CRITICAL __main__: **** Exiting.
Thanks in advanced
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.