[UPDATE] NagIncidents

Now you find my Nagios Incidents Viewer written in PHP at NagiosForge
My project allows anonymous checkouts of the source code. Use one of the commands below and use 'anonymous' as the username and a blank password to checkout the code for NagIncidents Version 0.5 stable (tags) or Version 0.9.2 beta (branches).

svn checkout https://www.nagiosforge.org/svn/nagincidents/tags/nagincidents-0.5

svn checkout https://www.nagiosforge.org/svn/nagincidents/branches/nagincidents-0.9.2

Feel free to test the actual beta (not tested in productiv environments yet).
For all who already did download NagIncidents Version 0.9.1 beta:
It is strongly recommended to update to NagIncidents Version 0.9.2 beta because of a bug.
(In some situations it could happen that a service was shown in an area of a host which it not depends on)

NagIncidents Screenshot
screenshot of: NagIncidents 0.5 stable

NagIncidents 0.9.1 Screenshot
screenshot of: NagIncidents 0.9.1 beta

Here you can download the tar.gz-file of  NagIncidents 0.9.2 beta  for tests only.
This version makes it possible to filter for a few different state types.
For example to show unhandled incidents only - not acknowledged and not in scheduled downtime.
(take a look at the backend configuration file cfg/config.php: $state_filter_*).

- last update: 2009/05/15 01:40 -

[NEW] rab_nagincidents - a Typo3 Extension for the "NETWAYSPortal for Nagios"

Here I publish the Typo3-Extension rab_nagincidents V0.9.0 for the NETWAYSPortal for Nagios for Beta-Tester:
Right click on the link below and use "save as" to download the T3X file of rab_nagincidents.

rab_nagincidents Version 0.9.0 (first published version - for Beta-Tests only)

rab_nagincidents Screenshot

Requirements:

- Nagios with NDO up and running
- A preconfigured NETWAYSPortal for Nagios (SitePackage at NagiosForge)


Configuration:

At the page TSconfig (Typo3 Backend) you have to add/edit this configuration for the rab_nagincidents Extension:

[TSconfig code start]
tx_rabnagincidents {
     sound_default_enabled = 0

     host_tooltip_enabled = 1
     host_tooltip_activation = mouse_over
     host_tooltip_uri = ../tools/hostinfo.php?hostname=
     host_tooltip_width = 350

     hostgroup_filter_enabled = 1
     hostgroup_filter_groupname = HOSTGROUPNAME
}

[TSconfig code end]

Description:

sound_default_enabled =
Here you define if sound should be enabled by default > every time you show the incidents (0=off, 1=on).
Every user can enable/disable the sound by a click on the sound button at the right top of the incidents "frame".
If the sound is enabled it plays the nagios critical sound at every start/refresh (auto refresh every 60 seconds) of the
extension if there are incidents which are not acknowledged or not in scheduled downtime (so, if there are new incidents).

host_tooltip_enabled =
Here you define if the JavaScript tooltip (jQuery Cluetip) should be enabled by default (0=off, 1=on).
For example you can use it to show the output of your own php site which have to be integrated on the same webserver.
If you already have simple Info Sites which urls ends by the host name and these are on external server take a look at my hints.
I use it to show host details which are selected from an inventory database.

rab_nagincidents Tooltip Screenshot

host_tooltip_activation =
There are three ways you can activate and use the tooltip: basic, mouse_over and mouse_click.
basic : open the tooltip while you move the mouse over a host name and close it when you leave the host name.
mouse_over : open the tooltip while you move the mouse over a host name.
             You have to use the link "close" at the title of the tooltip to close it.
mouse_click : to open the tooltip you have to click on a host name.
             You have to use the link "close" at the title of the tooltip to close it.

host_tooltip_uri =
Here you define the path to your site (which output should be shown by the tooltip) relatively to the portal site.
The Extension rab_nagincidents automaticaly adds the host name at the end of the defined uri.

host_tooltip_width =
Here you define the width of the tooltip in pixel.

hostgroup_filter_enabled =
Here you define if you want to activate the hostgroup filter by default (0=off, 1=on).
If this feature is enabled you only see the the incidents of the hosts of the defined hostgroup.

hostgroup_filter_groupname =
Here you define a hostgroup name which you want the incidents should be filterd by.

Further more you have to edit the page TSconfig of the net_dbdata Extension which is included in the sidePackage of the Portal:

[TSconfig code start]
tx_netdbdata.templates.db {

     ndo_db {
          host = localhost
          name = ndodb
          ndoprefix = nagios_
          user = dbadm
          pass = secret
          type = pdo_mysql
          persistent = 1
     }

}

[TSconfig code end]

As shown above you have to add the prefix you use for your ndo tables - Example: ndoprefix = nagios_

Hints:

If you want to use the tooltip you normally have to add the relative path of your active website at the TSconfig like shown above.
But with a little trick it is also possible to include external websites into the tooltip.
You just have to create a site with an iframe and in this iframe you show the external website.
All you have to do then, is to set the relative path to the "iframe-site" to the TSconfig.
Here is a little example i tested to check this out:

[iframe.php code start]
<?php
$iframeHeight = $_GET["ifh"];
$iframeWidth = $_GET["ifw"];
$iframeBorder = $_GET["ifb"];
$iframeScrolling = $_GET["ifs"];
$hostName = $_GET["hostname"];

$iframeParam = 'height="' . $iframeHeight . '" width="' . $iframeWidth . '" frameborder="' . $iframeBorder . '" ';
$iframeParam .= 'src="http://www.external-sites.wan/hostinfo.php?hostname=' .$hostName . '" scrolling="' . $iframeScrolling . '"';

echo '<html>';
echo '<head>';
echo '<title>' . $hostName . '</title>';
echo '</head>';
echo '<body>';
echo '<iframe ' . $iframeParam . '>';
echo ' <a href="http://www.external-sites.wan/hostinfo.php?hostname=' .$hostName . '">' . $hostName . '</a>';
echo '</iframe>';
echo '</body>';
echo '</html>';
?>

[iframe.php code end]

This example is based on the assumption that the external website is at the following url:
http://www.external-sites.wan/hostinfo.php
And this page generates its content for each host if you define the 'hostname'

Further more you need to define the uri to iframe.php like this:
host_tooltip_uri = ../iframe.php?ifh=100&ifw=330&ifb=1&ifs=no&hostname=

Description of the host_tooltip_uri:

../iframe.php
This is the relative path to iframe.php

ifh=100
Here you define the height of the iframe in the tooltip.

ifw=330
Here you define the with of the iframe in the tooltip
(shoud be less then the value for host_tooltip_width).

ifb=1
Here you define if the border of the iframe should be visible (0=no ; 1=yes).

ifs=no
Here you define if the content of the iframe should be scrollable.
(possible values yes, no or auto).

hostname=
As told before, the extension rab_nagincidents automtically adds the hostname to the uri.
So you should add something like this to inform the target of the hostname.

By using this example your tooltip could look like this:
Example iframe Tooltip Screenshot

With iframe you are able to use interactive web sites in your tooltip.
So it is a little bit like a browser in your browser.
But(!): Remeber, the tooltip will be closed at every refresh of the extension rab_nagincidents.

- last update: 2008/09/17 15:45 -

[NEW] Nagios Plugin check_inivalue.pl

If you have to verify a value in an ini foramted file, feel free to try check_inivalue.pl (actual version 0.2.3 for tests only)
With check_inivalue.pl you can verify the value for a defined key in a defined section of an ini file.
If the value is a number (float) it is possible to get performance data with a label defined by you.

This Plugin comes AS IS with ABSOLUTELY NO WARRANTY! You may redistribute copies of the plugin under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Usage: $PROGNAME [-i infile] [-s section] [-k key] [-o OK_Value] [-w or -W WARNING_Value] [-c or -C CRTICAL_Value ] [-l LABEL]

Options:

-i --infile STRING
    Path and file name to the ini/config file.
-s --section STRING
    String to identify the ini/config Section.
-k --key STRING
    String to identify the key of the value.
-o --ok STRING
    Value for OK.
-w --warning STRING
    Value for WARNING.
-c --critical STRING
    Value for CRITICAL.
-W --WarnFloat FLOAT
    Threshold for WARNING.
-C --CritFloat FLOAT
    Threshold for CRITICAL.
-l --label STRING
    String for label the performance data.
-h --help
    Using this option to show this help info.

Attention:

-i, -s and -k are necessary!

The options -o and/or -w and/or -c are necessary if you want to check for a string value.
If only -w or -c are defined all other values end in OK State.
If -o and/or -w are defined (not -c) all values other then in this defined options end in CRITICAL State.
If -o and -c are defined (not -w) all values other then in this defined options end in WARNING State.
If -o and -w and -c are defined all values other then in this defined options end in UNKNOWN State.
(While checking for a string the options --WarnFloat and --CritFloat will be ignored)!

The options -W and/or -C are necessary if you want to check for a float value.
If only -W is defined, all values higher or equal will end in WARNING State.
If only -C is defined, all values higher or equal will end in CRITICAL State.
If -W and -C are defined and the value is between, it end in WARNING State.
If the option for -W is higher then for -C :
A value higher then the option defined by -W end in OK State.
Is the value less or equal the option defined by -C it end in CRITICAL State.
(Do not use -o, -w and/or -c if you want to check for float values)!


[Command Definition Examples - start]

# 'check_inivalue_string' command definition
define command{
    command_name    check_inivalue_string
    command_line    /usr/lib/nagios/plugins/custom/check_inivalue.pl -i $ARG1$ -s $ARG2$ -k $ARG3$ -o $ARG4$ -w $ARG5$
    }

# 'check_inivalue_float' command definition
define command{
    command_name    check_inivalue_float
    command_line    /usr/lib/nagios/plugins/custom/check_inivalue.pl -i $ARG1$ -s $ARG2$ -k $ARG3$ -W $ARG4$ -C $ARG5$ -l $ARG6$
    }
[Command Definition Examples - end]

[Service Check Definition Examples - start]
# 'Ini Value String' service check definition
define service{
    use    local-service
    host_name    localhost
    service_description    Ini Value String
    check_command    check_inivalue_string!/data/example.ini!Server-01!Cluster!Primary!Secondary
    }

# 'Ini Value Float' service check definition
define service{
    use    local-service
    host_name    localhost
    service_description    Ini Value Float
    check_command    check_inivalue_float!/data/example.ini!Server-02!Temp!28.5!33.5!Temperature
    }
[Service Check Definition Examples - end]

[INI File Example - start]
[Server-01]
Cluster=Secondary

[Server-02]
Temp=34.7
[INI File Example - end]

[check_inivalue.pl Output Example - start]
WARNING: Cluster=Secondary

CRITICAL: Temp=34.7|Temperature=34.7;28.5;33.5;;
[check_inivalue.pl Output - end]

---
Feel free to test the actual version 0.2.3 (not used in productiv environments yet).

- last update: 2009/06/28 23:43 -