Fork me on GitHub

Лупайте сю скалу...

Іван Франко

 RSS | Atom

19 June 2015


Selected projects See all »

Banalize: Bash static code analyzerDBIx::Report::ExcelShell settings, AKA dotfilesNagios Monitoring for Couchbase serverNagira: RESTful API for NagiosStartpack for Github pages developmentWeb iPhoto

Travel Blog Витрішки »

Україномовний блог Витрішки - блог про все, крім роботи. Цикл статей "Літо на півночі Японії" з цього блогу тепер опублікований у Витрішках

Computer Blog All posts »

iPhoto and files permission Is MacOSX 10.9 == MacOS 9.x? Running Chef roles from Capistrano und Capiche Github & Jekyll: Speeding up Jekyll siteGithub & Jekyll: More experience with Jekyll and setup changesBuild new hosts with Capistrano and Chef Request Tracker: More about custom CSS for RT4Ruby 2 test drive Nagira v0.2.5 release It's UNIX my dear Watson

Slides See all »

Nagira @TLUG, 2012Rspec and Guard


Ярило Yarylo, Jarilo me @ github me @ CPAN Dmytro (CV)

Monitoring Applications with RESTful API

Summary: Reviewed several patterns for integrated monitoring with Nagios and Nagira . Nagira — RESTful API for Nagios simplifies integration of distributed Nagios systems . This is first installation of the series.

Nagios is great system. Many features in Nagios are superior to many open source and commercial monitoring system. Adding HTTP based API for Nagios opens new possibilities for simpler architectures of distributed monitoring with Nagios.

Nagira API provides access to system status, objects configuration in Nagios as well as provides an interface for submitting passive check results using the same HTTP protocol. This opens wider capabilities for monitoring system architecture modularity and integration.

Applications with HTTP RESTful API

Here I want to review one of the simplest patterns with Nagira - monitoring applications that have built-in HTTP API (RESTful API in our case). This pattern was implemented recently in new project Nagios For Couchbase. Similar approach can be adopted for any kind of application, that provides access to application metrics via HTTP API.

Nagios For Couchbase

Couchbase is advanced memory based NoSQL key-value database. It has its own management RESTful API and API for data access. The API provides access to most if not all of the Couchbase operational metrics. Couchbase also has nice web console with multiple graphs displaying server metrics in real time. Actually web user interface in Couchbase is implemented as jQuery interface built directly on top of JSON RESTful API.

Given Couchbase API combined with Nagira API, setting a monitoring system becomes a simple task. Architecture of such setup is presented on the diagram below.

System Architecture

  1. Script connects to Couchbase API and retrieves server metrics as JSON data object (via HTTP GET request)
  2. Script process data and
  3. Sends data to Nagira API (HTTP PUT)
  4. Nagira writes to Nagios external command interface
  5. Results are then processed internally by Nagios

Nagios For Couchbase Diagram

Advantages of this architecture as far as one can see are:

  • Since only HTTP protocol involved for both retrieving data and registering results, script that runs the checks, can be in any location — on Couchbase server, or on Nagios server or any other host on the network.
  • List of couchbase servers can be retrieved from Nagios configuration itself, if corresponding host-group is configured (for example 'hostgroup couchbase'). Configuration becomes completely data driven and requires no additional changes when adding/removing Couchbase servers to the pool.
  • JSON object containing multiple metrics can be read as with single HTTP GET request to Couchbase server, status for multiple checks can be updated similarly with single HTTP PUT to Nagira API, which produces multiple writes to Nagios command file. This reduces load on Nagios server, which is not dealing with scheduling and executing checks.

Executing Checks

How actually checks are performed will be reviewed in some of the following posts. Please come again!


Dmytro Kovalov (

Source code

дмитро ковальов
dmytro @ github