Skip to content

regel/loudml-plugin-http

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP plug-in for LoudML

Add webhook capabilities to LoudML to make it send HTTP notifications on anomaly detection.

Setup

./setup.py install

Coonfiguration

Define your webhook in a JSON file (e.g. my-http-hook.json):

{
    "type": "http",
    "name": "my-http-hook",
    "config": {
        "method": "POST",
        "url": "http://your/url/"
    }
}

Submit it to LoudML:

curl -X PUT -H 'Content-Type: application/json' "localhost:8077/models/<model_name>/hooks" -d @my-http-hook.json

Body format

On anomaly detection

When an anomaly is detected, LoudML will send a query with this body:

{
    "type": "anomaly_start",
    "model": <model_name>,
    "timestamp": <timestamp>,
    "score": <score>,
    "predicted": <predicted values>,
    "observed": <observed values>
}

Example:

{
    "type": "anomaly_start",
    "model": "mymodel",
    "timestamp": 1526484353.267578,
    "score": 82.0,
    "predicted": {
        "foo": 18.0,
        "bar": 5.0
    }
    "observed": {
        "foo": 26.0,
        "bar": 1.0
    },
    "anomalies": {
        "foo" {
            "score": 82.0,
            "type": "high"
        },
        "bar": {
            "score": 75.0,
            "type": "low"
        }
    }
}

When anomaly ends

When the anomaly ends, LoudML will send a query with this body:

{
    "type": "anomaly_end",
    "model": <model_name>,
    "timestamp": <timestamp>,
    "score": <score>,
}

Example:

{
    "type": "anomaly_end",
    "model": "mymodel",
    "timestamp": 1526485853.767845,
    "score": 68.0,
    "predicted": {
        "foo": 17.5,
        "bar": 5.1
    }
    "observed": {
        "foo": 17.2,
        "bar": 5.0
    }
}

About

Add webhook capabilities to LoudML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%