FEATURES

Routes for configured objects in the system

Namespace for object configuration starts from "/_objects". Route may be appended by /_list to get short list of objects or object classes.

All routes can be followed by format specifier: .xml, .yaml, .json. When format specifier is omitted, default format output is used (configurable).

Following routes are implemented (all GET):

Routes to get service status information

Every route can optionally end with /_list or /_state and format specifier \.(xml|json|yaml)

Hosts

Services

Examples

Application summary

curl http://localhost:4567/
{"application":"Nagira",
 "version":"0.2.0",
 "source":"http://dmytro.github.com/nagira/",
 "apiUrl":"http://localhost:4567/_api"}

See API information

This command will print list of all implemented API endpoints. Note: this list is shortened for readability.

$ curl http://localhost:4567/_api.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <GET type="array">
    <GET>/_config</GET>
    <GET>/_objects</GET>
    <GET>/_objects/:type</GET>
    [...]
  </GET>
  <HEAD type="array">
    <HEAD>/_config</HEAD>
    <HEAD>/_objects</HEAD>
    <HEAD>/_objects/:type</HEAD>
    [...]
  </HEAD>
  <PUT type="array">
    <PUT>/_status</PUT>
    [...]
  </PUT>
</hash>

Nagios server configuration

This will retrive full configuration of Nagios process.

Same as above this is shortened list.

$ curl http://localhost:4567/_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <log-file>/var/log/nagios3/nagios.log</log-file>
  <cfg-file type="array">
    <cfg-file>/etc/nagios3/commands.cfg</cfg-file>
  </cfg-file>
  <cfg-dir type="array">
    <cfg-dir>/etc/nagios-plugins/config</cfg-dir>
    <cfg-dir>/etc/nagios3/conf.d</cfg-dir>
  </cfg-dir>
  [...]

Status information: hosts and services

    curl http://localhost:4567/_status

    curl http://localhost:4567/_status/viy/_state

    curl http://localhost:4567/_status/viy/_services/_list
    curl http://localhost:4567/_status/viy/_services/list.json

    curl http://localhost:4567/_status/viy/_services/state
    curl http://localhost:4567/_status/viy/_services/state.yaml

    curl http://localhost:4567/_status/viy/_services/SSH
    curl http://localhost:4567/_status/viy/_services/SSH/state.yaml

Objects configuration

    curl   http://localhost:4567/_objects/command
    curl   http://localhost:4567/_objects/command/_list
    curl   http://localhost:4567/_objects/command.json

    curl   http://localhost:4567/_objects/command/traffic-average
    curl   http://localhost:4567/_objects/command/traffic_average.yaml

    curl   http://localhost:4567/_objects/contact
    curl   http://localhost:4567/_objects/contact/_list
    curl   http://localhost:4567/_objects/contact/_list.yaml

    curl   http://localhost:4567/_objects/host/_list.yaml
    curl   http://localhost:4567/_objects/host/viy

More examples

Some examples are included with the distribution in the ./test/data/json directory. This directory have examples of JSON files for HTTP PUT's and sample curl script to be used with JSON files. See also README.txt file in this directory.