Giter VIP home page Giter VIP logo

covid9-monitor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

covid9-monitor's Issues

Stop working loading

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'.

Random issues displaying per country stats

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:

Screenshot 2020-03-15 at 17 18 41

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):

Screenshot 2020-03-15 at 17 21 47

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):

Screenshot 2020-03-15 at 17 44 19

Here is the zabbix server log:

zabbix_server.log

Scripts seems to be working fine also, here you have the outputs:

corona_scripts_output.txt

Same output on the frontend:

Screenshot 2020-03-15 at 17 51 51

Thanks in advance for your help again. Really interested on implement this on my environment :)

Help with the installation.

Good afternoon, I first encountered Grafana, do not help me with instructions on how to set up a covid9 monitor in my home?

urllib.error.HTTPError: HTTP Error 403: Forbidden

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?

No tables found matching pattern '.+'

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 '.+'

Cast error while getting data for numerals vs strings

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

Master item stop loading data.

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 '.+'

failed to load data

image

In zabbix the data is displayed correctly, but not in the granfana dashboard.
The version of zabbix is 4.4.
debian 10 64bit
Grafana 6.7.1

Total: is missing in covid19_status.py

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)

Numbers on map are duplicated

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.

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.