rickkbarbosa / covid9-monitor Goto Github PK
View Code? Open in Web Editor NEWGets information involving casualities and presents to JSON and Zabbix
License: Apache License 2.0
Gets information involving casualities and presents to JSON and Zabbix
License: Apache License 2.0
Just having this issue trying to Add the template you updated yesterday to my zabbix server:
Incorrect value for field "master_itemid": maximum dependent items count reached.
Seems i can add it to my clients but not on the server.
Thanks in advance :)
Hi from previously working fine, the counter is stop working. The page on is maybe changed.
URL i can reach https://www.worldometers.info/coronavirus/#countries
root@server:/usr/lib/zabbix/externalscripts# ./covid19_status.py
Traceback (most recent call last):
File "./covid19_status.py", line 31, in <module>
df = df.to_json(orient='index')
File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 2273, in to_json
index=index)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/json/json.py", line 62, in to_json
index=index).write()
File "/usr/local/lib/python2.7/dist-packages/pandas/io/json/json.py", line 96, in __init__
self._format_axes()
File "/usr/local/lib/python2.7/dist-packages/pandas/io/json/json.py", line 147, in _format_axes
"'{orient}'.".format(orient=self.orient))
ValueError: DataFrame index must be unique for orient='index'.
Hi again.
Regarding to this: #10
Finnally updated to Zabbix 4.0.18.
Seems that randomly, zabbix isnt aquiring the data correctly.
Yesterday was working quite fine all day. Today i discovered this:
Seems that no other country is being reported a part from china. Yesterday on latest data section all coutries were listed.
On Grafana i can only see total stats and worldmap (cannot see data either on the map):
As reported on zabbix ¨latest data¨ theres no graphical reports for individual countries:
Seems that covid data isnt reporting anything (maybe thats where the issue is coming from):
Here is the zabbix server log:
Scripts seems to be working fine also, here you have the outputs:
Same output on the frontend:
Thanks in advance for your help again. Really interested on implement this on my environment :)
Good afternoon, I first encountered Grafana, do not help me with instructions on how to set up a covid9 monitor in my home?
Traceback (most recent call last): File "./covid19_status.py", line 24, in <module> df = pd.read_html(url, index_col=0)[0] File "/usr/lib/python3.8/site-packages/pandas/io/html.py", line 1085, in read_html return _parse( File "/usr/lib/python3.8/site-packages/pandas/io/html.py", line 895, in _parse tables = p.parse_tables() File "/usr/lib/python3.8/site-packages/pandas/io/html.py", line 213, in parse_tables tables = self._parse_tables(self._build_doc(), self.match, self.attrs) File "/usr/lib/python3.8/site-packages/pandas/io/html.py", line 733, in _build_doc raise e File "/usr/lib/python3.8/site-packages/pandas/io/html.py", line 714, in _build_doc with urlopen(self.io) as f: File "/usr/lib/python3.8/site-packages/pandas/io/common.py", line 141, in urlopen return urllib.request.urlopen(*args, **kwargs) File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.8/urllib/request.py", line 531, in open response = meth(req, response) File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response response = self.parent.error( File "/usr/lib/python3.8/urllib/request.py", line 569, in error return self._call_chain(*args) File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden
I guess this is caused by a missing user agent that they're blocking?
Hello, I'm having a problem with the scripts, it started happening 4 days ago.
[root@acsc-zabbix covid9-monitor]# ./covid19_status.py
Traceback (most recent call last):
File "./covid19_status.py", line 35, in
df = pd.read_html(str(soup), index_col=1, thousands=r',', flavor="bs4")[0]
File "/usr/lib64/python2.7/site-packages/pandas/io/html.py", line 1094, in read_html
displayed_only=displayed_only)
File "/usr/lib64/python2.7/site-packages/pandas/io/html.py", line 916, in _parse
raise_with_traceback(retained)
File "/usr/lib64/python2.7/site-packages/pandas/io/html.py", line 898, in _parse
tables = p.parse_tables()
File "/usr/lib64/python2.7/site-packages/pandas/io/html.py", line 221, in parse_tables
tables = self._parse_tables(self._build_doc(), self.match, self.attrs)
File "/usr/lib64/python2.7/site-packages/pandas/io/html.py", line 570, in _parse_tables
.format(patt=match.pattern))
ValueError: No tables found matching pattern '.+'
I've got these cast errors:
25851:20200321:215932.303 error reason for "Zabbix server:covid19.data[NewCases, "Switzerland"]" changed: Value "+1,131" of type "string" is not suitable for value type "Numeric (float)" 25850:20200321:222932.988 error reason for "Zabbix server:covid19.data[NewCases, "Switzerland"]" changed: Value "+1,132" of type "string" is not suitable for value type "Numeric (float)" 25850:20200321:222932.988 error reason for "Zabbix server:covid19.data[NewCases, "USA"]" changed: Value "+5,403" of type "string" is not suitable for value type "Numeric (float)"
Zabbix 4.4.6
Python 2.7.16
But easy to fix :)
https://grafana.com/grafana/plugins/grafana-piechart-panel
Hi Rick,
again we have same error with source page is changed.
root@hosting1:/usr/lib/zabbix/externalscripts# ./covid19_status.py
Traceback (most recent call last):
File "./covid19_status.py", line 35, in
df = pd.read_html(str(soup), index_col=1, thousands=r',', flavor="bs4")[0]
File "/usr/local/lib/python2.7/dist-packages/pandas/io/html.py", line 1094, in read_html
displayed_only=displayed_only)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/html.py", line 916, in _parse
raise_with_traceback(retained)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/html.py", line 898, in _parse
tables = p.parse_tables()
File "/usr/local/lib/python2.7/dist-packages/pandas/io/html.py", line 221, in parse_tables
tables = self._parse_tables(self._build_doc(), self.match, self.attrs)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/html.py", line 570, in _parse_tables
.format(patt=match.pattern))
ValueError: No tables found matching pattern '.+'
Multiple tbody confuses pandas for that "Total:" is not present.
Here's the fixed code with new requirements:
BeautifulSoup (pip install BeautifulSoup)
import pandas as pd
import requests
from bs4 import BeautifulSoup
url = 'https://www.worldometers.info/coronavirus/#countries'
header = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36","X-Requested-With": "XMLHttpRequest"}
r = requests.get(url, headers=header)
# fix HTML multiple tbody
soup = BeautifulSoup(r.text, "html.parser")
for body in soup("tbody"):
body.unwrap()
df = pd.read_html(str(soup), index_col=0, flavor="bs4")[0]
df = df.fillna('0')
df = df.to_json(orient='index')
print(df)
Selecting just a couple of countries and checking numbers on map we can see they are duplicated. While Brazil has 150 cases, map shows 300.
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.