0.2.1 • Published 10 years ago
defcon-rest-gateway v0.2.1
DEFCON REST Gateway Plugin
Prerequisits
Installation
- '''cd $DEFCON_INSTALL_DIR'''
- '''npm install defcon-rest-gateway'''
- '''Enable and configure 'defcon-rest-gateway' in your DEFCON configuration file, e.g. '''json { "plugins": { "installed": "defcon-rest-gateway" } } '''
- Restart defcon (you can do this via '''kill -s USRSIG2 ''' if you want zero downtime)
Usage
Notifying DEFCON of events via the REST Gateway Plugin requires you to POST a json object to http://:/plugin/rest-gateway/api/v1/event. The json object should be as follows
{
"system": "entertainment-portal",
"group": "www", // optional
"type": "error",
"environment": "production", // optional
"host": "192.168.1.100", // defaults to 'x-forwarded-for' header or remote address
"message": "Gateway timeout 504", // optional
"severity": "1", // 1-5, defaults to 1
"link": "http://www.entertainment-portal.com" // optional
}"
Testing from the command line
curl -i -X POST localhost:8080/plugin/defcon-rest-gateway/api/v1/event -H "Content-Type: application/json" -d "{\"system\": \"entertainment-portal\", \"group\": \"www\", \"type\": \"error\", \"environment\": \"production\", \"message\": \"Gateway timeout 504\", \"severity\": \"3\", \"link\": \"http://www.entertainment-portal.com\" }"