The work on the new version 0.6.x is in full progress.
</p>
<p>
Starting with version 0.6.x we switch from subversion to GIT. The <ahref="http://pnp4nagios.git.sourceforge.net"class="urlextern"title="http://pnp4nagios.git.sourceforge.net"rel="nofollow">sourcecode</a> is already available on sourceforge.
</p>
<p>
<strong>Functions implemented already</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Webfrontend based on <ahref="http://www.kohanaphp.com"class="urlextern"title="http://www.kohanaphp.com"rel="nofollow">Kohana</a></div>
</li>
<liclass="level1"><divclass="li"> Webfrontend based on <ahref="http://jqueryui.com/themeroller/"class="urlextern"title="http://jqueryui.com/themeroller/"rel="nofollow">jQuery Themes</a></div>
</li>
<liclass="level1"><divclass="li"> Javascript-functions using <ahref="http://jquery.com/"class="urlextern"title="http://jquery.com/"rel="nofollow">jQuery</a> plugins </div>
</li>
<liclass="level1"><divclass="li"> process_perfdata.pl will be able to use one RRD database per datasource</div>
</li>
<liclass="level1"><divclass="li"> improved installer. Specification of directory layouts using --with-layout</div>
</li>
<liclass="level1"><divclass="li"> RRDtool errors are now displayed as images. no more missing images</div>
<liclass="level1"><divclass="li"> Export from RRD databases into <acronymtitle="Extensible Markup Language">XML</acronym>, CSV and JSON format using the RRDtool “xport” function</div>
PNP mandatory requires valid performance data of nagios plugins.
</p>
<p>
So what is this performance data?
</p>
<p>
The output of a nagios plugin up to nagios 2.x is limited to one line. When the plugin produces performance data, it is divided into two parts. The pipe symbol (“|”) is used as a delimiter.
</p>
<p>
<strong>Example check_icmp :</strong>
</p>
<preclass="code"> OK - 127.0.0.1: rta 2.687ms, lost 0% | rta=2.687ms;3000.000;5000.000;0; pl=0%;80;100;;</pre>
<p>
resulting in the text on the left side of the pipe symbol
</p>
<preclass="code"> OK - 127.0.0.1: rta 2.687ms, lost 0%</pre>
Performance data is designed for automatic processing. The format is specified within the <ahref="https://www.monitoring-plugins.org/doc/guidelines.html#AEN200"class="urlextern"title="https://www.monitoring-plugins.org/doc/guidelines.html#AEN200"rel="nofollow">Developer Guidelines</a> (you'll find an excerpt <ahref="/pnp-0.6/perfdata_format"class="wikilink1"title="pnp-0.6:perfdata_format">here</a>) but should be exemplified here nonetheless:
|----|---------|-----|-|----- unit ( UOM = UNIT of Measurement )
|---------|-----|-|----- warning threshold
|-----|-|----- critical threshold
|-|----- minimum value
|----- maximum value
</pre>
<p>
Value marked with * are mandatory. All other values are optional.
</p>
<p>
Several data series are separated by blanks. The actual data must not contains any blanks. If the label contains blanks, it has to be surrounded by single quotes.
<liclass="level1"><divclass="li"><acronymtitle="Practical Extraction and Report Language">Perl</acronym>>= 5.x without additional modules</div>
</li>
<liclass="level1"><divclass="li"> RRDtool >= 1.x, better 1.2 but not compulsory<br/>
Attention: installing RRDtool without a packet manager might lead to missing dejavu fonts. If you see graphs without text then this may be the cause.</div>
</li>
<liclass="level1"><divclass="li"><acronymtitle="Hypertext Preprocessor">PHP</acronym>>= 5.1.6 for the Webfrontend based on <ahref="http://www.kohanaphp.com"class="urlextern"title="http://www.kohanaphp.com"rel="nofollow">Kohana</a></div>
</li>
<liclass="level1"><divclass="li"> Nagios >= 2.x or Icinga </div>
</li>
<liclass="level1"><divclass="li"> Kohana needs the module “mod_rewrite” to be enabled. For details please have a look at the documentation of your web-server specific to your distribution.</div>
</li>
</ul>
</div>
<h2><aname="license"id="license">License</a></h2>
<divclass="level2">
<p>
PNP is licensed under <ahref="http://www.gnu.org/licenses/gpl-2.0.txt"class="urlextern"title="http://www.gnu.org/licenses/gpl-2.0.txt"rel="nofollow">GPL 2</a>
Development of PNP is organized using <ahref="http://sourceforge.net/projects/pnp4nagios"class="urlextern"title="http://sourceforge.net/projects/pnp4nagios"rel="nofollow">Sourceforge.Net</a>. PNP is registered under “PNP4nagios”.
</p>
<p>
The current stable version of 0.6.x can be found in the download area: <ahref="http://sourceforge.net/project/showfiles.php?group_id=191615"class="urlextern"title="http://sourceforge.net/project/showfiles.php?group_id=191615"rel="nofollow">Sourceforge Download</a>
</p>
<p>
Starting with PNP 0.6.x the source code repository was switched from SVN to GIT.
</p>
<p>
The current development can be viewed anytime at <ahref="https://github.com/lingej/pnp4nagios"class="urlextern"title="https://github.com/lingej/pnp4nagios"rel="nofollow">https://github.com/lingej/pnp4nagios</a>. Clicking on <ahref="http://docs.pnp4nagios.org/_media/dwnld/pnp4nagios-head.tar.gz"class="urlextern"title="http://docs.pnp4nagios.org/_media/dwnld/pnp4nagios-head.tar.gz"rel="nofollow"> pnp4nagios-head.tar.gz</a> will download an archive containing the latest version.
<br/>
</p>
</div>
<h2><aname="support"id="support">Support</a></h2>
<divclass="level2">
<p>
PRIOR to support questions please make sure that you have verified certain things described under <ahref="/pnp-0.6/verify"class="wikilink1"title="pnp-0.6:verify">verify your installation</a>.<br/>
The developers and helpers are present on a separate board at <ahref="http://www.monitoring-portal.org"class="urlextern"title="http://www.monitoring-portal.org"rel="nofollow">http://www.monitoring-portal.org</a> and will be informed about new postings in the PNP-section. Postings in english will be answered as well.<br/>
After registering as a user <strong>please fill in the profile regarding operating system and PNP version used. Please mention if you used a package or compiled the sources.</strong>
Please mark successfully solved threads by adding ”[solved]” to the title as it helps other users to find a solution for their problem.
</p>
<p>
The mailing lists on Sourceforge can be used to request support (and are limited to english):
</p>
<p>
<ahref="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-users"class="urlextern"title="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-users"rel="nofollow">pnp4nagios-users</a>: users list for general questions regarding configuration. Please state your operating system and PNP version
</p>
<p>
<ahref="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-devel"class="urlextern"title="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-devel"rel="nofollow">pnp4nagios-devel</a>: devel list for suggestions and error reports. Please state your operating system and PNP version
</p>
<p>
<ahref="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-checkins"class="urlextern"title="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-checkins"rel="nofollow">pnp4nagios-checkins</a>: the checkin list automatically contains changes to the SVN repository
</p>
</div>
<h2><aname="storage"id="storage">Storage</a></h2>
<divclass="level2">
<p>
Performance data will be stored in Round Robin Databases using <ahref="http://www.rrdtool.org"class="urlextern"title="http://www.rrdtool.org"rel="nofollow">RRDtool</a>. That means that after some time the oldest data will be dropped at the “end” and it will be replaced by new values “at the beginning”.
</p>
<p>
Various intervals provide for different resolutions. Using the defaults allows to store the data with a resolution of one minute for the last two days, five minutes resolution for ten days, 30 minutes resolution for 90 days and 6 hours resolution for four years. The increasing interval causes averaging of the data which leads to smaller max values. This not an error of PNP.
</p>
<p>
Using this storage format the size of the files will stay the same over time. Per datasource you will need approx. 400 KB.
</p>
</div>
<h2><aname="statistics_and_links_to_sourceforge"id="statistics_and_links_to_sourceforge">Statistics and links to Sourceforge</a></h2>
<divclass="level2">
<ulclass="rss"><li><divclass="li"><em>An error occurred while fetching this feed: </em><ahref="http://sourceforge.net/export/rss2_projsummary.php?group_id=191615"class="urlextern"title="http://sourceforge.net/export/rss2_projsummary.php?group_id=191615"rel="nofollow">http://sourceforge.net/export/rss2_projsummary.php?group_id=191615</a></div></li></ul>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/modes"class="wikilink1"title="pnp-0.6:modes">PNP modes</a>
<h1><aname="the_art_of_collecting_data"id="the_art_of_collecting_data"href="/pnp-0.6/modes"title="The art of collecting data">The art of collecting data</a></h1>
<divclass="level1">
<p>
PNP supports several modes to process performance data. The modes differ in complexity and the performance to be expected.
</p>
<p>
The following image shows the connections between Nagios, PNP and RRDtool<br/>
</p>
<p>
Nagios invokes a command for every host and every service whose performance data should be processed. Depending on the mode you choose the data will be passed to process_perfdata.pl or will be written to temporary files and processed at a later time. process_perfdata.pl writes the data to <acronymtitle="Extensible Markup Language">XML</acronym> files and stores them in RRD files using RRDtool.<br/>
</p>
<p>
Before you choose a mode please read the documentation and decide which way will be the best for installation.
</p>
</div>
<h1><aname="the_modes_in_comparison"id="the_modes_in_comparison">The modes in comparison</a></h1>
<ahref="/_detail/synchronous.png?id=pnp-0.6%3Adoc_complete"class="media"title="synchronous.png"><imgsrc="/_media/synchronous.png?w=150"class="medialeft"align="left"alt=""width="150"/></a>The “synchronous mode” is the simplest and easiest to set up. Nagios will call the perl script <code>process_perfdata.pl</code> for every service and host, respectively, to process the data. The synchronous mode will work very good up to about 1.000 services in a 5 minute interval.
<ahref="/_detail/bulk.png?id=pnp-0.6%3Adoc_complete"class="media"title="bulk.png"><imgsrc="/_media/bulk.png?w=150"class="medialeft"align="left"alt=""width="150"/></a>In bulk mode Nagios writes the necessary data to a temporary file. After expiration of a defined time the file will be processed in one piece and deleted afterwards.
</p>
<p>
The number of calls of process_perfdata.pl will be reduced to a fraction. Depending on time and the amount of collected data there will be much less system calls. Instead, process_perfdata.pl will run longer.
</p>
<p>
<strong>Note</strong>
Using this mode you should keep an eye on the runtime of process_perfdata.pl. While it is running to process data nagios will not execute any checks.
71 lines were processed in 0.06 seconds. This will be the data volume of about 2000 services und processing using a 10 second interval. It means we blocked nagios for exactly 0.06 seconds.
</p>
</div>
<h2><aname="bulk_mode_with_npcd"id="bulk_mode_with_npcd">Bulk Mode with NPCD</a></h2>
<divclass="level2">
<p>
<ahref="/_detail/bulk-npcd.png?id=pnp-0.6%3Adoc_complete"class="media"title="bulk-npcd.png"><imgsrc="/_media/bulk-npcd.png?w=150"class="medialeft"align="left"alt=""width="150"/></a>Viewing from Nagios this is the best way of processing because Nagios will not be blocked.
</p>
<p>
Nagios again uses a temporary file to store the data and executes a command after expiration of a certain time. Instead of immediate processing by process_perfdata.pl the file is moved to a spool directory. As moving a file inside the same filesystem nearly takes no time nagios is able to execute crucial work immediately.
</p>
<p>
The NPCD daemon (Nagios Performance C Daemon) will monitor the directory for new files and will pass the names to process_perfdata.pl. Processing of performance data is decoupled completely from nagios. NPCD itself is able to start multiple thread for processing the data.
</p>
</div>
<h2><aname="bulk_mode_with_npcdmod"id="bulk_mode_with_npcdmod">Bulk Mode with npcdmod</a></h2>
<divclass="level2">
<p>
<strong>Attention</strong>
<em>Starting with Nagios 4 the internal structures have changed so the start of the module will fail. So far there are no plans to support Nagios 4. Please select any other of the modes.</em>
</p>
<p>
<ahref="/_detail/bulk-npcdmod.png?id=pnp-0.6%3Adoc_complete"class="media"title="bulk-npcdmod.png"><imgsrc="/_media/bulk-npcdmod.png?w=150"class="medialeft"align="left"alt=""width="150"/></a> This scenario includes npcdmod.o, an NEB-module.
This module reduces the configuration of the “Bulk Mode with NPCD” to a mere two lines in nagios.cfg
</p>
<p>
This mode is similar to “Bulk Mode with NPCD” and it is exactly the same functionality and the same performance.
Since version 0.6.12 PNP4Nagios can be driven as a gearman worker. This way large Nagios environments are possible using mod_gearman. Nagios and PNP4Nagios can be run on different machines.
</p>
<p>
You need a mod_gearman environment up and running like described by Sven Nierlein on <ahref="http://labs.consol.de/lang/en/nagios/mod-gearman/"class="urlextern"title="http://labs.consol.de/lang/en/nagios/mod-gearman/"rel="nofollow">http://labs.consol.de/lang/en/nagios/mod-gearman/</a>.
Which mode you choose will depend on the size of your Nagios installation. You will find theses terms throughout the documentation.
</p>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/install"class="wikilink1"title="pnp-0.6:install">installation</a>
Changes can be tracked on <ahref="http://pnp4nagios.git.sourceforge.net/git/gitweb.cgi?p=pnp4nagios/pnp4nagios"class="urlextern"title="http://pnp4nagios.git.sourceforge.net/git/gitweb.cgi?p=pnp4nagios/pnp4nagios"rel="nofollow">pnp4nagios.git.sourceforge.net</a>
The current Version is <ahref="https://sourceforge.net/projects/pnp4nagios/files/latest"class="urlextern"title="https://sourceforge.net/projects/pnp4nagios/files/latest"rel="nofollow"> pnp4nagios-0.6.25.tar.gz</a>
<liclass="level1"><divclass="li"> Bugfix: Fixed <acronymtitle="Hypertext Preprocessor">PHP</acronym> issue while running on <acronymtitle="Hypertext Preprocessor">PHP</acronym> 5.6 ( Reported by Sven Nierlein )</div>
<liclass="level1"><divclass="li"> Feature: Add “version=tiny” to got get a stripped down version of graph ( Ricardo Bartels )</div>
</li>
<liclass="level1"><divclass="li"> feature: Add STDIN Mode to process_perfdata.pl ( Robert Steininger )</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: XSS issue fixed by Mikael Falkvidd. This issue was detected by Peter Österberg at Hexbit AB in a security assessment of op5 Monitor 6.3 on assignment by op5 AB. </div>
</li>
</ul>
<p>
<strong>pnp-0.6.21 03/24/2013</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: Helper functions rrd::alerter and rrd:alerter_gr both supports treshold detection (Martin Schirrmacher)</div>
</li>
<liclass="level1"><divclass="li"> Update: jQuery Mobile update to 1.3.0 ( was broken in 0.6.20 ) </div>
</li>
</ul>
<p>
<strong>pnp-0.6.20 03/03/2013</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: Support check_mk Multisite Cookie Auth ( Lars Michelsen )</div>
</li>
<liclass="level1"><divclass="li"> Feature: Allow RRD unknown values ( Simon Meggle )</div>
</li>
<liclass="level1"><divclass="li"> feature: Interactive delete mode added to check_rrds.pl ( Simon Meggle ) </div>
<liclass="level1"><divclass="li"> Feature: New helper function rrd::debug()</div>
</li>
<liclass="level1"><divclass="li"> Feature: New templates check_jmx4perl_*.php</div>
</li>
</ul>
<p>
<strong>pnp-0.6.17 03/25/2012</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Bugfix: Fixed rrd_convert.pl while running with --dry-run</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: logging.c include missing header files ( Lars Vogdt ) </div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Check if pnp4nagios/etc/rra.cfg is readable</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: rrd_convert.pl use <acronymtitle="Extensible Markup Language">XML</acronym> tag TEMPLATE instead of CHECKCOMMAND to selects RRDs ( Sven Velt )</div>
<liclass="level1"><divclass="li"> Feature: <acronymtitle="Portable Document Format">PDF</acronym> margins are now adjustable via config.php ( Thomas Witzenrath )</div>
</li>
<liclass="level1"><divclass="li"> Feature: Support for <acronymtitle="Portable Document Format">PDF</acronym> size 'letter' added ( Robert Becht )</div>
</li>
</ul>
<p>
<strong>pnp-0.6.15 09/15/2011</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Bugfix: Fixed Overview link (reported by Stefan Triep)</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Fixed zoom popup (reported by Rudolf Labuschagne)</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Fixed double urlencode() (reported by Mathias Kettner)</div>
</li>
<liclass="level1"><divclass="li"> Feature: “Clear basket” button added (suggested by Stefan Triep) </div>
</li>
<liclass="level1"><divclass="li"> Feature: New helper function “rrd::alerter_gr()” ( committed by Stefan Trip )</div>
</li>
</ul>
<p>
<strong>pnp-0.6.14 08/05/2011</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: Webinterface for mobile devices based on jQuery Mobile <br/>
<liclass="level1"><divclass="li"> Info: Version used by OMD-0.48 <ahref="http://omdistro.org"class="urlextern"title="http://omdistro.org"rel="nofollow">OMD</a></div>
</li>
</ul>
<p>
<strong>pnp-0.6.12 04/22/2011</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: mod_gearman support added</div>
</li>
<liclass="level1"><divclass="li"> Feature: rrd_convert.pl is now able to convert all RRDs from RRD_STORAGE_TYPE=SINGLE to RRD_STORAGE_TYPE=MULTIPLE</div>
</li>
<liclass="level1"><divclass="li"> Feature: New template check_gearman.php</div>
</li>
<liclass="level1"><divclass="li"> Feature: Install process_perfdata.cfg and npcd.cfg by default</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: rrd_convert.pl is now able to parse xml dumps created by rrdtool 1.4.x </div>
</li>
<liclass="level1"><divclass="li"> Bugfix: process_perfdata.pl default timeout value set to 15 seconds</div>
<liclass="level1"><divclass="li"> Bugfix: Zoom in/out is working again ( Reported by Thorben Soehl )</div>
</li>
<liclass="level1"><divclass="li"> Featue: npcd.cfg - New option perfdata_file_processing_interval used by npcdmod</div>
</li>
<liclass="level1"><divclass="li"> Info: Version used by OMD-0.46 <ahref="http://omdistro.org"class="urlextern"title="http://omdistro.org"rel="nofollow">OMD</a></div>
</li>
</ul>
<p>
<strong>pnp-0.6.10 12/15/2010</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: Add RRDTool Option --only-graph if graph height is below 32px to create thumbnails </div>
</li>
<liclass="level1"><divclass="li"> Feature: RRDTool Option --width and --height is now allowed in templates</div>
</li>
<liclass="level1"><divclass="li"> Feature: RRDTool DS Type for UOM of “c” changed from COUNTER to DERIVE </div>
</li>
<liclass="level1"><divclass="li"> Feature: Pass query string from special controller to image controller ( Matthew Garrett ) </div>
</li>
<liclass="level1"><divclass="li"> Feature: Authorisation against <ahref="http://mathias-kettner.de/checkmk_livestatus.html"class="urlextern"title="http://mathias-kettner.de/checkmk_livestatus.html"rel="nofollow">mk_livestatus</a><acronymtitle="Application Programming Interface">API</acronym> added</div>
<liclass="level1"><divclass="li"> Feature: Kohana backport to support <acronymtitle="Hypertext Preprocessor">PHP</acronym> 5.1.6 ( Kudos to Andreas Ericsson )</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Sort list of special templates</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Urlencode hostname and service description ( Reported by Yannick ) </div>
</li>
<liclass="level1"><divclass="li"> Bugfix: corrected warning/critical thresholds in ticker/alerter functions</div>
<liclass="level1"><divclass="li"> Bugfix: Zoom window size fixed (Report by Rudolf Labuschagne) </div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Fixed undefined offset while using 'ds_name' in templates (Reported by Vladimir Bilik)</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Npcdmod respects process_perf_data option used in hosts and services definitions ( Reported by Wolfgang Barth )</div>
</li>
<liclass="level1"><divclass="li"> Template: New Template check_nagiostats.php used with check_nagiostats written by Jochen Bern </div>
</li>
</ul>
<p>
<strong>pnp-0.6.6 08/07/2010</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Bugfix: Fixed max amount of graphs per template </div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Autodetect PNP base <acronymtitle="Uniform Resource Locator">URL</acronym></div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Too short npcdmod perfdata_template to take perfdata + overhead, increased +1024byte</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Ignore files in var/perfdata and check for empty directories</div>
<liclass="level1"><divclass="li"> Feature: Special Templates are back <ahref="/pnp-0.6/tpl_special"class="wikilink1"title="pnp-0.6:tpl_special">tpl_special</a></div>
</li>
<liclass="level1"><divclass="li"> Feature: New rrdtool helper functions makes template design easier <ahref="/pnp-0.6/tpl_helper"class="wikilink1"title="pnp-0.6:tpl_helper">tpl_helper</a></div>
</li>
<liclass="level1"><divclass="li"> Feature: config.php → 'recursive_template_search' is enabled by default</div>
</li>
<liclass="level1"><divclass="li"> Feature: config.php → 'template_dirs' is now an array of directorys to search for PNP templates</div>
</li>
</ul>
<p>
<strong>pnp-0.6.4 06/03/2010</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Update: jQuery Update to 1.4.2</div>
</li>
<liclass="level1"><divclass="li"> Update: jQuery-ui Update to 1.8</div>
</li>
<liclass="level1"><divclass="li"> Feature: New configure Option --with-base-url</div>
</li>
<liclass="level1"><divclass="li"> Template: New template check_ntp_time.php (Mathias Kettner)</div>
</li>
<liclass="level1"><divclass="li"> Feature: New i18n files for fr_FR (Yannig Parre)</div>
</li>
<liclass="level1"><divclass="li"> Feature: New jQuery Theme 'multisite'</div>
</li>
</ul>
<p>
<strong>pnp-0.6.3 03/16/2010</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: New helper script libexec/rrd_convert.pl → <ahref="/pnp-0.6/rrd_convert"class="wikilink1"title="pnp-0.6:rrd_convert">rrd_convert</a></div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Ignore old <acronymtitle="Extensible Markup Language">XML</acronym> files while building the service list</div>
</li>
<liclass="level1"><divclass="li"> Template: New template check_hpasm.php</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Installer now checks for json_decode()</div>
</li>
<liclass="level1"><divclass="li"> Workaround: Allow “trailing unfilled semicolons”. Workaround for nsclient++</div>
</li>
<liclass="level1"><divclass="li"> Template: Updates for check_openmanage.php, check_hp_bladecenter.php and check_dell_baldecenter.php ( Trond Hasle Amundsen )”</div>
</li>
</ul>
<p>
<strong>pnp-0.6.2 12/23/2009</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: <acronymtitle="Extensible Markup Language">XML</acronym>_WRITE_DELAY option added to process_perfdata.cfg as suggested by Mathias Kettner</div>
</li>
<liclass="level1"><divclass="li"> Feature: New template integer.php </div>
</li>
<liclass="level1"><divclass="li"> Update: FPDI update to 1.3.1</div>
</li>
<liclass="level1"><divclass="li"> Feature: PNP will now work with <ahref="http://http://www.lighttpd.net"class="urlextern"title="http://http://www.lighttpd.net"rel="nofollow">lighttpd</a> and php-cgi</div>
</li>
<liclass="level1"><divclass="li"> Template: check_mk-ps.perf.php added ( by Mathias Kettner )</div>
</li>
<liclass="level1"><divclass="li"> Feature: PNP will now work without mod_rewrite → <ahref="/pnp-0.6/webfe"class="wikilink1"title="pnp-0.6:webfe">webfe</a></div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Wrong pdf link used on site 'pages' and 'basket'</div>
</li>
<liclass="level1"><divclass="li"> Bugfix: Incorrect group permissions on spool directory</div>
</li>
</ul>
<p>
<strong>pnp-0.6.1 11/22/2009</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Feature: RRD heartbeat per check_command → <ahref="/pnp-0.6/tpl_custom"class="wikilink1"title="pnp-0.6:tpl_custom">tpl_custom</a></div>
</li>
<liclass="level1"><divclass="li"> Feature: New config.php option pdf_graph_opt </div>
</li>
<liclass="level1"><divclass="li"> Feature: Recognize the 'background_pdf' option in page definitions → <ahref="/pnp-0.6/pages"class="wikilink1"title="pnp-0.6:pages">pages</a></div>
</li>
<liclass="level1"><divclass="li"> Feature: Recognize the 'source' option in page definitions → <ahref="/pnp-0.6/pages"class="wikilink1"title="pnp-0.6:pages">pages</a></div>
</li>
<liclass="level1"><divclass="li"> Feature: Array $TIMERANGE now available for templates → <ahref="/pnp-0.6/timeranges"class="wikilink1"title="pnp-0.6:timeranges">timeranges</a></div>
</li>
<liclass="level1"><divclass="li"> Bugfix: ./configure --sysconfdir no longer ignored</div>
</li>
<liclass="level1"><divclass="li"> Feature: Store internal runtime statistics on a per minute base </div>
</li>
<liclass="level1"><divclass="li"> Feature: Added two widgets views/widget_menu.php and views/widget_graph.php </div>
</li>
</ul>
<p>
<strong>pnp-0.6.0 10/30/2009</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> Webfrontend based on <ahref="http://www.kohanaphp.com"class="urlextern"title="http://www.kohanaphp.com"rel="nofollow">Kohana</a></div>
</li>
<liclass="level1"><divclass="li"> Webfrontend based on <ahref="http://jqueryui.com/themeroller/"class="urlextern"title="http://jqueryui.com/themeroller/"rel="nofollow">jQuery Themes</a></div>
</li>
<liclass="level1"><divclass="li"> Javascript-functions using <ahref="http://jquery.com/"class="urlextern"title="http://jquery.com/"rel="nofollow">jQuery</a> plugins </div>
</li>
<liclass="level1"><divclass="li"> process_perfdata.pl will be able to use one RRD database per datasource</div>
</li>
<liclass="level1"><divclass="li"> improved installer. Specification of directory layouts using --with-layout</div>
</li>
<liclass="level1"><divclass="li"> RRDtool errors are now displayed as images. no more missing images</div>
<liclass="level1"><divclass="li"> Export from RRD databases into <acronymtitle="Extensible Markup Language">XML</acronym>, CSV and JSON format using the RRDtool “xport” function</div>
<h1><aname="upgrade_to_version_06x"id="upgrade_to_version_06x"href="/pnp-0.6/upgrade"title="Upgrade to version 0.6.x">Upgrade to version 0.6.x</a></h1>
<divclass="level1">
<p>
The web-frontend has been completely rewritten and is now based on the <acronymtitle="Hypertext Preprocessor">PHP</acronym> MVC framework <ahref="http://www.kohanaphp.com"class="urlextern"title="http://www.kohanaphp.com"rel="nofollow">Kohana</a>. This leads to changed dependencies which must be checked prior to installation.
</p>
<p>
Note: At first an upgrade is like a new installation. Afterwards some changes should be made which are described further down.
</p>
<p>
Without specifying any options during <code>./configure</code> PNP 0.4.x was installed below an existing Nagios-Installation at <code>/usr/local/nagios</code>.
</p>
<p>
Without specifying any options during <code>./configure</code> PNP 0.6.x will be installed in a separate directory at <code>/usr/local/pnp4nagios</code>, i.e. it should be viewed as an independent application.
</p>
<p>
Note: It is sufficient to copy the *.rrd files from the old to the new location. They contain the data The *.xml files are recreated every time new performance data arrives as they contain meta information. The internal structure of the xml files has changed so you wouldn't be able to use them either way.
</p>
</div>
<h2><aname="comparison_of_the_structure"id="comparison_of_the_structure">Comparison of the structure</a></h2>
<divclass="level2">
<p>
Summary of a PNP 0.4.14 installation
</p>
<preclass="code">
./configure
...
*** Configuration summary for pnp 0.4.14 05-02-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Location of rrdtool binary: /usr/bin/rrdtool Version 1.3.1
The templates of the action_url definitions have changed. Instead of ”/nagios/pnp” the <acronymtitle="Uniform Resource Locator">URL</acronym> should be ”/pnp4nagios” and instead of “index.php” now “graph” will be used.
<liclass="level1"><divclass="li"> copy <code>/usr/local/nagios/share/perfdata</code> to <code>/usr/local/pnp4nagios/var/perfdata</code>. Attention: check the permissions</div>
The installation of PNP will be described in more detail. It is expected that nagios was compiled from source and is located in /usr/local/nagios.<br/>
<strong>Attention:</strong> The description applies to the developer version PNP 0.6.0.<br/>
Please note that PNP has to be configured after the installation.
</p>
</div>
<h2><aname="make_and_more"id="make_and_more">Make and more</a></h2>
<divclass="level2">
<p>
The installation of PNP is controlled by <ahref="http://de.wikipedia.org/wiki/makefile"class="interwiki iw_wpde"title="http://de.wikipedia.org/wiki/makefile">makefile</a>s. The system is analyzed after invocation of ./configure and the detected values are tranferred to makefiles.
</p>
<p>
Please unpack PNP as user root:
</p>
<preclass="code">
tar -xvzf pnp4nagios-HEAD.tar.gz
cd pnp4nagios
</pre>
<p>
./configure is to be called from the directory pnp4nagios.
</p>
<preclass="code">
./configure
</pre>
<p>
<strong>Note:</strong> Without specifying any options user and group will be “nagios”. If you have different values then please use the parameters ”--with-nagios-user” and ”--with-nagios-group”, respectively. Using Icinga the call might be
Review the options above for accuracy. If they look okay,
type 'make all' to compile.</pre>
<p>
The paths shown should be checked. If the displayed values aren't correct you can change them calling ./configure with appropriate options.<br/>
<strong>Attention:</strong> “Location of rrdtool binary” means path including name of binary! If necessary it can be specified using the following syntax:
compiles the components like NPCD which are written in C
</p>
<preclass="code"> make install</pre>
<p>
copies everything to the right places in the file system. The paths were already shows during ./configure.
</p>
<p>
After the installation of the program and <acronymtitle="HyperText Markup Language">HTML</acronym> files you can copy a sample Apache configuration file to your web-server config directory
</p>
<preclass="code"> make install-webconf</pre>
<p>
You can call
</p>
<preclass="code"> make install-config</pre>
<p>
optionally. This way config files for process_perfdata.pl and npcd are copied to etc/pnp.
</p>
<p>
To install the NPCD Init script call
</p>
<preclass="code"> make install-init</pre>
<p>
All these steps are combined in
</p>
<preclass="code"> make fullinstall</pre>
<p>
<strong>Note:</strong> As already stated the Nagios settings will be used per default. If you are using Icinga the file '/etc/apache2/conf.d/pnp4nagios.conf' has to be edited to change the path to AuthUserFile (the path may differ between distributions):
<strong>Attention:</strong> After copying the configuration file for the web server you have to restart the web server (<code>service httpd restart</code> or <code>/etc/init.d/apache2 restart</code>, respectively).
</p>
</div>
<h2><aname="update"id="update">Update</a></h2>
<divclass="level2">
<p>
The update of a 0.6.x version works (nearly) the same way as an installation. Please note that you have to call <code>./configure</code> with the same options you used during the first installation.
Please check if you changed anything in the folder <code>share/templates.dist</code>. Own templates should be placed in <code>share/templates</code> to avoid being overwritten.<br/>
<strong>Attention</strong>: If you changed config.php then you should save this file before it is overwritten when you execute <code>make install-config</code>.
</p>
<p>
You can skip <code>make install-webconf</code> and <code>make install-init</code> because nothing changed between 0.6.x versions.
sample config files with the suffix <code>-sample</code> in
</p>
<preclass="code"> /usr/local/pnpnagios/etc</pre>
<p>
the config file config.php for the web frontend in
</p>
<preclass="code"> /usr/local/pnp4nagios/etc</pre>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/config"class="wikilink1"title="pnp-0.6:config">configuration</a>
The configuration of the already mentioned <ahref="/pnp-0.6/modes"class="wikilink1"title="pnp-0.6:modes">modes of performance data processing</a> will be described in more detail.
<ahref="/_detail/synchronous.png?id=pnp-0.6%3Adoc_complete"class="media"title="synchronous.png"><imgsrc="/_media/synchronous.png?w=150"class="mediaright"align="right"alt=""width="150"/></a> The synchronous mode is the simplest way to integrate the data collector <code>process_perfdata.pl</code> into nagios. Every event will trigger an execution of <code>process-service-perfdata</code>.
</p>
<p>
Initially you have to enable processing of performance data in <code>nagios.cfg</code>. Please note that this directive might already exist in the config file. Default is “0”.
Data processing has to be disabled in the definition of every host or service whose performance data should NOT be processed.
</p>
<preclass="code">
define service {
...
process_perf_data 0
...
}
</pre>
<p>
Since Nagios 3.x it is possible to deactivate the export of environment variables (as part of optimizing the system for maximum performance). Unfortunately this directive has to be enabled to use the synchronous mode. So either you use the default value (which means that the export is enabled) or you define the variable in <code>nagios.cfg</code>
Starting with Nagios 3.0 it may be useful to enable processing of performance data for hosts as well. Due to changed host check logic Nagios 3 now performs regularly scheduled host checks.
Nagios has to be notified about the referenced commands as well. If you used the <ahref="http://nagios.sourceforge.net/docs/3_0/quickstart.html"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/quickstart.html"rel="nofollow">quickstart installation guides</a> for Nagios you can modify the definitions in commands.cfg.
You can see that calling process_perfdata.pl doesn't require any arguments apart from specifing the option -d ( DATATYPE ) if you want to process performance data resulting from host checks.
<strong>Note</strong><code>process_perfdata.pl</code> cannot be started under control of ePN ( embedded <acronymtitle="Practical Extraction and Report Language">Perl</acronym> Nagios ). Therefore the script is explicitly called using <code>/usr/bin/perl</code> ( or where you perl binary is located ). If you use Nagios 3.x or do not use ePN there is no need to specify <code>/usr/bin/perl</code>.
<ahref="/_detail/bulk.png?id=pnp-0.6%3Adoc_complete"class="media"title="bulk.png"><imgsrc="/_media/bulk.png?w=150"class="mediaright"align="right"alt=""width="150"/></a>Bulk mode is a bit more complicated than the synchronous mode but reduces the load on the nagios server significantly because the data collector <code>process_perfdata.pl</code> is not invoked for every service/host check.
</p>
<p>
In bulk mode Nagios writes the data to a temporary file in a defined format. This file is processed by <code>process_perfdata.pl</code> at certain intervals. Nagios will take care for starting and running it periodically.
</p>
<p>
Processing of performance data has to be enabled in <code>nagios.cfg</code>
<strong>Attention:</strong> Please note that these template definitions differ from the ones delivered in <code>nagios.cfg</code>!
</p>
<p>
The directives and their meaning:
</p>
<ul>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file</strong></code> path to the temporary file which should contain the performance data.</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_template</strong></code> format of the temporary file. Data will be defined using Nagios macros.</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_mode</strong></code> option “a” specifies that data is to be appended to the file.</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_processing_interval</strong></code> the interval is 15 seconds</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_processing_command</strong></code> the command to be called during the interval.</div>
</li>
</ul>
<p>
The used commands have to be announced to Nagios. If you used the <ahref="http://nagios.sourceforge.net/docs/3_0/quickstart.html"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/quickstart.html"rel="nofollow">quickstart installation guides</a> for Nagios you can modify the definitions in commands.cfg.
Because there is more data to process than in synchronous mode <code>process_perfdata.pl</code> will take longer to do this so you should check the TIMEOUT value in <code>etc/process_perfdata.cfg</code> and adjust it appropriately.</div>
<h2><aname="bulk_mode_with_npcd1"id="bulk_mode_with_npcd1">Bulk Mode with NPCD</a></h2>
<divclass="level2">
<p>
<ahref="/_detail/bulk-npcd.png?id=pnp-0.6%3Adoc_complete"class="media"title="bulk-npcd.png"><imgsrc="/_media/bulk-npcd.png?w=150"class="mediaright"align="right"alt=""width="150"/></a> The configuration is identical to the Bulk Mode except for the used command.
Processing of performance data has to be enabled in <code>nagios.cfg</code>
<strong>Attention:</strong> Please note that these template definitions differ from the ones delivered in <code>nagios.cfg</code>!
</p>
<p>
The directives and their meaning:
</p>
<ul>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file</strong></code> path to the temporary file which should contain the performance data.</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_template</strong></code> format of the temporary file. Data will be defined using Nagios macros.</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_mode</strong></code> option “a” specifies that data is to be appended to the file.</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_processing_interval</strong></code> the interval is 15 seconds</div>
</li>
<liclass="level1"><divclass="li"><code><strong>service_perfdata_file_processing_command</strong></code> the command to be called during the interval.</div>
</li>
</ul>
<p>
The used commands have to be announced to Nagios. If you used the <ahref="http://nagios.sourceforge.net/docs/3_0/quickstart.html"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/quickstart.html"rel="nofollow">quickstart installation guides</a> for Nagios you can modify the definitions in commands.cfg.
Using these commands the file service-perfdata will be moved to var/spool/ after the interval specified in <code><strong>service_perfdata_file_processing_interval</strong></code> has passed. The Nagios macro $TIMET$ is appended to the filename to avoid overwriting of old files unintentionally. The macro $TIMET$ contains the current timestamp in time_t format (seconds since the UNIX epoch).
</p>
<p>
In the directory /usr/local/pnp4nagios/var/spool/ files are gathered to be processed by NPCD.
</p>
<p>
NPCD monitors the spool directory and passes the file names to <code>process_perfdata.pl</code>. This way processing of performance data is completely decoupled from nagios.
</p>
<p>
Before starting NPCD you have to check the paths to the spool directory and to <code>process_perfdata.pl</code> specified in the config file <code>npcd.cfg</code>.
The option <code>-d</code> starts NPCD as a daemon in the background.
</p>
</div>
<h2><aname="bulk_mode_with_npcd_and_npcdmod"id="bulk_mode_with_npcd_and_npcdmod">Bulk Mode with NPCD and npcdmod</a></h2>
<divclass="level2">
<p>
<strong>Attention</strong>
<em>Starting with Nagios 4 the internal structures have changed so the start of the module will fail. So far there are no plans to support Nagios 4. Please select any other of the modes.</em>
</p>
<p>
<ahref="/_detail/bulk-npcdmod.png?id=pnp-0.6%3Adoc_complete"class="media"title="bulk-npcdmod.png"><imgsrc="/_media/bulk-npcdmod.png?w=150"class="mediaright"align="right"alt=""width="150"/></a> This mode uses the event broker module npcdmod.o. The flow of data is identical to “bulk mode with NPCD”. The internal perfdata routines of Nagios activated by the “*_perf_data_*” directives in nagios.cfg are *NOT* used anymore. The module npcdmod.o takes over the task of processing the data required by PNP.
</p>
<p>
Pro:
</p>
<ul>
<liclass="level1"><divclass="li"> The perfdata routines can now be used for other addons.</div>
</li>
<liclass="level1"><divclass="li"> The configuration is easier.</div>
</li>
<liclass="level1"><divclass="li"> It is the preferred mode of the PNP developers.</div>
All other directives mentioned on this page must <strong>NOT</strong> be used.
</p>
<p>
<strong>Attention:</strong> If you have changed the value of <code>event_broker_options</code> from -1 to another value then please note that PNP needs the bits 2 and 3 set (0b01100). Make sure that the resultung value has these bits set because otherwise there will be no performance data to process.
</p>
<p>
After restarting Nagios information regarding the start of the module will be logged.
</p>
<p>
Excerpt from nagios.log
</p>
<preclass="code">
[1277545053] npcdmod: Copyright (c) 2008-2009 Hendrik Baecker (andurin@process-zero.de) - http://www.pnp4nagios.org
Since version 0.6.12 PNP4Nagios can be driven as a gearman worker. This way large Nagios environments are possible using mod_gearman. Nagios and PNP4Nagios can be run on different machines.
</p>
<p>
You need a mod_gearman environment up and running like described by Sven Nierlein on <ahref="http://labs.consol.de/lang/en/nagios/mod-gearman/"class="urlextern"title="http://labs.consol.de/lang/en/nagios/mod-gearman/"rel="nofollow">http://labs.consol.de/lang/en/nagios/mod-gearman/</a>.
</p>
<p>
You'll find a section on gearman in <code>etc/process_perfdata.cfg</code>:
Using <code>PREFORK = <n></code> you specify the number of child processes.
</p>
<p>
<code>GEARMAN_HOST = <host>:<port></code> specifies host and port of the server running the gearman daemon providing the data.
</p>
<p>
<code>REQUEST_PER_CHILD = <n></code> enables you to define the number of requests processed per process.
</p>
<p>
<code>ENCRYPTION = <n></code> specifies whether to use encryption (“1”) or not. Default is an activated encyrption which should be changed only in special cases. You can either use <code>KEY = <key phrase></code> or 'KEYFILE =<key file><code> to specify the location of a file containing the key phrase.
</code>etc/init.d/pnp_gearman_worker start<code> contains links to the perl script </code>process_perfdata.pl<code> and the config file </code>process_perfdata.cfg''.
the performance data will be processed which is provided by the gearmand daemon on the Nagios server.
</p>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/verify"class="wikilink1"title="pnp-0.6:verify">checking the functionality</a>
<h1><aname="checking_the_installation"id="checking_the_installation"href="/pnp-0.6/verify"title="Checking the installation">Checking the installation</a></h1>
<divclass="level1">
<p>
If everything went well until now you can try to call PNP using your web browser.
When using the installation with default values PNP should be called using <ahref="http://%3Cserver name%3E/pnp4nagios/"class="urlextern"title="http://<server name>/pnp4nagios/"rel="nofollow">http://<server name>/pnp4nagios/</a>.
The first time you will see a page “PNP4Nagios Environment Tests” which includes different checks of necessary components. Obviously all checks have to be passed successfully before you can proceed. Please follow the instructions given on that page.<br/>
</p>
<p>
If all tests have passed *successfully* the file pnp4nagios/share/install.php can be deleted or renamed. Not till then the web interface is reachable.
</p>
<p>
Alternatively you can create a file called <code>pnp4nagios/share/install.ignore</code> which will prevent the call of the installer after further updates.
</p>
<p>
If you receive the message “<acronymtitle="Hypertext Preprocessor">PHP</acronym> magic_quotes_gpc is deprecated” then please locate your <code>php.ini</code> and set the value to <code>Off</code>.
</p>
<p>
Called without any arguments PNP looks for RRD and <acronymtitle="Extensible Markup Language">XML</acronym> files in pnp4nagios/var/perfdata and shows all graphs of the first host.
</p>
<p>
ATTENTION: Immediately after (re-)starting Nagios after you enabled the processing of performance data you will get error messages in your browser because performance data has to be collected and stored in RRD files. Depending on the check interval you are using you have to wait some time before you can view the first graphs.
Calling <code>make install-config</code> during installation will create a sample config file <code>etc/process_perfdata.cfg-sample</code>. The values in the sample file will correspond to the defaults used by <code>process_perfdata.pl</code> so normally you do not have a file called <code>process_perfdata.cfg</code> while running the procedure.<br/>
However you can influence the way <code>process_perfdata.pl</code> works by changing options which have to be specified in <code>process_perfdata.<strong>cfg</strong></code>.
</p>
<p>
The most important options launching PNP are LOG_LEVEL and LOG_FILE. We recommend setting the <code>LOG_LEVEL</code> value to “2” so you can track what process_perfdata.pl will do.
Most likely we will ask for excerpts from perfdata.log if you open a <ahref="/pnp-0.6/about#support"class="wikilink1"title="pnp-0.6:about">support request</a> on the mailing lists as well as the output of the <ahref="/pnp-0.6/verify_pnp_config"class="wikilink1"title="pnp-0.6:verify_pnp_config">verify_pnp_config</a> script so please provide them <imgsrc="/lib/images/smileys/icon_wink.gif"class="middle"alt=";-)"/>.
</p>
<p>
During normal operation the debug level should be set to 0 to avoid performance issues due to unnecessary entries in the log file.
</p>
</div>
<h2><aname="something_went_wrong"id="something_went_wrong">Something went wrong</a></h2>
<divclass="level2">
<p>
Some basic settings should be checked
</p>
<p>
1. Have any RRD and <acronymtitle="Extensible Markup Language">XML</acronym> files been created?
<code>process_perfdata.pl</code> will create a new directory under pnp/perfdata for every host. In this directory an RRD database and an <acronymtitle="Extensible Markup Language">XML</acronym> file will be created for every service. The host data will be stored in <code>_HOST_.xml</code> and <code>_HOST_.rrd</code> respectively.<br/>
If graphing stops out of a sudden then open the appropriate <acronymtitle="Extensible Markup Language">XML</acronym> file. There are two tags called <RC> and <TXT>. <RC> shows the return code of the RRDtool update and <TXT> a textual description. <br/>
Sometimes you have to specify additional options so that performance data is produced. In some cases a <ahref="/pnp-0.6/wrapper"class="wikilink1"title="pnp-0.6:wrapper">wrapper script</a> might help.<br/>
However not all checks provide performance data. That applies - among others - to “check_ping” in contrast to “check_icmp” which does provide data (starting with Nagios plugin version 1.4.12 check_ping does provide performance data).<br/>
Using the web interface the detail information of hosts/services shows a field “Performance Data”. If it is empty there is no data available so no files are written to the appropriate directory and that is why PNP does not provide you with graphs!<br/>
The following image shows the information of a “PING” service. The output of the plugin is surrounded by a blue border, the performance data by a red one.<br/>
2. Has nagios called <code>process_perfdata.pl</code>?
In the config file for process_perfdata.pl (<code>etc/process_perfdata.<strong>cfg</strong></code>) you can increase the debug level. Data processing will be logged in <code>var/perfdata.log</code>.
</p>
<p>
3. Graphs are shown without text?
Have a look at the <ahref="/pnp-0.6/about#system_requirements"class="wikilink1"title="pnp-0.6:about">requirements</a>.
</p>
<p>
4. Some graphs are shown, others report the error <code>“parser error: Input is not proper UTF-8”</code> or something similar. Please check if your data contains “special” characters not present in the <acronymtitle="American Standard Code for Information Interchange">ASCII</acronym> set. Try to set <acronymtitle="Extensible Markup Language">XML</acronym>_ENC in <code>process_perfdata.cfg</code> to <code><acronymtitle="International Organization for Standardization">ISO</acronym>-8859-1</code> or something appropriate. Wait until the xml file is newly created and retry.
</p>
<p>
5. Using the npcdmod module the value of the nagios.cfg directive <code>event_broker_options</code> may have to be adapted if it was modified. You'll find some details <ahref="/pnp-0.6/config#bulk_mode_with_npcd_and_npcdmod"class="wikilink1"title="pnp-0.6:config">here</a>.
</p>
<p>
6. You can use the script <ahref="/pnp-0.6/verify_pnp_config"class="wikilink1"title="pnp-0.6:verify_pnp_config">verify_pnp_config.pl</a> after installation to check your settings and if performance data is present.
</p>
<p>
7. Things look OK, but some files are being left in the spool directory (/usr/local/pnp4nagios/var/spool/<perfdata_filename>-PID-<process_perfdata_pid>). If process_perdata.pl is not able to write to the destination directory (/usr/local/pnp4nagios/share/perfdata/<host>), it will stop and not remove the file. That will increase the size of the spool directory and slow down performance data processing. This problem is likely to occur if you have copied directories from a previous installation and/or manually created directories and left them with wrong permissions or wrong ownership.
</p>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/verify_pnp_config"class="wikilink1"title="pnp-0.6:verify_pnp_config">verify_pnp_config.pl</a>
In case of problems there is a script called <code>verify_pnp_config.pl</code> located on <ahref="http://verify.pnp4nagios.org"class="urlextern"title="http://verify.pnp4nagios.org"rel="nofollow">http://verify.pnp4nagios.org</a>. It enables you to check the configuration settings as well as performance data of hosts or services. It can be used prior and during runtime of PNP.
The verify script is located on <ahref="http://verify.pnp4nagios.org"class="urlextern"title="http://verify.pnp4nagios.org"rel="nofollow">http://verify.pnp4nagios.org</a> and needs three start options
</p>
<ul>
<liclass="level1"><divclass="li"><code>--mode</code> One of the modes described on <ahref="/pnp-0.6/modes"class="wikilink1"title="pnp-0.6:modes">modes</a></div>
</li>
<liclass="level1"><divclass="li"><code>--config</code> Location of nagios.cfg or icinga.cfg</div>
</li>
<liclass="level1"><divclass="li"><code>--pnpcfg</code> Path to PNP´s etc directory</div>
</li>
</ul>
<p>
Calling <code>perl verify_pnp_config</code> will show the available options.
Starting with <code>0.6.19-R.37</code> (2013-02-17) the script will accept the option <code>--object</code> (or <code>-o</code>) followed by a string to specify a host name and/or service description to additionally show performance data (if any) of the object(s) found. The data is enclosed in brackets, followed by the value of the directive <code>process_performance_data</code> (<code>ppd</code>=n).
</p>
<p>
<code>host</code> = show performance information for host <code>host</code><br/>
<code>;service</code> = show performance information for service <code>service</code><br/>
<code>host;service</code> = show performance information for service <code>service</code> on host <code>host</code>
</p>
<p>
The strings are taken as regular expressions (perl syntax).
<h1><aname="nagios_web_frontend"id="nagios_web_frontend"href="/pnp-0.6/webfe"title="Nagios web frontend">Nagios web frontend</a></h1>
<divclass="level1">
<p>
Of course PNP should be easily accessible. You do not want to search long for the right graph.
</p>
<p>
Nagios itself features external URLs using so called extended info configs. Due to changes between Nagios 2.x and Nagios 3.x both versions are described.
With Nagios 2.x the integration of external URLs into the nagios web interface is made using Extended Info Objects for <ahref="http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#serviceextinfo"class="urlextern"title="http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#serviceextinfo"rel="nofollow">services</a>. For PNP we use the directive action_url to call the PNP web frontend with the appropriate options.
Since nagios 3.0 the action_url-directive has be moved to the <ahref="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#host"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#host"rel="nofollow">host</a> or <ahref="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#service"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#service"rel="nofollow">service</a> definition. This way the definition of URLs to the PNP-interface has been simplified. The <ahref="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#serviceextinfo"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#serviceextinfo"rel="nofollow">serviceextinfo</a> and <ahref="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#hostextinfo"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#hostextinfo"rel="nofollow">hostextinfo</a> definitions are deprecated.
</p>
<p>
First two nagios templates are defined. If you used the Nagios <ahref="http://nagios.sourceforge.net/docs/3_0/quickstart.html"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/quickstart.html"rel="nofollow">quickstart installation guides</a> you can append these lines to templates.cfg:
These two templates can now be included via “use srv-pnp” or “use host-pnp” for services and hosts respectively. If you used the quickstart installation guide you might for example edit the file localhost.cfg and add the template to the host or service definition as follows:
</p>
<preclass="code">define host{
use linux-server,host-pnp ; Name of host templates to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
}
</pre>
<preclass="code">define service{
use local-service,srv-pnp ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
</pre>
<p>
The links to the correct URLs are created automagically.<br/>
<br/>
</p>
<p>
<strong>Tips</strong>: if you want to open the PNP window in your <em>main</em> frame (on the right of the menu) instead of a new page, just set <code>action_url_target=main</code> in your nagios cgi.cfg
</p>
</div>
<h2><aname="popups"id="popups">Popups</a></h2>
<divclass="level2">
<p>
You can integrate PNP into Nagios in a way that you have current graphs without clicking any icons. This can be accomplished using the <ahref="http://nagios.sourceforge.net/docs/3_0/cgiincludes.html"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/cgiincludes.html"rel="nofollow">CGI Includes</a> which allow us to include JavaScript code in the status detail view ( status.cgi ).
</p>
<p>
Prerequisites:
</p>
<ul>
<liclass="level1"><divclass="li"> PNP is installed and running</div>
</li>
<liclass="level1"><divclass="li"> the file status-header.ssi from the contrib/ssi/ folder of the PNP package was copied to /usr/local/nagios/share/ssi/.<br/>
<strong>Attention</strong>: This file must <strong>NOT</strong> be executable. Otherwise it will be treated as a <acronymtitle="Common Gateway Interface">CGI</acronym> which will result in an error.<br/>
*Note to Apache admins*: Apache ssi and Nagios ssi only have a similar name.</div>
</li>
<liclass="level1"><divclass="li"> the appropriate service definition(s) has/have been modified. Please note that until Nagios 2.x you have to modify the serviceextinfo definition (which is deprecated starting with Nagios 3).</div>
<h1><aname="pnp_web_frontend"id="pnp_web_frontend"href="/pnp-0.6/webfe_cfg"title="PNP Web Frontend">PNP Web Frontend</a></h1>
<divclass="level1">
<p>
The behaviour of the PNP Web-Frontend can be controlled through the config file <code>etc/config.php</code>. This file will be overwritten during updates of PNP as the paths and options are detected during <code>./configure</code>.
</p>
<p>
Own adjustments should be made in <code>etc/config_local.php</code>. If this file does not exist the file config.php can be taken as a guideline.
Screen sizes may vary, pages sizes won't. The following two directives enable you to specify different sizes for the creation of PDFs. If they aren't specified the values of the graph sizes are taken.
The periods of time the RRD graphs will show are determined using the array $views[]. The title and number of graphs can be specified globally in this place
You can add more views ($views[5], …) but please keep in mind that under normal circumstances ALL views you defined are shown.
</p>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/timeranges"class="wikilink1"title="pnp-0.6:timeranges">timeranges</a>
In the overview PNP shows five timeranges which can be defined in config.php.
</p>
<p>
Additionally you can influence the timeranges via the <acronymtitle="Uniform Resource Locator">URL</acronym>. This can be useful to automatically create <acronymtitle="Portable Document Format">PDF</acronym> documents. The ranges can be defined using the options “start” and “end”.
The graph will start one week prior to the current date and time. It will end at the current timestamp.
</p>
<tableclass="inline">
<trclass="row0">
<thclass="col0"> start </th><thclass="col1"> end </th><thclass="col2"> view </th><thclass="col3"> result </th>
</tr>
<trclass="row1">
<tdclass="col0 leftalign"></td><tdclass="col1 leftalign"></td><tdclass="col2 leftalign"></td><tdclass="col3">all views ending at current timestamp </td>
</tr>
<trclass="row2">
<tdclass="col0 centeralign"> x </td><tdclass="col1 leftalign"></td><tdclass="col2 leftalign"></td><tdclass="col3">all views starting at defined date </td>
</tr>
<trclass="row3">
<tdclass="col0 leftalign"></td><tdclass="col1 centeralign"> x </td><tdclass="col2 leftalign"></td><tdclass="col3">all views ending at defined date </td>
</tr>
<trclass="row4">
<tdclass="col0 centeralign"> x </td><tdclass="col1 centeralign"> x </td><tdclass="col2 leftalign"></td><tdclass="col3">one view between the two dates </td>
</tr>
<trclass="row5">
<tdclass="col0 leftalign"></td><tdclass="col1 leftalign"></td><tdclass="col2 centeralign"> x </td><tdclass="col3">one view ending at current timestamp </td>
</tr>
<trclass="row6">
<tdclass="col0 centeralign"> x </td><tdclass="col1 leftalign"></td><tdclass="col2 centeralign"> x </td><tdclass="col3">one view starting at defined date </td>
</tr>
<trclass="row7">
<tdclass="col0 leftalign"></td><tdclass="col1 centeralign"> x </td><tdclass="col2 centeralign"> x </td><tdclass="col3">one view ending at defined date </td>
</tr>
</table>
<p>
Examples of different specifications
</p>
<tableclass="inline">
<trclass="row0">
<thclass="col0 centeralign"> format </th><thclass="col1"> description </th>
</tr>
<trclass="row1">
<tdclass="col0 leftalign"> 2009W04 </td><tdclass="col1"> 4. week of 2009 </td>
</tr>
<trclass="row2">
<tdclass="col0 leftalign"> 1.5.2009 </td><tdclass="col1"> May, 1st 2009 </td>
</tr>
<trclass="row3">
<tdclass="col0 leftalign"> -1 day </td><tdclass="col1"> one day back </td>
</tr>
<trclass="row4">
<tdclass="col0 leftalign"> -3 weeks </td><tdclass="col1"> 3 weeks back </td>
</tr>
<trclass="row5">
<tdclass="col0 leftalign"> -1 year </td><tdclass="col1 leftalign"> one year back </td>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/pages"class="wikilink1"title="pnp-0.6:pages">pages</a>
“pages” provide the opportunity to collect graphs of different hosts/services on one page. That way - as an example - you can display the traffic rates of all tape libraries. Regular expressions are possible so you can accomplish a lot with only few definitions - provided that you have appropriate names.
The directory specified using “$conf['page_dir']” contains one or more file with the extension ”.cfg”.
</p>
<p>
Comments start with a hash-sign (#) and are possible within lines as well. Each file contains a “page” definition which specifies the name of the page and it determines whether the following graph definition contains regular expressions or not.<br/>
The description behind <code>page_name</code> appears in the list of available pages and will be used as title of the browser window. <strong>Attention:</strong> “host_name” and “service_desc” refer to the name of the file in the perfdata directory, not to the definition in Nagios. Blanks are replaced by underscores (_).
</p>
<preclass="code">define page {
use_regex 1 # 0 = use no regular expressions, 1 = use regular expressions
page_name test-page # page description
}</pre>
<p>
One or more “graph” definitions follow:
</p>
<preclass="code">define graph {
host_name host1,host2,host3
service_desc Current_Load
}</pre>
<p>
<strong>Attention:</strong> The list of host name will only work if you use <code>regex 0</code>!
</p>
<preclass="code">define graph {
host_name host4
service_desc Current_Users
}</pre>
<p>
And now some definitions with regular expressions. At first all hosts whose names are starting with “Tape”:
</p>
<preclass="code">define graph {
host_name ^Tape
service_desc Traffic
}</pre>
<p>
all hosts whose names are ending with “00”:
</p>
<preclass="code">define graph {
host_name 00$
service_desc Load
}</pre>
<p>
all services of localhost whose names contain “a” or “o”, respectively:
</p>
<preclass="code">define graph {
host_name localhost
service_desc a|o
}</pre>
<p>
all services whose names contain an underscore followed by (at least) three digits on all hosts whose names start with “UX”:
</p>
<preclass="code">define graph {
host_name ^UX
service_desc _\d{3}
}</pre>
<p>
In some cases you may want to limit the display to just one graph. To accomplish this you can use the optional directive “source” followed by a number specifying the position within the RRD file starting at 0
</p>
<preclass="code">define graph {
host_name host1,host2,host3
service_desc PING
source 1
}</pre>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/xport"class="wikilink1"title="pnp-0.6:xport"> data export</a>
PNP provides access to RRD data using the <code>xport</code> controller. The output format can be specified. At the moment the formats <code>xml</code>, <code>json</code> and <code>csv</code> are supported.
</p>
<p>
The controller can be called using the <acronymtitle="Uniform Resource Locator">URL</acronym>
<code>view=<n></code> limits the graph to the timeperiod specified in config.php <br/>
<code>source=<n></code> only shows one data source if you have more than one in your RRD file
</p>
<p>
Instead of <code>view</code> you can use <code>start</code> and/or <code>end</code> to specify the time period. For details please look at <ahref="/pnp-0.6/timeranges"class="wikilink1"title="pnp-0.6:timeranges">"time ranges"</a>.
</p>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/tpl"class="wikilink1"title="pnp-0.6:tpl">templates</a>
<h1><aname="what_are_templates"id="what_are_templates"href="/pnp-0.6/tpl"title="What are templates?">What are templates?</a></h1>
<divclass="level1">
<p>
PNP uses templates to influence the appearance of RRD graphs.
</p>
<p>
The selected check_command determines which template will be used to control the graph. Following will be described where templates are stored and how the decision for the “right” template is made.
</p>
</div>
<h2><aname="what_template_will_be_used_when"id="what_template_will_be_used_when">What template will be used when?</a></h2>
<divclass="level2">
<p>
Templates are stored at two places in the file system.
</p>
<ul>
<liclass="level1"><divclass="li"> share/templates.dist - for templates included in the PNP package</div>
</li>
<liclass="level1"><divclass="li"> share/templates - for custom made templates which are not changed during updates</div>
</li>
</ul>
<p>
If the graph for the service “http” on host “localhost” should be shown, PNP will look for the <acronymtitle="Extensible Markup Language">XML</acronym> file <code>perfdata/localhost/http.xml</code> and read its contents. The <acronymtitle="Extensible Markup Language">XML</acronym> files are created automatically and contain information about the particular host and service. The header contains information about the plugin and the performance data. The <acronymtitle="Extensible Markup Language">XML</acronym> tag <code><TEMPLATE></code> identifies which PNP template will be used for this graph.
The template default.php takes an exceptional position as it is used every time no other applicable template is found.
</p>
</div>
<h2><aname="creating_own_templates"id="creating_own_templates">Creating own templates</a></h2>
<divclass="level2">
<p>
PNP templates are <acronymtitle="Hypertext Preprocessor">PHP</acronym> files which are included during execution of PNP using the <acronymtitle="Hypertext Preprocessor">PHP</acronym> function include(). This means that every <acronymtitle="Hypertext Preprocessor">PHP</acronym> code in templates will be interpreted so manipulation of all values is possible.
</p>
<p>
PNP template must have the following characteristics:
</p>
<ol>
<liclass="level1"><divclass="li"> templates must contain valid <acronymtitle="Hypertext Preprocessor">PHP</acronym> code.</div>
</li>
<liclass="level1"><divclass="li"> templates must not create any output.</div>
</li>
<liclass="level1"><divclass="li"> the two arrays $opt[] and $def[] have to be filled</div>
</li>
</ol>
<p>
These two arrays are used to call <code>'rrdtool graph</code>' so every option is possible that RRDtool supports. All options of RRDtool are described very thoroughly on the <ahref="http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html"class="urlextern"title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html"rel="nofollow">RRDtool Homepage</a>.
</p>
<p>
If both arrays contain more than one set of data graphs will be created for every set.
</p>
<p>
Inside the templates the data from the related <acronymtitle="Extensible Markup Language">XML</acronym> files can be used.
</p>
<p>
Using the relatively simple template response.php we will describe the most important options.
</span><spanclass="re0">$opt</span><spanclass="br0">[</span><spanclass="nu0">1</span><spanclass="br0">]</span><spanclass="sy0">=</span><spanclass="st0">"--title <spanclass="es1">\"</span>Response Time For <spanclass="es4">$hostname</span> / <spanclass="es4">$servicedesc</span><spanclass="es1">\"</span>"</span><spanclass="sy0">;</span>
<spanclass="re0">$def</span><spanclass="br0">[</span><spanclass="nu0">1</span><spanclass="br0">]</span><spanclass="sy0">.=</span><spanclass="st0">"AREA:var1#00FF00:<spanclass="es1">\"</span>Response Times <spanclass="es1">\"</span>"</span><spanclass="sy0">;</span>
<spanclass="re0">$def</span><spanclass="br0">[</span><spanclass="nu0">1</span><spanclass="br0">]</span><spanclass="sy0">.=</span><spanclass="st0">"GPRINT:var1:LAST:<spanclass="es1">\"</span>%3.4lg <spanclass="es6">%s</span><spanclass="es4">$UNIT[1]</span> LAST <spanclass="es1">\"</span>"</span><spanclass="sy0">;</span>
<spanclass="re0">$def</span><spanclass="br0">[</span><spanclass="nu0">1</span><spanclass="br0">]</span><spanclass="sy0">.=</span><spanclass="st0">"GPRINT:var1:MAX:<spanclass="es1">\"</span>%3.4lg <spanclass="es6">%s</span><spanclass="es4">$UNIT[1]</span> MAX <spanclass="es1">\"</span>"</span><spanclass="sy0">;</span>
<spanclass="re0">$def</span><spanclass="br0">[</span><spanclass="nu0">1</span><spanclass="br0">]</span><spanclass="sy0">.=</span><spanclass="st0">"GPRINT:var1:AVERAGE:<spanclass="es1">\"</span>%3.4lg <spanclass="es6">%s</span><spanclass="es4">$UNIT[1]</span> AVERAGE <spanclass="es1">\"</span>"</span><spanclass="sy0">;</span>
<spanclass="sy1">?></span></pre>
<p>
Note: as the number (1) and the letter “L” look alike in this listing: the format ”%3.4lg” contains a small letter.
</p>
<p>
<strong><code>$opt[1] = ”--title …</code></strong> sets RRDtool options for the first set of data, here the title as you can see. Embedded quotes are masked using a backslash (\). The variables <code>$hostname</code> and <code>$servicedesc</code> were determined through the call of PNP and are available for the template as well.
</p>
<p>
<strong><code>$def[1] = “DEF:var1=$RRDFILE[1]:$DS[1]:AVERAGE ”;</code></strong> defines which data is to be read from which RRD file. $RRDFILE[1] contains the path to the RRD file of this service. $DS[1] refers to the first data series from the RRD file.
</p>
<p>
<strong><code>$def[1] .= “AREA:var1#00FF00:\”Response Times \” ”;</code></strong> the operator ”.=” appends more data to the array $def[1]. An area will be drawn using data from the variable <code>var1</code>. The color is defined in HEX notation #00FF00 (red, green, blue). The label is “Response Times”.
</p>
<p>
<strong><code>$def[1] .= “LINE1:var1#000000 ”;</code></strong> As completion of the just drawn area a line (LINE1) will be drawn in black (#000000).
</p>
<p>
<strong><code>$def[1] .= “GPRINT:var1:LAST:\”%3.4lg %s$UNIT[1] LAST \” ”; <br/>
$def[1] .= “GPRINT:var1:MAX:\”%3.4lg %s$UNIT[1] MAX \” ”; <br/>
$def[1] .= “GPRINT:var1:AVERAGE:\”%3.4lg %s$UNIT[1] AVERAGE \” ”;</code></strong>
</p>
<p>
The three GPRINT lines build up the caption for the graph. The current values are formatted using the <ahref="http://en.wikipedia.org/wiki/printf"class="interwiki iw_wp"title="http://en.wikipedia.org/wiki/printf">printf</a> syntax.
Using the data collector <code>process_perfdata.pl</code> PNP stores not only performance data but other values exported by Nagios. These values are stored in the <acronymtitle="Extensible Markup Language">XML</acronym> file associated to the appropriate service.
</p>
<p>
In the first part of the <acronymtitle="Extensible Markup Language">XML</acronym> file the performance data is stored in separate components.
The field <DS> designates the data source and is used to identify the data series of the RRD files and is the key of the following arrays as well.
</p>
<p>
The array <code>$UNIT[1]</code> contains the unit of measurement of the first data series.
</p>
<p>
The <acronymtitle="Extensible Markup Language">XML</acronym> file contains other information. When process_perfdata.pl is used in default mode all available macros are at hand with the current values. For the benefit of readability the following lines show only an extract.
<spanclass="sc3"><spanclass="re1"><NAGIOS_SERVICEOUTPUT<spanclass="re2">></span></span></span>HTTP OK HTTP/1.1 200 OK - 10087 bytes in 0.125 seconds<spanclass="sc3"><spanclass="re1"></NAGIOS_SERVICEOUTPUT<spanclass="re2">></span></span></span>
The various <acronymtitle="Extensible Markup Language">XML</acronym> fields can be used as variables in the PNP templates. Each field is available as a variable with the same name.
</p>
<p>
The value of the field <code><NAGIOS_SERVICEOUTPUT></code> is available as the variable <code>$NAGIOS_SERVICEOUTPUT</code>.
</p>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/tpl_custom"class="wikilink1"title="pnp-0.6:tpl_custom">custom templates</a>
As already described under ”<ahref="/pnp-0.6/tpl"class="wikilink1"title="pnp-0.6:tpl">What are templates ?</a>” the appearance of graphs depends on the check command used.
</p>
<p>
There are situations where this behaviour must be overruled, for example when universal commands have been defined.
</p>
<p>
PNP, especially process_perfdata.pl, will search for a config file (<check_command>;.cfg) in the etc/check_commands directory and read its contents (if available).
Outgoing from the following example of a Nagios command-definition:
</p>
<preclass="code">
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a "$ARG2$"
}
</pre>
<p>
This would lead to a call of the check_nrpe.php template even when the monitored host would use a completely different plugin which is called via NRPE.
</p>
<p>
As our example command is called check_nrpe it will be searched for etc/check_commands/check_nrpe.cfg.
</p>
<p>
During installation a sample config file with the extension .cfg-sample is copied to etc/check_commands.
</p>
<preclass="code">
# check_command check_nrpe!load!-w 4,4,4 -c 5,5,5
# ________0__________| | |
# ________1__________________| |
# ________2__________________________|
#
CUSTOM_TEMPLATE = 1
</pre>
<p>
<code>CUSTOM_TEMPLATE = 1</code> assures that only the contents of $ARG1$ will be used as a template name. As $ARG1$ contains “load” in this example the template name would result in “load.php”.
</p>
<p>
<code>CUSTOM_TEMPLATE = 0,1</code> results in → “check_nrpe_load.php”
</p>
<p>
<code>CUSTOM_TEMPLATE = 1,0</code> results in → “load_check_nrpe.php”
</p>
<p>
This option has effect only during creation of the RRD database.
The option “DATATYPE” controls the datatype which is used during creation of the RRD database. Default is “GAUGE”. For consecutive values the type should be “COUNTER”. Plugin-developers should use the unit “c” for counters but this is not always the case.
More datatypes are explained in the RRDTool documentation found at <ahref="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html"class="urlextern"title="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html"rel="nofollow">rrdcreate</a>.
</p>
<p>
This option has effect only during creation of the RRD database.
</p>
</div>
<h2><aname="use_min_on_create_and_use_max_on_create"id="use_min_on_create_and_use_max_on_create">USE_MIN_ON_CREATE and USE_MAX_ON_CREATE</a></h2>
<divclass="level2">
<p>
In a few situations it might be necessary to limit the values which are valid for RRDTool.
</p>
<p>
RRD databases can be created with fixed minimum and maximum values. You will find further details at <ahref="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html"class="urlextern"title="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html"rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html</a>.
</p>
<p>
Account for the maximum value taken from the performance data
</p>
<preclass="code">USE_MAX_ON_CREATE = 1</pre>
<p>
Account for the minimum value taken from the performance data
</p>
<preclass="code">USE_MIN_ON_CREATE = 1</pre>
<p>
This option has effect only during creation of the RRD database.
After <RRD_HEARTBEAT> seconds RRDtool expects new data.
</p>
<p>
More information at <ahref="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html"class="urlextern"title="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html"rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html</a>
</p>
<p>
This option has effect only during creation of the RRD database.
</p>
</div>
<h2><aname="hints_on_template_names"id="hints_on_template_names">Hints on Template Names</a></h2>
<divclass="level2">
<p>
In most situations, one can easily get desired template names, by using suitable command object definitions.
Even when using “CUSTOM_TEMPLATE = 1” one would end up in template names like “_usr_lib_nagios_plugins_check_load_-w_4,4,4_-c_5,5,5”, which is highly undesired, especially because of the parameters in it.
</p>
<p>
<strong>Solution 1: Split parameters into separate $ARGn$</strong>
</p>
<p>
A simple solution is to use the following command object definition:
Of course one must not set “CUSTOM_TEMPLATE = 1” in this way.
</p>
<p>
Which of above two solutions one follows is largely a matter of taste.
</p>
<p>
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/advanced"class="wikilink1"title="pnp-0.6:advanced">PNP in distributed environments</a>
If Nagios is implemented as a distributed system you have to decide where PNP should be installed.
</p>
<p>
From a technical view this question is not important. PNP can be installed on the slave(s) as well as on the master server. Or only on the master?
</p>
<p>
If PNP is running on the master you have to make sure that data passed via send_nsca from the slave server(s) contains performance data. Often another check command is used on the master.
</p>
<p>
To help PNP on the master to recognize which check command was used on the slave to collect the information process_perfdata.pl responds to an additional field at the end of the performance data.
If PNP finds a string enclosed in brackets at the end of performance data it will be recognized as check command and will be used as PNP template.
</p>
<p>
Nagios documentation related to this topic can be found
<ahref="http://nagios.sourceforge.net/docs/3_0/distributed.html"class="urlextern"title="http://nagios.sourceforge.net/docs/3_0/distributed.html"rel="nofollow">here</a>. The command used in the documentation can be adapted easily.
The plugin <ahref="http://my-plugin.de/wiki/projects/check_multi/start"class="urlextern"title="http://my-plugin.de/wiki/projects/check_multi/start"rel="nofollow">check_multi</a> is one of the first plugins which uses new features of Nagios 3.x. Check_multi can execute multiple Nagios plugins but returns only results like a single service. The output of check_multi comprises of several lines to be able to display the amount of information.
</p>
<p>
This results in some difficulties for PNP which has to extract the information of several plugins from the performance data. Together with Matthias Flacke, developer of check_multi, we have found a solution to assign the data to the appropriate plugins.
<ahref="/pnp-0.6/start"class="wikilink1"title="pnp-0.6:start">back to contents</a> | <ahref="/pnp-0.6/rrdcached"class="wikilink1"title="pnp-0.6:rrdcached">support of rrdcached</a>
In large installations sooner or later one will recognize that processing the performance data will result in a relatively high I/O load. RRDtool has to do very much disk updates but cannot use the disk cache in an optimal way.
</p>
<p>
One improvement is made by collecting and sorting the data. It is more effective to write many updates to an RRD database in one block. The disk cache can be used more effectively that way.
</p>
<p>
The current RRDtool ( <ahref="http://oss.oetiker.ch/rrdtool-trac/browser/trunk/program"class="urlextern"title="http://oss.oetiker.ch/rrdtool-trac/browser/trunk/program"rel="nofollow">SVN trunk 1550+</a> ) contains rrdcached which should improve exactly this situation.
</p>
<p>
At this point I'd like to thank Florian octo Forster, Kevin Brintnall and Tobi Oetiker. The development of this daemon has been coordinated exemplary on the <ahref="http://www.mail-archive.com/rrd-developers@lists.oetiker.ch/index.html"class="urlextern"title="http://www.mail-archive.com/rrd-developers@lists.oetiker.ch/index.html"rel="nofollow">rrd-developers</a> mailing list.
</p>
</div>
<h2><aname="mode_of_operation"id="mode_of_operation">Mode of operation</a></h2>
<divclass="level2">
<p>
The rrdcached is working as a daemon in the background and opens a UNIX or TCP socket to wait for requests of rrdtool. Due to security reasons newer versions of rrdcached cannot use absolute paths for network access anymore so the only possible way are unix sockets.
rrdcached recognizes some important options which are passed during startup.
</p>
<p>
Option -l defines the socket the daemon will listen for update requests. The default TCP port will be 42217.
</p>
<preclass="code">
-l unix:/path/to/rrdcached.sock
-l /path/to/rrdcached.sock
-l 127.0.0.1
-l 127.0.0.1:8888
</pre>
<p>
Option -P specifies which commands are usable with the RRD data bases
</p>
<preclass="code">-P FLUSH,PENDING</pre>
<p>
Option -s allows to change the group ownership of the unix socket
</p>
<preclass="code">-s nagios</pre>
<p>
Option -m sets the permissions of the unix socket in the usual octal format
</p>
<preclass="code">-m 0660</pre>
<p>
Option -w specifies the interval (in seconds) the data will be written to disk.
</p>
<preclass="code">-w 1800</pre>
<p>
Option -z defines a maximum delay which will be used to spread the write cycles over a certain range [0-delay] to avoid parallel write accesses. The value of option -z must not be larger than -w.
</p>
<preclass="code">-z 1800</pre>
<p>
Option -p defines a PID file
</p>
<preclass="code">-p /var/run/rrdcached.pid</pre>
<p>
Option -j defines the path to a journaling directory. All requests will be logged there so that they can be processed after a restart in case the daemon crashes.
</p>
<preclass="code">-j /var/cache/rrdcached</pre>
<p>
These options may result in a call of rrdcached with the following parameters
In large nagios installations, your average check latency may increase to a non-acceptable high value. This means that Nagios should do a check at time <code>x</code> but actually does it <code>y</code> seconds later.
</p>
<p>
If you tell the Nagios core that you want to process the performance data after every single check this is doing well for a certain amount of checks but above this limit you will run into latency problems.
</p>
<p>
To reduce the number of actions for each check you can use the <ahref="/pnp-0.6/modes#bulk_mode"class="wikilink1"title="pnp-0.6:modes">Bulk Mode</a> which gathers performance data for some time and then lets the <code>Nagios core</code> execute the <code><host|service>_perfdata_file_processing_command</code> or you can tell Nagios to just move the <code>perfdata_files</code> to a spool directory.
</p>
<p>
This move is a very fast action for the <code>Nagios core</code> and the <code>core</code> will be done with the processing of performance data and can continue to do what it should do: execute other checks, sending notifications, and so on.
</p>
</div>
<h2><aname="how_it_works"id="how_it_works">How it works</a></h2>
<divclass="level2">
<p>
As mentioned above the Nagios process has finished its work with moving the performance data file to a spool directory but this won't bring the data into the RRD files.
</p>
<p>
For this task you can start <code>npcd</code> to have a look at the defined spool directory and start an action for every file which is found.
</p>
<p>
After NPCD starts running it will build a list of filenames found in <code>perfdata_spool_dir</code> and starts new threads for every filename and executes the <code>perfdata_file_run_cmd</code> with the optional <code>perfdata_file_run_cmd_arg</code> as an additional argument.
</p>
<p>
Since the perfdata files in the spool dir are in the same format as for the 'normal' bulk mode NPCD should execute <code>process_perfdata.pl</code> in <ahref="/pnp-0.6/modes#bulk_mode"class="wikilink1"title="pnp-0.6:modes">Bulk Mode</a>.
<liclass="level1"><divclass="li"> Performance improvements for Nagios</div>
<ul>
<liclass="level2"><divclass="li"> because the performance data processing is detached from the <code>Nagios core</code> it has more time for its own work.</div>
</li>
</ul>
</li>
<liclass="level1"><divclass="li"> no lost data</div>
<ul>
<liclass="level2"><divclass="li"> as long as <code>Nagios</code> writes perfdata files to the spool dir your data won't get lost if NPCD dies or you forgot to start it after a system reboot. NPCD will start with the first file found (they are sorted by the $TIME_T$ macro in chronological order) and update your RRD Files.</div>
</li>
</ul>
</li>
</ul>
<p>
<strong>Con:</strong>
</p>
<ul>
<liclass="level1"><divclass="li"> no real time processing of performance data</div>
<ul>
<liclass="level2"><divclass="li"> since there is a delay in writing the performance data files by <code>Nagios</code> (<code>service_perfdata_file_processing_interval</code>)</div>
</li>
<liclass="level2"><divclass="li"> another delay exists within NPCD which waits for up to 10 seconds after each directory scanning</div>
<liclass="level3"><divclass="li"><imgsrc="/lib/images/smileys/icon_exclaim.gif"class="middle"alt=":!:"/> The command line will be created like this: <preclass="code"><perfdata_file_run_cmd><perfdata_file_run_cmd_args><filename_from_perfdata_spool_dir></pre>
Performance data is defined by Nagios as “everything after the | of the plugin output” - please refer to Nagios documentation for information on capturing this data to logfiles. However, it is the responsibility of the plugin writer to ensure the performance data is in a “Nagios plugins” format. This is the expected format:
<liclass="level1"><divclass="li"> space separated list of label/value pairs</div>
</li>
<liclass="level1"><divclass="li"><em>label</em> can contain any characters</div>
</li>
<liclass="level1"><divclass="li"> the single quotes for the label are optional. Required if spaces, = or ' are in the label</div>
</li>
<liclass="level1"><divclass="li"> label length is arbitrary, but ideally the first 19 characters are unique (due to a limitation in RRD). Be aware of a limitation in the amount of data that NRPE returns to Nagios</div>
</li>
<liclass="level1"><divclass="li"> to specify a quote character, use two single quotes</div>
</li>
<liclass="level1"><divclass="li"><em>warn</em>, <em>crit</em>, <em>min/ or </em>max/ may be null (for example, if the threshold is not defined or min and max do not apply). Trailing unfilled semicolons can be dropped</div>
</li>
<liclass="level1"><divclass="li"> min and max are not required if UOM=%</div>
</li>
<liclass="level1"><divclass="li"> value, min and max in class [-0-9.]. Must all be the same UOM</div>
</li>
<liclass="level1"><divclass="li"> warn and crit are in the range format (see Section 2.5). Must be the same UOM</div>
</li>
<liclass="level1"><divclass="li"> UOM (unit of measurement) is one of:</div>
<ul>
<liclass="level3"><divclass="li"> no unit specified - assume a number (int or float) of things (eg, users, processes, load averages)</div>
</li>
<liclass="level3"><divclass="li"> s - seconds (also us, ms)</div>