Patch for execute and try an Checkcommand from Service

User / Community contributed content: modifications, patches, extensions, modules, scripts etc.
Joined:Tue Mar 26, 2013 12:38
Patch for execute and try an Checkcommand from Service

Post by benjaminleibinger » Wed Mar 27, 2013 16:11


a few weeks ago i did the migration from Nagios with the free Groundwork version to the latest Icinga and NConf 1.3.0.

Our current Setup:
Ubuntu 12.04.2
Icinga 1.8.4
Nconf 1.3.0

We monitor around ~600 Hosts and ~10.000 Services.

Nconf has lots of features and its working great for us so far. BUT after the first week using NConf there was one feature missing which we know and love from Groundwork. The option to try a service and his check command with all the params which would be executed from Icinga / Nagios.

So i decided to write a patch for it. The patch is written and tested for NConf Version 1.3.0. But it also should work on Nagios systems ;)

So what can you do with it?

it creates a textarea on the detailspage from a service with the current config from the service and the command definition which would be executed on a check from the service.
You can also change the params in the command line before you execute it. So you get the possibility to try your params for the service.
After execution it creates a new textarea with the command result.

The patch replaces on execution all the Macros in your command which you wrote in the resource.cfg AND replaces the $ARG 1-n $ variables in the command with the params.

Your command looks like:

Code: Select all

$USER1$/check_load -w "$ARG1$" -c "$ARG2$"
Your service parameter looks like:
nconf_checkcommand_service_params.JPG (20.74KiB)Viewed 4231 times
nconf_checkcommand_patch_textarea_executed.JPG (32.26KiB)Viewed 4231 times
Please be carefull and create a backup from your files!

I created a patchfile that you can apply on the detail.php file. You also have to add a line to your configuration file.

1. Download:
The Patchfile as zip
(2.17KiB)Downloaded 425 times
2. Add the following to the end of your nconf main configuration file config/nconf.php:

Code: Select all

# The path to the resourcefile for macros.
define('USERMACROSFILE', '/usr/local/icinga/etc/resource.cfg');
(Change the path to your resource.cfg)

3. Put the patchfile to your nconf dir and execute:

Code: Select all

patch -p1 detail.php detail.patch.php
3. Have fun.

There are maybe better solutions to solve this feature but for my current knowing about nconf its the best i think.

If you found some Bugs please let me know.
If you have some more cool ideas let me also know!