This document describes specifications of Nagira API: endpoints, HTTP methods and output.

Examples of the curl command and output are given in FEATURES file.

Output format

Output format is spcified by extension at the end of the HTTP request. It can be 1 of .xml, .json or .yaml. If output specifier is absent Nagira will use default configured format (see CONFIGURATION.

Top level routes

General information

API endpoints in General section do not provide Nagios information, they are used to receive from Nagira information related to Nagira application itself and Nagios instance Nagira talks to.

/ (root) endpoint

Provides general inforamtion about Nagira application, no nested routes.


/_api endpoint

Prints out available routes on the Nagira aplication. No nested subroutes.


/_runtime

Print runtime Nagira environment configuration. No nested subroutes.

Available: since Nagira version > 0.2.1


Nagios server information

Nagios inforamtion section describes methods for accessing Nagios objects and status information, as well as updating status information.

/_config

Nagios server configuration information: location of Nagios configuration files, log files, various setting usually found in main Nagios configuration file nagios.cfg.

No nested subroutes/endpoints available.


Nagios objects information

Extensions

/_objects and /_status family of routes support extensions _list, _state and _fulll and can use of both plural and singular names of resources. Specifications below show where each one of the extensions can or can not be used.

_list,_state and _full

Either _list, _state oe _full keyword can be appended to the HTTP request path at the end to modify responce as:

As for example:

Note: _list modifier changes output type of the request. /_status and /_object request can return either Hash or Array, depending on other parts of request (see below, plural vs singular) but _list request always returns Array.

Plural and singular resources

Nagira API up to version 0.2.1 used Nagios resources as nouns in singular form ('host', 'hostgroup', 'service', 'contact'), same way as they are used by Nagios. In order to support ActiveResource type of requests, use of pluralized resources has been added.

ActiveResource expects JSON output of search result in the form of Array, but Nagira provides results as Hash. So, in order to be ActiveResource compliant without breaking backward compatibility, following rule is used:

Where this is available following forms of request are supported:

/_objects

All Nagios object configurations grouped into Hash subtrees by resource type (host, service, contact, command).

List of all possible objects can be obtained from http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html.

Note Only currently configured objects are listed.


/_status

/_status/:hostname

/_status/:hostname/_services