Coder Social home page Coder Social logo

geopython / geohealthcheck Goto Github PK

View Code? Open in Web Editor NEW
83.0 23.0 71.0 18 MB

Service Status and QoS Checker for OGC Web Services

Home Page: https://geohealthcheck.org

License: MIT License

Python 76.86% CSS 0.54% HTML 17.93% Shell 1.72% Mako 0.11% JavaScript 2.10% Dockerfile 0.75%
gis osgeo python docker healthcheck

geohealthcheck's Introduction

geopython

Vanity package for geopython projects

pip install geopython
>>> import geopython

geohealthcheck's People

Contributors

alexandreleroux avatar archaeogeek avatar astroidex avatar bart-v avatar borrob avatar candux avatar cezio avatar cmotadev avatar dependabot[bot] avatar dracic avatar epif4nio avatar epifanio avatar fgafford avatar fsteggink avatar gabriel-desharnais avatar hannesaddec avatar jakobmiksch avatar jochemthart1 avatar justb4 avatar maretius avatar mkofahl avatar om-henners avatar ragnvald avatar raymondnijssen avatar stever1984 avatar tomkralidis avatar vincentbougie avatar yjacolin avatar

Stargazers

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

Watchers

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

geohealthcheck's Issues

Data export for individual resources (CSV and JSON)

User Story:

As a user
I want to export historical data for any individual resource monitored in JSON or CSV
so that I can use the output programmatically (JSON) or download for tabular analysis (CSV)

Current situation

Data export is limited to the main list of resources. For example, given the monitoring site http://geohealthcheck.osgeo.org you can export data using http://geohealthcheck.osgeo.org/export

Proposed changes

  • See related issue for URL formatting (#10)
  • allow export of historical data
  • allow export of current data

Current Data

CSV: http://geohealthcheck.osgeo.org/resource/1/csv
JSON: http://geohealthcheck.osgeo.org/resource/1/json

Historical data

CSV: http://geohealthcheck.osgeo.org/resource/1/history/csv
JSON: http://geohealthcheck.osgeo.org/resource/1/history/json

  • Type
  • Owner
  • Name
  • URL
  • Date
  • Response Time
  • Status

Search Existing Web Resources

User Story

As a user
I want to search existing web resources using keywords and URL's
So that I can quickly find the resource amongst a large list of resources

Details

  • a simple search box to search multiple fields
    • search title
    • search owner
    • search URL
  • perhaps ability to filter results
    • filter on owner
    • filter on owner by resource type
  • perhaps leverage google syntax such as "site:gc.ca" that will return all resource URL's containing the given domain or "url:getCapabilities" to return all URL's with a given pattern in the URL
  • Search box should be open search enabled (http://www.opensearch.org/Home) so you can search from the browser search.

Discussion

  • As the list of tracked resources grow (eg 50+) I find that I use ctrl-f a lot. however this does not search the actual URL
  • Having a simple search mechanism would be good.
  • perhaps usage of various filters beyond resource type could also help.

Show DateTime in local timezone

Times from/in HTML templates are shown in GMT (Z). Add option, or always show in local/browser's timezone. ... Looks like this needs to be done in Python as the DateTime strings are generated from their SQLAlchemy/SQLIte UTC values. That makes using the browser's timezone somewhat trickier.

Reset User password

As a user
I want to reset my password
So that I can gain access to the system in the event that the password was forgotten

Reset Admin password

As a Geo health Check administrator
I want to be able to reset the admin password
So that I can reset the account in the event that the password was forgotten

Responsive layout issue: content inaccessible for certain widths

Issue with GeoHealthCheck's reponsive layout: content can become hidden / inaccessible. See attached screenshot.

The problem: GeoHealthCheck content is hidden at certain browser window width. Because there's no horizontal scrollbar, the content is indeed inaccessible to users for those window widths.

Steps to reproduce: go to http://geohealthcheck.osgeo.org/ or another GHC installation, and resize the window until content becomes inaccessible.

geohealthcheck-responsive-issue

Broken link to /static/docs on geohealthcheck.osgeo.org

First of all: great work you people are doing on GHC! Planning to use and possibly contribute in the coming time.

Don't know if this app belongs to this repo/project here, but I signal this anyway: http://geohealthcheck.osgeo.org/ has a broken link when clicking Help button: http://geohealthcheck.osgeo.org/static/docs/index.html. Possibly an idea to host the docs on https://readthedocs.org ? Is relatively easy. Hey, that could be my first contrib but one needs project admin rights! ... pff I now see, there is: http://geopython.github.io/GeoHealthCheck/

Monitor alternative responses from returned from a resouce

User Story

As a user, admin
I want to configure a resource to expect a certain result from a "test"
So that I can ensure the service is not only alive, but also returning appropriate values.

Discussion

  • This feature could start with simple TEXT responses so a system can input a value into a simple text file and that value is read by GeoHealthCheck. This could allow many system scripts to simply output a status to a file (or even output a log file) to a WAF.
  • This feature could allow using XPATH to define values in XML or HTML (eg TITLE=My Org)
  • this feature could also leverage REGEX
  • how to search for expected result in JSON?
  • Could you validate the output of a service such as an XML doc of JSON doc?
  • This feature would allow some "quality" checks as well as a service check.
  • This feature would allow you to not only check the presence of say a service or API, but also validate the output of that service.
  • Perhaps a service that is running but returns an unexpected results is automatically a YELLOW unless otherwise defined.

Resource-type filtering links in main view have no effect

Looking into the code in particular list_resources() in views.py, at about line 55, this may be the cause:

    if resource_type is not None:
        response['resources'] = models.Resource.query.filter_by(
            resource_type=resource_type).all()
    if query is not None:
        field, term = get_query_field_term(query)
        response['resources'] = models.Resource.query.filter(
            field.ilike(term)).all()
    else:
        response['resources'] = models.Resource.query.all()

When a resource_type is given but query is None the filtered response['resources'] is overwritten.

I can test and issue a PR.

Serve local help files

Currently help files are served from github.com/geopython/GeoHealthCheck.
To avoid unnecessary traffic, the docs output could be statically served via Flask from local repository

organize resources into "Groups"

User Story

As a user, owner,admin
I want to create separate group to collect all of my web resources
So I am not distracted by resources I am not concerned about.

Discussion

This feature would allow a single instance of GeoHealthCheck to server multiple stakeholders in a organized fashion within a large organization (such as a government with multiple departments). Adds some enterprise'ness' to it all

proposal

Provide a hierarchy such as

  • Group (eg. an organization or a user)
    • Service Type (CSW, FTP)
      • Resource (individual web resources)

Access Control

  • allow a user to "admin" a group by adding more group admins or users
  • registered users can request to JOIN a group
  • visibility of a group may be configurable for viability to everyone, logged in users, group user etc
  • allow Groups within groups? eg
    • Government of Canada (parent group)
      • Environment Canada (sub group)
        • Service Type
          • Web Resource
      • Natural Resources Canada (sub group)
        • Service Type
          • Web Resource

Add setup for Apache or service deploymemt

User Story

As a GeoHealthCheck (GHC) administrator
I want to run GHC as a service
So that I can manage the application as a

Options

  1. Setup as a system service (eg $ sudo service geohealthcheck start|stop|restart)
  2. Trigger something in Apache config to tie in GHC

Any ideas?

Data export in JSON and CSV

User Story:

As a user
I want to export data of all resources in JSON and CSV formats
So that I can use JSON programmatically and CSV for tabular data analysis

The export feature on the main page only allows JSON export (eg. http://geohealthcheck.osgeo.org/export)

ideas:

Change URL pattern to indicate format
http://geohealthcheck.osgeo.org/json
http://geohealthcheck.osgeo.org/resource/1/json
Add a CSV export option
http://geohealthcheck.osgeo.org/csv
http://geohealthcheck.osgeo.org/resource/1/csv

Details:

Given JSON from http://geohealthcheck.osgeo.org/export
"resource_type": "OGC:CSW",
"title": "CSW interface for catalog.data.gov",
"url": "http://catalog.data.gov/csw-all"

JSON attributes to add:

"ghc_url":"http://geohealthcheck.osgeo.org/resource/1"
"ghg_json":"http://geohealthcheck.osgeo.org/resource/1/json"
"ghg_csv":"http://geohealthcheck.osgeo.org/resource/1/csv"
"last-check":" "
"status":" "
"response time":" "
"reliability":" "

This way a developer can navigate to either the report page, JSON or CSV output from the main

CSV Attributes

  • resource
  • title
  • url
  • ghc_url
  • ghc_json
  • ghc_csv
  • last-check
  • status
  • response time
  • reliability

Override TITLE Attribute for CSW services

User Story

As a user
I would like to provide or override the TITLE attribute of CSW (or other OWS) service when it is missing
So that I can still monitor a service that I have no control over but might have a stake in

Example

My organization publishes data to an external catalog.
I want to ensure that catalog is running because it hosts my data
I have no control over the config, but still want it tracked in GeoHealthChecker

Proposal

If upon first submitting a GetCapabilities, the title attribute is empty, prompt user for an alternative title so entry can be saved in DB despite being a poorly managed CSW (or nay OWS service actually)

paver greate_secret_key produces charset related issues

Using putty in Windows as terminal client and nano as editor. Setting the system up on a default 14.04 Ubuntu platform on Amazon.

(GeoHealthCheck)ubuntu@ip-123-123-123-123:~/GeoHealthCheck/GeoHealthCheck$ paver create_secret_key
---> pavement.create_secret_key
Secret key: 5s▒%▒▒▒N3-e▒:㌧[Fk▒d_▒o
Copy/paste this key to set the SECRET_KEY
value in instance/config.py

Something goes wrong in this process and the secret key is not accepted. Most probably to mixing platforms and messing around with charset. Error message:

(GeoHealthCheck)ubuntu@ip-123-123-123-123:~/GeoHealthCheck/GeoHealthCheck$ paver create
---> pavement.create
python GeoHealthCheck/models.py create
Traceback (most recent call last):
File "GeoHealthCheck/models.py", line 40, in
from init import DB
File "/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/init.py", line 36, in
APP.config.from_pyfile('../instance/config.py')
File "/home/ubuntu/GeoHealthCheck/local/lib/python2.7/site-packages/flask/config.py", line 129, in from_pyfile
exec(compile(config_file.read(), filename, 'exec'), d.dict)
File "/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/../instance/config.py", line 33
SECRET_KEY = 5s▒%▒▒▒N3-e▒:㌧[Fk▒d_▒o
^
SyntaxError: invalid syntax

Captured Task Output:

---> pavement.create
python GeoHealthCheck/models.py create

Build failed running pavement.create: Subprocess return code: 1

Might be an issue outside this system. Still - it makes installing the system a bit awkward for a person not too used to setting up services like this.

Provide and configure contact Information for each web resource

User Story

As a user or administrator
I want to assign a "contact" e-mail for each resource I enter
So that notifications can be sent to other parties responsible for the service or application that is failing.

Access controls

  • Only the admin and owner of the resource should be able to see and edit e-mail contact info
  • Anonymous users will not see contact e-mail

Considerations

  • Send only initial error notice
  • repeat after 6, 12, 24 hours, 1 week, and then monthly notices to owner
  • provide a contact name and phone number slot too.
  • Provide check boxes as options for notifications, in the event
    • Notifiy contact on failure
    • Notify admin on failure
    • notify owner on failure
    • send contact e-mail to owner / admin (allows for easy forwarding of e-mail. good for when contact is outside your organization)
    • provide a "send notice now" button to e-mail contact if service is CURRENTLY down.

error notice

  • Provide the ability to create an error notice e-mail template inside the user interface

Emptying Run table causes error in next models.py 'run'

In some cases there is a need to start 'afresh', removing all existing Run data but without removing all Resources and Users. Truncating/emptying the Run table would normally be sufficient. However, a 'run' with an empty 'Run' table will render an error and no results are committed in Run table. The error occurs on res.last_run.success in models.py L245 as this var/field will be empty:

                last_run_success = res.last_run.success
                run_to_add = run_test_resource(res.resource_type, res.url)

                run1 = Run(res, run_to_add[1], run_to_add[2],
                           run_to_add[3], run_to_add[4])

                print('Adding run')
                DB.session.add(run1)

                if APP.config['GHC_NOTIFICATIONS']:
                    notify(APP.config, res, run1, last_run_success)

As last_run_success is only used when notification is enabled, it should be checked if res.last_run exists. Confirmed this in own env. Can provide a PR for this.

Error while installing

At the end of the
paver setup
command, I get this output:

Cleaning up...
move path('/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/static/lib/startbootstrap-sb-admin-2-gh-pages/css') path('/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/static/lib/css')


Captured Task Output:
---------------------

---> pavement.setup
pip install -r requirements.txt
move path('/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/static/lib/startbootstrap-sb-admin-2-gh-pages/css') path('/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/static/lib/css')
Traceback (most recent call last):
  File "/home/ubuntu/GeoHealthCheck/local/lib/python2.7/site-packages/paver/tasks.py", line 196, in _run_task
    return do_task()
  File "/home/ubuntu/GeoHealthCheck/local/lib/python2.7/site-packages/paver/tasks.py", line 193, in do_task
    return func(**kw)
  File "pavement.py", line 91, in setup
    src_loc.move(dest_loc)
  File "/home/ubuntu/GeoHealthCheck/local/lib/python2.7/site-packages/paver/path.py", line 69, in wrapper
    return dry(msg, func, *args, **kwds)
  File "/home/ubuntu/GeoHealthCheck/local/lib/python2.7/site-packages/paver/easy.py", line 15, in dry
    return func(*args, **kw)
  File "/usr/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/usr/lib/python2.7/shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: path('/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/static/lib/startbootstrap-sb-admin-2-gh-pages/css')

I then created that folder, then i get the same message for folder

/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/static/lib/startbootstrap-sb-admin-2-gh-pages/font-awesome-4.1.0
/home/ubuntu/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/static/lib/startbootstrap-sb-admin-2-gh-pages/fonts

The js and less subpaths are moved successfully and the setup finishes correctly.

Flask-Login dependency issue on CentOS 7

failures with Flask-Login 0.3.0, but works with 0.2.11

One a new CentOS 7 system I tried installing GHC.

There were various deps that were required (eg develop RPM package), paver through some errors along the way (complaining about gcc).

Then once i tried to srtat the app the service ran but we were getting errors due to the templates.

A temp fix was in line 48 of the layout.html file we remove the enclosed brackets.

The long term fix was to:

pip uninstall Flask-Login
pip install Flask-Login==0.2.11

Cheers

readme.md not "parsing"

Trying to go through the setup procedure as indicated in readme.md.

Second line leaves me puzzled.

1: virtualenv GeoHealthCheck && cd $_
2: . bin/activate

Is this really one line?

Setting up - it stops on the last step

Still trying to start the service. Tried as plain user (default ubuntu user) and also under sudo bash. This is what happens:

(GeoHealthCheck)root@ip-172-31-20-6:/GeoHealthCheck/GeoHealthCheck# paver create
---> pavement.create
python GeoHealthCheck/models.py create
Creating database objects
Creating superuser account
Enter your username: ragnvald
Enter your password: verysecretpass
Enter your password again: verysecretpass
Enter your email: myemail@no
Enter your email again: myemail@no
(GeoHealthCheck)root@ip-172-31-20-6:
/GeoHealthCheck/GeoHealthCheck# python GeoHealthCheck/models.py drop
Dropping database objects
(GeoHealthCheck)root@ip-172-31-20-6:~/GeoHealthCheck/GeoHealthCheck# python GeoHealthCheck/app.py

Stops the process with control-c, since it looks much like it is hanging. Trying again with the public IP for the virtual computer:

^C(GeoHealthCheck)root@ip-172-31-20-6:~/GeoHealthCheck/GeoHealthCheck# python GeoHealthCheck/app.py 54.76.210.109:8000

  • Running on http://54.76.210.109:8000/
    Traceback (most recent call last):
    File "GeoHealthCheck/app.py", line 308, in
    APP.run(host=HOST, port=int(PORT), use_reloader=True, debug=True)
    File "/home/ubuntu/GeoHealthCheck/local/lib/python2.7/site-packages/flask/app.py", line 772, in run
    run_simple(host, port, self, *_options)
    File "/home/ubuntu/GeoHealthCheck/local/lib/python2.7/site-packages/werkzeug/serving.py", line 706, in run_simple
    test_socket.bind((hostname, port))
    File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(_args)
    socket.error: [Errno 99] Cannot assign requested address
    (GeoHealthCheck)root@ip-172-31-20-6:~/GeoHealthCheck/GeoHealthCheck#

So still struggling here. Not sure what I mess up. But I do think that the install info for the user could be more elaborate.

Show simple health trend chart on resources table

User Story:

As a user
I want to see a small line chart to visualize health trend of all resources over time
So I can quickly examine and compare all resources on the main page.

Current situation

Given a monitoring page such as: http://geohealthcheck.osgeo.org/:

  • Type, name, last check, status, response time, reliability already exist.

Proposed

  • insert a new column displaying a line chart of access for the last week/month/quarter/year (configurable, default week).
  • provide chart using dots
    ** 7 - 14 = last week (dot=day)
    ** 4 = last month (dot = week)
    ** 12 = last quarter (dot = week)
    ** 52 = annual (dot =week)
  • dots represent lowest status for that day/week. For example if nothing failed( green), if one yellow then use yellow, if red then put dot red.
  • For the Y axis, use the AVERAGE of the response time for the day/week

Example

Check out the dashboard for PIWIK here: http://demo.piwik.org/index.php?module=MultiSites&action=index&idSite=3&period=day&date=yesterday

  • notice the last collumn wihc is a small graphic. I am proposing something similar

requirements.txt should include Sphinx PyPi package

Standard setup via Paver/pavement.py will call sphinx-build to generate documentation. This requires PyPy package Sphinx to be present. Requirements are installed in pavement.py setup() via sh('pip install -r requirements.txt'). The current version of requirements.txt does not contain Sphinx (only requirements-dev.txt). This caused an install error on a clean Ubuntu 14.04 system.

Notifications: 'Still Failing' status may trigger too many emails

If notification is enabled GHC will send email on status changes: e.g. Failing when a Resource fails, Fixed when it succeeds again. But when a Resource is e.g. out of order for a longer period the status Still Failing will be sent on each Run. In most uptime monitors this status is never sent. In cases, e.g. when a server has multiple OWS services or many WWW:LINKs one may get flooded with emails that don't add anything that we already know.

My proposal is to skip notification for the result Still Failing: a Resource may be temporarily down. The first email Failing and a second Fixed would IMO be sufficient. We can derive that in between these statuses the Resource is Still Failing. Another option is to make notification for this status configurable (default False), but I doubt that users will apply this.

The fix is utterly simple, I can commit that, but maybe there were strong reasons for Still Failing notifications.

Install and Usage behind reverse proxy scenario

Installation in a scenario on a windows machine behind a reverse proxy with authentication. Issues and code suggestion are below. If a PR is needed for suggestion 3 let me know.

Issue 1:
Executing <> - excerpt from the messages

......
stall\virtualenvironment\geohealthcheck\lib\site-packages (from Flask->Flask-Log
in==0.2.11->-r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in g:\inst
all\virtualenvironment\geohealthcheck\lib\site-packages (from Flask->Flask-Login
==0.2.11->-r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in g:\install
\virtualenvironment\geohealthcheck\lib\site-packages (from python-dateutil>=1.5-
>OWSLib->-r requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in g:\insta
ll\virtualenvironment\geohealthcheck\lib\site-packages (from Jinja2>=2.4->Flask-
>Flask-Login==0.2.11->-r requirements.txt (line 1))

Captured Task Output:

---> pavement.setup
pip install -r requirements.txt
Traceback (most recent call last):
  File "g:\install\virtualenvironment\geohealthcheck\lib\site-packages\paver\tas
ks.py", line 196, in _run_task
    return do_task()
  File "g:\install\virtualenvironment\geohealthcheck\lib\site-packages\paver\tas
ks.py", line 193, in do_task
    return func(**kw)
  File "pavement.py", line 87, in setup
    zipstr = StringIO(urlopen(skin).read())
  File "G:\apps\Python27\Lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "G:\apps\Python27\Lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "G:\apps\Python27\Lib\urllib2.py", line 449, in _open
    '_open', req)
  File "G:\apps\Python27\Lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "G:\apps\Python27\Lib\urllib2.py", line 1240, in https_open
    context=self._context)
  File "G:\apps\Python27\Lib\urllib2.py", line 1197, in do_open
    raise URLError(err)
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify fai
led (_ssl.c:590)>

All requirements are satisfied - I believe its due to the downloading of files from pavement.py - line ~73..106 .. I performed the steps manually and it compiled afterwards. There are plenty of websites with issues with the certificate problem, however I'm wondering if the iostring used is aware of the reverse proxy authentication set outside via SET HTTPS_PROXY or SET HTTP_PROXY

Issue 2:

To run the application inside an closed system I suggest to move the leaflet CDN/IE9 code in to a local file (e.g. static/lib ) so following code changes for

add to layout.html
L15
L20+21 <script src="{{ url_for('static', filename='lib/html5shiv.min.js') }}"></script>
<script src="{{ url_for('static', filename='lib/respond.min.js') }}"></script>
L112 <script src="{{ url_for('static', filename='lib/leaflet-0.6.4/leaflet.js') }}"></script>

and to be added in setup() in pavement.py for downloading these files.

Issue 3:

Add on feature - WMS service configurable in the config.py so the site background WMS can be specified.

  1. add to config.py in line 44
    GHC_BACKGROUNDWMS_URL = 'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png'
    GHC_BACKGROUNDWMS_CENTER_LAT = 1.1
    GHC_BACKGROUNDWMS_CENTER_LON =1.1
    GHC_BACKGROUNDWMS_MAXZOOM = 2
    GHC_BACKGROUNDWMS_SUBDOMAINS = '1234'

  2. in templates\home.html line 184 ff replace current by
    var map = L.map('all-resources-map').setView([{{ config['GHC_BACKGROUNDWMS_CENTER_LAT'] }},{{ config['GHC_BACKGROUNDWMS_CENTER_LON'] }}], 1);

 map.addLayer(new L.TileLayer(
    '{{ config['GHC_BACKGROUNDWMS_URL'] }}', {
        maxZoom: {{ config['GHC_BACKGROUNDWMS_MAXZOOM'] }},
        subdomains: '{{ config['GHC_BACKGROUNDWMS_SUBDOMAINS'] }}'
    }
));
  1. in templates\resources.html line 184 ff replace current by

map.addLayer(new L.TileLayer(
'{{ config['GHC_BACKGROUNDWMS_URL'] }}', {
maxZoom: {{ config['GHC_BACKGROUNDWMS_MAXZOOM'] }},
subdomains: '{{ config['GHC_BACKGROUNDWMS_SUBDOMAINS'] }}'
}
));

Settings display to be translated

The settings are partly translated (e.g. History and Days) however the testing frequency is not translated (e.g. 'hourly','daily','weekly','monthly','yearly'). Should we translate it as well.
Should we store in the DB in a settings table ? or to complex ?
Suggestion: drive the cron jobs from that setting in the DB as well?

Paver setup fails on data_dir.chmod(0777)

Trying to install GHC master sept 13, 2016 on Ubuntu 14.04 with Paver 1.2.1, Python 2.7, I get this error message:

vagrant@vagrant-ubuntu-trusty-64:/var/www/ghc$ sudo paver setup
---> pavement.setup

mkdir /var/www/ghc/instance
mkdir /var/www/ghc/instance/data


Captured Task Output:
---------------------

---> pavement.setup
mkdir /var/www/ghc/instance
mkdir /var/www/ghc/instance/data
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/paver/tasks.py", line 195, in _run_task
    return do_task()
  File "/usr/lib/pymodules/python2.7/paver/tasks.py", line 192, in do_task
    return func(**kw)
  File "pavement.py", line 71, in setup
    data_dir.chmod(0777)
  File "/usr/lib/pymodules/python2.7/paver/path.py", line 66, in wrapper
    msg = name + ' ' + ' '.join(args)
TypeError: sequence item 1: expected string, int found

The failure comes from /usr/lib/pymodules/python2.7/paver/path.py line 66, wheremsg = name + ' ' + ' '.join(args) expects a string, not an int (0777). But when I change in pavement.py line 71 to data_dir.chmod('0777') I obviously get another error:

---> pavement.setup
mkdir /var/www/ghc/instance
mkdir /var/www/ghc/instance/data
chmod /var/www/ghc/instance/data 0777
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/paver/tasks.py", line 195, in _run_task
    return do_task()
  File "/usr/lib/pymodules/python2.7/paver/tasks.py", line 192, in do_task
    return func(**kw)
  File "pavement.py", line 71, in setup
    data_dir.chmod('0777')
  File "/usr/lib/pymodules/python2.7/paver/path.py", line 69, in wrapper
    return dry(msg, func, *args, **kwds)
  File "/usr/lib/pymodules/python2.7/paver/easy.py", line 18, in dry
    return func(*args, **kw)
  File "/usr/lib/pymodules/python2.7/paver/deps/path2.py", line 924, in chmod
    os.chmod(self, mode)
TypeError: an integer is required

A second run of paver setup goes ok as the errored line is skipped (instance dir exists).
Commenting out the line data_dir.chmod(0777) gives no errors.

This may be due to my combination of Python & Paver versions? I will look further. But chmod() should be a normal function for Paver Bunch instances. As a last resort os.chmod() may be called directly but this defeats the purpose of Paver...

Any insights welcome!

Provide "Total" Count of all services monitored

User Story

As a user or admin
I want to have a "total resources" count
So that I can quickly report on how many services are tracked.

Observations

  • given a health checker such as: http://geohealthcheck.osgeo.org/
  • each resource type already has a count in brackets
  • adding in my head gets hard when I start pushing 50+ resources spread across a number of types

Proposal

  • Just add up these counts into a total count.
  • perhaps this info can also be included in the JSON / CSV export

Average Response time of each resource and compare all resources

User Story

As a user of GeoHealthCheck (GHC)
I want to see both the last response time and average response time of all resources on the main dashboard
So that I can compare the most recent test response to the average response time

Details

  • Given a dashboard such as http://geohealthcheck.osgeo.org/
  • provide an extra column that provides the average response time
  • maybe also a column for "Fastest" and "slowest" response times.
  • perhaps these other columns could also be added to each resource as well. They seem like decent stats to have listed.

Discussion

  • Having started tracking many sites i find that the last response times listed in the main dash may not provide a comparative snapshot of site performances.
  • I have found that the only way to see if sites are trending for a response rate is by clicking all resource one by one.
  • right now to figure out the mean, min, max, mode is to export the data in CSV (great feature BTW) and do the math in a spreadsheet. THis is ok for 5 sites. right now I am pushing 50+ so this is time consuming. Yes it could be scripted, however I think it is a worthwhile feature to add in the app itself.

[docker] Cron triggers an error

In my docker container, cron trigger such error:

Traceback (most recent call last):
  File "models.py", line 255, in <module>
    notify(APP.config, res, run1, last_run_success)
  File "/GeoHealthCheck/GeoHealthCheck/notifications.py", line 53, in notify
    result = gettext('Passing')
  File "/venv/local/lib/python2.7/site-packages/flask_babel/__init__.py", line 538, in gettext
    t = get_translations()
  File "/venv/local/lib/python2.7/site-packages/flask_babel/__init__.py", line 215, in get_translations
    babel = current_app.extensions['babel']
  File "/venv/local/lib/python2.7/site-packages/werkzeug/local.py", line 343, in __getattr__
    return getattr(self._get_current_object(), name)
  File "/venv/local/lib/python2.7/site-packages/werkzeug/local.py", line 302, in _get_current_object
    return self.__local()
  File "/venv/local/lib/python2.7/site-packages/flask/globals.py", line 34, in _find_app
    raise RuntimeError('working outside of application context')
RuntimeError: working outside of application context

Any idea why?

Create, Read, Update, Delete Resources Programatically (API?)

User Story

As a developer
I want to programmatically Create, read, update delete resources
So that I can integrate health checking into my application

Proposal

Use Case

  1. A user with an account at http://geohealthcheck.osgeo.org/ gets an API key
  2. from an application such as GeoNetwork (http://geonetwork-opensource.org/)
    • requires some collaboration perhaps for a reference implementation
    • requires some settings added to an admin panel
  3. A Geonetwork user enters a new WMS endpoint as a resource to a metadata record
  4. The GeoNetwork catalogue then checks GHC if the resource exists and is monitored eg. http://geohealthcheck.osgeo.org/json?resource_type=OGC%3AWMS
  5. it starts by checking if the domain name is being tracked
  6. It then checks to see if a WMS service on that domain is being monitored http://geohealthcheck.osgeo.org/json?resource_type=OGC%3AWMS
    1.1 if so then the API returns the URL(s) of the candidate resource(s)
    1.2 if not then the API return the URL to create a new resource
  7. details of the new resource to create are posted to http://geohealthcheck.osgeo.org/create
  8. new resource is created and then discovered at http://geohealthcheck.osgeo.org/json?resource_type=OGC%3AWMS
  9. Geonetwork then is able to probe the health checking server for the resource
  10. Depending on the status of the health check the developer can add red, green, yellow icon next to resource in the application (aka GeoNetwork)

Notes

  • Some implementations of ArcGIS server actually have a unique endpoint per resource, feature or layer. So you might have multiple services at a single domain and therefore you may want o constrain monitoring to a single service. Perhaps assuming that if one service on the domain is running then all would be running/

Adding resource while script runs in background causes trace error

User story

As a user
I want to be able to add resources and execute "test now" while background hourly cron job are running
So that I don't break the system

steps to repeat

  • ensure hourly cronjob is setup
  • at the top of the hour, try to add a new resource while the cronjob script
  • trace error returned

Solution to regain access

  • kill process
  • start GeoHealthCheck process again

Proposal

Follow recommendations for "session" stuff. "consider using a session.no_autoflush block if this flush is occurring prematurely "

Analysis

I wonder if this happened because I was entering a new resource at 3pm and the cronjob script would have been running.

Perhaps consider some “session” stuff to avoid errors when script runs at CRON time.

Trace Output

sqlalchemy.exc.InvalidRequestError
InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (OperationalError) database is locked u'UPDATE resource SET title=? WHERE resource.identifier = ?' (u'DEV: EC Data Catalogue External', 40)
Traceback (most recent call last)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
• File "/home/sampsond/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/app.py", line 135, in home
response = views.list_resources(resource_type)
• File "/home/sampsond/GeoHealthCheck/GeoHealthCheck/GeoHealthCheck/views.py", line 54, in list_resources
resource_type=resource_type).all()
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2320, in all
return list(self)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2438, in iter
return self._execute_and_instances(context)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2451, in _execute_and_instances
close_with_result=True)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2442, in _connection_from_session
**kw)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 854, in connection
close_with_result=close_with_result)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 858, in _connection_for_bind
return self.transaction._connection_for_bind(engine)
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 305, in _connection_for_bind
self._assert_active()
• File "/home/sampsond/GeoHealthCheck/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 214, in _assert_active
% self._rollback_exception
InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (OperationalError) database is locked u'UPDATE resource SET title=? WHERE resource.identifier = ?' (u'DEV: EC Data Catalogue External', 40)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
• dump() shows all variables in the frame
• dump(obj) dumps all that's known about the object

Cuztomized config for show-hidde options

User Story

As a developer
The users want to hide show some options, graphics.

Proposal

  • Need to hide some graphics, (sparks,datatables, etc)
  • Need to hide option auto-register.
  • Add these option in config file, by default show all graphics. And hide with config variables to true

Error on failing run

I'm trying to investigate why Geohealthcheck is not sending me any emails and have added an incorrect URL that it should choke on. When I run "python models.py run" manually (virtual environment activated) I can see that it marks the status of the resource as "Changed" but then I get the following error and no email is sent:

Traceback (most recent call last):
File "models.py", line 250, in
notify(APP.config, res, run1, last_run_success)
File "/home/apps/GeoHealthCheck/GeoHealthCheck/notifications.py", line 71, in notify
msg = render_template2('notification_email.txt', template_vars)
File "/home/apps/GeoHealthCheck/GeoHealthCheck/util.py", line 121, in render_template2
translations = translation('messages', 'GeoHealthCheck/translations')
File "/usr/lib/python2.7/gettext.py", line 484, in translation
raise IOError(ENOENT, 'No translation file found for domain', domain)
IOError: [Errno 2] No translation file found for domain: 'messages'

So far, I've checked the SMTP settings manually using the smtplib library at a command prompt (lifting the syntax from notifications.py) and as far as I'm concerned that seems to be working fine. The only other change I have made is also to notifications.py, to add a couple of print statements in to find out where in the process the code is choking. No changes have been made to the email template.

Add time scale selector to line chart

User Story

As a GeoHealthChecker (GHC) user
I want to select a time scale for historical tests of each resource
So that I can "zoom in" "zoom out" on the time scale to further investigate patterns and trends

Details

  • Given a GHC instance such as http://geohealthcheck.osgeo.org/, I want to select a resource, such as http://geohealthcheck.osgeo.org/resource/1 and then choose a time scale to visualize the data.
  • Start and end dates COULD be selected by two calendar widgets or controlled text entry boxes
  • A slider could used where you can slide a start date and end date picker. The slider would display the start and end dates of all possible records.
  • the scale (y-axis) of the chart should also change according to the response time of the selected time range, which may differ from the WHOLE timeline.

Discussion

  • Even with a 30 day horizon, those dots get pretty close together and are hard to visualize
  • I like using GHC to also look at response times. As such, if there was a slow response time of a couple of seconds previously in the history it greatly affects the rest of the scale. So I would like to visualize patterns and trends relative to tests within the selected timescale.

Load time of the main page is slowed with a lot of registers in table 'run'

User Story

As a user, developer
I have more than 1 million records in the table 'run' amount , and the charging time of the main page takes too long to load.

Proposal

Create an option to display the 'Status' and 'Response times' from a certain time, such as 1, 2, 3 ... months ago.

Discussion

  • I tried limiting the query using a certain date, but the page load continue to slow.
  • I'm testing the use of a temporary table for the home page to get 'Status' and 'Response time' of each resource , this table may be updated from time to time.
  • Or any suggestions to improve the loading time of the page with that amount of records.

Notification email: only receving 'Still Failing' subject on failure notices

With email notification enabled I receive only failure notice emails with Still Failing in the subject line, never any of the other two expected subject texts: Failing or Fixed. Especially when testing by dis/enabling remote OWS services or URLs I would expect all three subject lines. (Passing is by design never sent). This is at first sight quite strange as the code in notifications.py L39 is quite clear:

def notify(config, resource, run, last_run_success):
    """execute a notification"""

    status_changed = False

    this_run_success = run.success

    if last_run_success and not this_run_success:
        result = gettext('Failing')
    elif not last_run_success and this_run_success:
        result = gettext('Fixed')
    elif not last_run_success and not this_run_success:
        result = gettext('Still Failing')
    elif last_run_success and this_run_success:
        result = gettext('Passing')

    if result != gettext('Passing'):
        status_changed = True

    if not status_changed:
        return

    # send email if got here

So notify() would be called with all combinations of last and current run statuses. So why only Still Failing passing through? My theory is that there is a mismatch in Boolean and Number types as used in the combination of Sqlite3, SQLAlchemy and Python boolean, as also Passing will get through (not triggering email).

I will dive in further, maybe someone already has clues.

Dependency broken on startbootstrap-sb-admin-2

On a fresh installation, i have a 404 on paver setup when it tries to get http://github.com/IronSummitMedia/startbootstrap-sb-admin-2/archive/v1.0.3.zip

It seems that the master branch of IronSummitMedia/startbootstrap-sb-admin-2 has been completely crushed recently, so no more link for 1.0.3 version.

related issue : StartBootstrap/startbootstrap-sb-admin-2#1

Is replacing IronSummitMedia/startbootstrap-sb-admin-2 with BlackrockDigital/startbootstrap-sb-admin-2 a good workaround ?

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.