Skip to content

voltgrid/django-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-monitor

Reusable Django app that provides event monitoring via HTTP REST API.

The basic premise is that events return the response to the app via a restful HTTP API call. The app then can use that information as necessary.

Status

This is a partially completed prototype / proof-of-concept.

Example

To send a result to the app using the requests HTTP library:

import socket
import json

def notify_monitor(status, description):
    data = {'host': socket.gethostname(), 'event': 'Example Event', 'status': str(status), 'description': str(description)}
    headers = {'Content-type': 'application/json'}
    try:
        r = requests.post('%s/monitor/v1/result/' % API_HOST, data=json.dumps(data), headers=headers, auth=(API_USER, API_PASS))
        assert r.status_code == 201
    except requests.ConnectionError, e:
        print("Error: %s" % str(e))

Using curl:

curl -i --user "username:password"   \
     -H "Content-Type: application/json" \
     -X POST \
     -d '{"host": "myserver.example.com", "event": "Some Process", "status": "O", "description": "Success"}' \
     http://localhost:8000/monitor/v1/result/

About

Django event monitoring app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages