{% extends "template.html" %} {% block title %}Index{% endblock %} {% block head %} {{ super() }} {% endblock %} {% block content %} Fork me on GitHub

Livestatus-service

Livestatus-service exposes the functionality of a livestatus socket to the outside world over HTTP.

Performing queries

Basics

GET /query?q=QUERY

Will perform a query using QUERY.
Example : /query?q=GET%20hosts

If you need newlines, e.G. to add a filter, use \n.
Example : query notifications_enabled for host devica01.

See the LQL documentation for more information.

Pretty query results

Default output format

By default you will receive a list of dictionaries, where each dictionary represent a row. Example : host_name and notifications_enabled
The example 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"
            }]
          

Custom output format

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.
Example : host_name and notifications_enabled with host_name as key
The example 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"
                }
            }
          

Performing commands

The command endpoint

GET /cmd?q=COMMAND

Will perform a command using COMMAND.
The COMMAND [%s] directive will be inserted for you.
Example : /cmd?q=ENABLE_HOST_NOTIFICATIONS;devica01

Refer to the list of external commands for more information.

Using another command handler

You can specify the handler argument to use a custom handler.
Example: enable host notifications using the icinga handler

Currently implemented handlers

Handler Effect
livestatus (default)  Uses the livestatus UNIX socket
icinga Uses the configured icinga command file (commands only)

{% endblock %} {% block footer %}
{{ super() }}
{% endblock %}