{% extends "template.html" %}
{% block title %}Index{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
Livestatus-service exposes the functionality of a livestatus socket to the outside world over HTTP.
GET /query?q=QUERY
Will perform a query using QUERY.
/query?q=GET%20hosts
If you need newlines, e.G. to add a filter, use \n.
GET /cmd?q=COMMAND
POST /cmd {q: COMMAND}
Will perform a command using COMMAND.
The COMMAND [%s] directive will be inserted for you.
By default you will receive a list of dictionaries, where each dictionary represent a row.
Query host_name and notifications_enabled
This yields
[{
"notifications_enabled": "0",
"host_name": "devica01"
}, {
"notifications_enabled": "1",
"host_name": "tuvdbs05"
}, {
"notifications_enabled": "1",
"host_name": "tuvdbs06"
}, {
"notifications_enabled": "1",
"host_name": "tuvdbs50"
}, {
"notifications_enabled": "1",
"host_name": "tuvmpc01"
}, {
"notifications_enabled": "1",
"host_name": "tuvmpc02"
}, {
"notifications_enabled": "1",
"host_name": "tuvrep01"
}]
If you specify the key parameter, this column name will be used as a unique index for the rows and you will have a dictionary of dictionaries instead.
Query host_name and notifications_enabled with host_name as key
This yields
{
"devica01": {
"notifications_enabled": "0",
"host_name": "devica01"
},
"tuvrep01": {
"notifications_enabled": "1",
"host_name": "tuvrep01"
},
"tuvdbs06": {
"notifications_enabled": "1",
"host_name": "tuvdbs06"
},
"tuvdbs05": {
"notifications_enabled": "1",
"host_name": "tuvdbs05"
},
"tuvdbs50": {
"notifications_enabled": "1",
"host_name": "tuvdbs50"
},
"tuvmpc01": {
"notifications_enabled": "1",
"host_name": "tuvmpc01"
},
"tuvmpc02": {
"notifications_enabled": "1",
"host_name": "tuvmpc02"
}
}
You can specify the handler argument to use a custom handler.
Enable host notifications using the icinga handler
| Handler | Effect |
|---|---|
| livestatus (default) | Uses the livestatus UNIX socket |
| icinga | Uses the configured icinga command file (commands only) |