Imported Upstream version 0.6.24+dfsg1

This commit is contained in:
Mario Fetka
2017-05-20 15:26:21 +02:00
commit 32a360eca6
705 changed files with 87250 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -0,0 +1,186 @@
<h1><a name="ueber_pnp" id="ueber_pnp">&Uuml;ber PNP</a></h1>
<div class="level1">
</div>
<!-- SECTION "&Uuml;ber PNP" [1-26] -->
<h2><a name="anforderungen_an_plugins" id="anforderungen_an_plugins">Anforderungen an Plugins</a></h2>
<div class="level2">
<p>
PNP ben&ouml;tigt zwingend g&uuml;ltige Performancedaten von Nagios-Plugins.
</p>
<p>
Was sind also diese Performancedaten?
</p>
<p>
Die Ausgabe eines Nagios Plugins darf bis Nagios 2.x maximal eine Zeile betragen. Diese Ausgabe wird, wenn das Plugin Performancedaten liefert, in zwei Teile zerlegt. Als Trennzeichen dient dabei das Pipe “|” Symbol.
</p>
<p>
<strong>Beispiel check_icmp :</strong>
</p>
<pre class="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>
daraus ergibt sich der Output auf der linken Seite des Pipe-Symbols
</p>
<pre class="code"> OK - 127.0.0.1: rta 2.687ms, lost 0%</pre>
<p>
und die Performancedaten
</p>
<pre class="code"> rta=2.687ms;3000.000;5000.000;0; pl=0%;80;100;;</pre>
<p>
Wie man unschwer erkennt, sind die Performancedaten auf die maschinelle Verarbeitung ausgelegt. Das Format ist in den
<a href="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" class="urlextern" title="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" rel="nofollow">Developer Guidelines</a>
festgelegt (einen Auszug davon gibt es <a href="/de/pnp-0.6/perfdata_format" class="wikilink1" title="de:pnp-0.6:perfdata_format">an dieser Stelle</a>), es soll aber hier noch einmal kurz erl&auml;utert werden.
</p>
<pre class="code"> rta=2.687ms;3000.000;5000.000;0;
| | | | | | |
|----|--|----|---------|-----|-|----- * Label
|--|----|---------|-----|-|----- * Aktueller Wert
|----|---------|-----|-|----- Einheit ( UOM = UNIT of Measurement )
|---------|-----|-|----- Warning Schwellwert
|-----|-|----- Critical Schwellwert
|-|----- Minimum Wert
|----- Maximum Wert
</pre>
<p>
Mit * gekennzeichnete Werte m&uuml;ssen vorhanden sein. Alle anderen Werte sind optional.
</p>
<p>
Mehrere Datenreihen werden durch Leerzeichen getrennt. Die eigentlichen Daten d&uuml;rfen also keine Leerzeichen enthalten. Soll das Label Leerzeichen enthalten, so m&uuml;ssen diese in einfache Hochkomma eingeschlossen werden.
</p>
</div>
<!-- SECTION "Anforderungen an Plugins" [27-1903] -->
<h2><a name="benoetigte_software" id="benoetigte_software">Ben&ouml;tigte Software</a></h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> <acronym title="Practical Extraction and Report Language">Perl</acronym> &gt;= 5.x ohne besondere Module</div>
</li>
<li class="level1"><div class="li"> RRDtool ab 1.x; besser 1.2, aber nicht zwingend.<br/>
Achtung: wird RRDtool ohne Paket-Manager installiert, fehlen anschließend m&ouml;glicherweise die dejavu-Fonts. Das &auml;ußert sich z.B. durch fehlende Schriften in den Grafiken</div>
</li>
<li class="level1"><div class="li"> <acronym title="Hypertext Preprocessor">PHP</acronym> &gt;= 5.1.6 f&uuml;r das Webfrontend basierend auf <a href="http://www.kohanaphp.com" class="urlextern" title="http://www.kohanaphp.com" rel="nofollow">Kohana</a></div>
</li>
<li class="level1"><div class="li"> Nagios &gt;= 2.x oder Icinga</div>
</li>
<li class="level1"><div class="li"> f&uuml;r Kohana muss außerdem das Modul “mod_rewrite” in der Web-Server-Konfiguration aktiviert sein. Einzelheiten sind in der Web-Server-Dokumentation der entsprechenden Distribution nachzulesen.</div>
</li>
</ul>
</div>
<!-- SECTION "Ben&ouml;tigte Software" [1904-2519] -->
<h2><a name="lizenz" id="lizenz">Lizenz</a></h2>
<div class="level2">
<p>
PNP ist unter der <a href="http://www.gnu.de/documents/gpl-2.0.de.html" class="urlextern" title="http://www.gnu.de/documents/gpl-2.0.de.html" rel="nofollow">GPL 2</a> lizensiert.
</p>
</div>
<!-- SECTION "Lizenz" [2520-2625] -->
<h2><a name="download" id="download">Download</a></h2>
<div class="level2">
<p>
Die Entwicklung von PNP wird auf <a href="http://sourceforge.net/projects/pnp4nagios" class="urlextern" title="http://sourceforge.net/projects/pnp4nagios" rel="nofollow">Sourceforge.Net</a> organisiert. PNP ist dort unter dem Projektnamen “PNP4Nagios” registriert.
</p>
<p>
Die jeweils aktuelle (stabile) Version findet ihr im <a href="http://sourceforge.net/project/showfiles.php?group_id=191615" class="urlextern" title="http://sourceforge.net/project/showfiles.php?group_id=191615" rel="nofollow">Downloadbereich</a>.
</p>
<p>
Wer noch aktueller sein m&ouml;chte, kann auch die jeweils letzte Entwickler-Version benutzen.
</p>
<p>
Mit der Version 0.6.x wurde von SVN auf GIT zum Verwalten des Sourcecodes gewechselt.
</p>
<p>
Die aktuelle Entwicklung ist jederzeit unter <a href="https://github.com/lingej/pnp4nagios" class="urlextern" title="https://github.com/lingej/pnp4nagios" rel="nofollow">https://github.com/lingej/pnp4nagios</a> einzusehen. Beim Klicken auf <a href="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> wird ein Archiv mit der letzten Version heruntergeladen.
</p>
</div>
<!-- SECTION "Download" [2626-3395] -->
<h2><a name="support" id="support">Support</a></h2>
<div class="level2">
<p>
VOR dem Stellen von Support-Anfragen sollte sichergestellt werden, dass die unter <a href="http://docs.pnp4nagios.org/de/pnp-0.6/verify" class="urlextern" title="http://docs.pnp4nagios.org/de/pnp-0.6/verify" rel="nofollow">http://docs.pnp4nagios.org/de/pnp-0.6/verify</a> genannten Punkte gepr&uuml;ft wurden.
</p>
<p>
Die Entwickler und Helfer sind im Nagios-Portal unter <a href="http://www.nagios-portal.org" class="urlextern" title="http://www.nagios-portal.org" rel="nofollow">http://www.nagios-portal.org</a> vertreten.
Dort gibt es einen eigenen Bereich zum Thema PNP.<br/>
Bei Support-Anfragen bitte das Betriebssystem und die PNP-Version angeben. Außerdem ist es wichtig, ob PNP aus den Sourcen erstellt oder ein vorgefertigtes Paket verwendet wurde.
</p>
<p>
Erfolgreich gel&ouml;ste Probleme bitte mit einem [solved] in der Betreffzeile des ersten Beitrags kennzeichnen. Auf diese Weise erleichtern wir anderen Benutzern das Finden von L&ouml;sungen zu einem Problem.
</p>
<p>
Weiterhin k&ouml;nnen die Mailinglisten auf Sourceforge verwendet werden. Dort ist es jedoch &uuml;blich, Fragen auf Englisch zu stellen.
</p>
<p>
<a href="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-users" class="urlextern" title="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-users" rel="nofollow">pnp4nagios-users</a>: Die Users-Liste f&uuml;r allgemeine Fragen zur Konfiguration.
</p>
<p>
<a href="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-devel" class="urlextern" title="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-devel" rel="nofollow">pnp4nagios-devel</a>: Die Devel-Liste f&uuml;r Anregungen und Fehler Reports.
</p>
<p>
<a href="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-checkins" class="urlextern" title="https://lists.sourceforge.net/lists/listinfo/pnp4nagios-checkins" rel="nofollow">pnp4nagios-checkins</a>: Auf der Checkins-Liste werden &Auml;nderungen im SVN-Repository automatisch ver&ouml;ffentlicht.
</p>
</div>
<!-- SECTION "Support" [3396-4710] -->
<h2><a name="datenhaltung" id="datenhaltung">Datenhaltung</a></h2>
<div class="level2">
<p>
Die Performance-Daten werden mit Hilfe von <a href="http://www.rrdtool.org" class="urlextern" title="http://www.rrdtool.org" rel="nofollow">RRDtool</a> in sogenannten Round-Robin-Datenbanken gespeichert, die wie ein Ringpuffer funktionieren. Das bedeutet, dass nach einer gewissen Zeit die &auml;ltesten Daten “hinten” herausfallen und “vorne” durch neue ersetzt werden.
</p>
<p>
Verschiedene Zeitintervalle innerhalb der Datei sorgen f&uuml;r unterschiedliche Aufl&ouml;sungen. In der Standardeinstellung k&ouml;nnen die Daten f&uuml;r die letzten zwei Tage im Minutenabstand abgelegt werden, f&uuml;r zehn Tage im 5-Minutenabstand, f&uuml;r 90 Tage im 30-Minutenabstand und f&uuml;r 4 Jahre im 6-Stundenabstand. Die Vergr&ouml;ßerung des Intervalls bewirkt, dass auch die Daten &uuml;ber das jeweils gr&ouml;ßere Intervall hinweg gemittelt werden. Das f&uuml;hrt automatisch dazu, dass Spitzen nicht mehr so deutlich zu sehen sind. Das ist kein Fehler von PNP, sondern eine Eigenheit von RRDtool. Dazu gibt es auch einen <a href="http://www.linux-magazin.de/Heft-Abo/Ausgaben/2004/06/Daten-ausgesiebt" class="urlextern" title="http://www.linux-magazin.de/Heft-Abo/Ausgaben/2004/06/Daten-ausgesiebt" rel="nofollow">Artikel im Linux-Magazin</a>.
</p>
<p>
Durch die Speicherung in diesem Format &auml;ndert sich die Dateigr&ouml;ße nach dem Anlegen nicht mehr. Pro Datenreihe werden ca. 400 KB ben&ouml;tigt.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">Zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/modes" class="wikilink1" title="de:pnp-0.6:modes">PNP-Modi</a>
</p>
</div>
<!-- SECTION "Datenhaltung" [4711-] -->

View File

@@ -0,0 +1,81 @@
<h1><a name="advanced" id="advanced">Advanced</a></h1>
<div class="level1">
</div>
<!-- SECTION "Advanced" [1-24] -->
<h2><a name="verteilte_systeme" id="verteilte_systeme">Verteilte Systeme</a></h2>
<div class="level2">
<p>
Ist Nagios als verteiltes System implementiert, stellt sich die Frage, wo PNP installiert wird.
</p>
<p>
Rein technisch ist diese Frage nicht wichtig. PNP kann auf den Slaves sowie auf dem Master-Server installiert sein. Oder nur auf dem Master?
</p>
<p>
Wird PNP auf dem Master betrieben, ist jedoch bei der &Uuml;bergabe der Daten via send_nsca von den Slave-Servern zum Master darauf zu achten, dass auch die Performance-Daten &uuml;bergeben werden. Weiterhin kommt auf dem Master oft nicht das Original-Check-Command zum Einsatz.
</p>
<p>
Damit nun aber PNP auf dem Master noch erkennen kann, welches Check-Command auf den Slaves die Daten ermittelt hat, reagiert process_perfdata.pl auf ein zus&auml;tzliches Feld am Ende der Performance-Daten.
</p>
<pre class="code">OK - 127.0.0.1: rta 2.687ms, lost 0% | rta=2.687ms;3000.000;5000.000;0; pl=0%;80;100;; [check_icmp]</pre>
<p>
Findet PNP am Ende der Performance Daten einen in eckigen Klammern eingeschlossenen Text, so wird dieser als Check-Command und somit als PNP-Template verwendet.
</p>
<p>
Die Nagios-Dokumentation zu diesem Thema ist <a href="http://www.nagios-wiki.de/nagios/doku3/distributed" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/distributed" rel="nofollow">hier</a> zu finden. Das in der Doku verwendete Command ist leicht anzupassen.
</p>
<p>
Aus
</p>
<pre class="code">
define command{
command_name submit_check_result
command_line /usr/local/nagios/libexec/eventhandlers/submit_check_result $HOSTNAME$ &#039;$SERVICEDESC$&#039; $SERVICESTATE$ &#039;$SERVICEOUTPUT$&#039;
}
</pre>
<p>
wird
</p>
<pre class="code">
define command{
command_name submit_check_result
command_line /usr/local/nagios/libexec/eventhandlers/submit_check_result $HOSTNAME$ &#039;$SERVICEDESC$&#039; $SERVICESTATE$ &#039;$SERVICEOUTPUT$ | $SERVICEPERFDATA$ [$SERVICECHECKCOMMAND$]&#039;
}
</pre>
</div>
<!-- SECTION "Verteilte Systeme" [25-1689] -->
<h2><a name="das_check_multi-plugin" id="das_check_multi-plugin">Das check_multi-Plugin</a></h2>
<div class="level2">
<p>
Das Plugin <a href="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> ist eines der ersten Plugins, das die Funktionen von Nagios 3.0 richtig aussch&ouml;pft. Check_Multi ist in der Lage, mehrere Nagios-Plugins auszuf&uuml;hren, aber f&uuml;r Nagios als einen Service darzustellen. Die Ausgabe von check_multi erfolgt &uuml;ber mehrere Zeilen, um die Masse an Informationen wieder darstellen zu k&ouml;nnen.
</p>
<p>
Daraus ergaben sich jedoch einige Schwierigkeiten f&uuml;r PNP. PNP muss aus den Performance-Daten wieder die Daten der einzelnen Plugins ermitteln k&ouml;nnen. Zusammen mit Matthias Flacke, dem Entwickler von check_multi, haben wir jedoch recht schnell eine M&ouml;glichkeit gefunden, die Daten wieder sauber den einzelnen Plugins zuzuordnen.
</p>
<p>
<a href="/lib/exe/fetch.php?hash=a9e001&amp;media=http%3A%2F%2Fmy-plugin.de%2Fwiki%2F_media%2Fcheck_multi%2Fperformance%2Fmulti_labels.png" class="media" title="http://my-plugin.de/wiki/_media/check_multi/performance/multi_labels.png"><img src="/lib/exe/fetch.php?hash=a9e001&amp;w=300&amp;media=http%3A%2F%2Fmy-plugin.de%2Fwiki%2F_media%2Fcheck_multi%2Fperformance%2Fmulti_labels.png" class="media" alt="" width="300" /></a>
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">Zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/rrdcached" class="wikilink1" title="de:pnp-0.6:rrdcached">rrdcached-Unterst&uuml;tzung</a>
</p>
</div>
<!-- SECTION "Das check_multi-Plugin" [1690-] -->

View File

@@ -0,0 +1,423 @@
<h1><a name="konfiguration" id="konfiguration">Konfiguration</a></h1>
<div class="level1">
<p>
Im Folgenden wird die Konfiguration der bereits erw&auml;hnten <a href="/de/pnp-0.6/modes" class="wikilink1" title="de:pnp-0.6:modes">Arten der Performance-Daten Verarbeitung</a> genauer erkl&auml;rt.
</p>
<p>
Die bevorzugte Methode der PNP-Entwickler ist der “Bulk Mode mit NPCD und npcdmod”.
</p>
</div>
<!-- SECTION "Konfiguration" [1-243] -->
<h2><a name="synchronous_mode" id="synchronous_mode">Synchronous Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/synchronous.png?id=de%3Apnp-0.6%3Aconfig" class="media" title="synchronous.png"><img src="/_media/synchronous.png?w=150" class="mediaright" align="right" alt="" width="150" /></a>Der Synchronous-Mode ist die einfachste Art, den Datensammler <code>process_perfdata.pl</code> in Nagios zu integrieren. Hierbei wird bei jedem Ereignis ein gesondertes Command <code>process-service-perfdata</code> (bzw. <code>process-host-perfdata</code>) ausgef&uuml;hrt.
</p>
<p>
Grunds&auml;tzlich ist in der <code>nagios.cfg</code> die Verarbeitung der Performance-Daten zu aktivieren. Bitte beachten Sie, dass diese Direktive wahrscheinlich bereits in der Konfigurationsdatei enthalten ist (Default ist “0”).
</p>
<pre class="code"> process_performance_data=1</pre>
<p>
F&uuml;r jeden Host und jeden Service, f&uuml;r den KEINE Performance-Daten verarbeitet werden sollen, ist die Verarbeitung der Performance-Daten explizit auszuschalten.
</p>
<pre class="code">
define service {
...
process_perf_data 0
...
}
</pre>
<p>
Weiterhin ist es ab Nagios 3.x m&ouml;glich, in der <code>nagios.cfg</code> das Exportieren der Environment-Variablen zu deaktivieren. Diese sind jedoch f&uuml;r den Synchronous-Mode zwingend erforderlich. Daher muss
</p>
<pre class="code">enable_environment_macros=1</pre>
<p>
ebenfalls in der <code>nagios.cfg</code> gesetzt sein.
</p>
<p>
Zus&auml;tzlich wird das Kommando zum Verarbeiten der Performance-Daten in der <code>nagios.cfg</code> angegeben.
</p>
<pre class="code"> service_perfdata_command=process-service-perfdata</pre>
<p>
Ab Nagios 3.x ist es durchaus sinnvoll, auch die Verarbeitung der Performance-Daten f&uuml;r Hosts einzuschalten. Nagios 3 f&uuml;hrt durch die ge&auml;nderte Hostcheck-Logik nun auch die Pr&uuml;fung der Hosts regelm&auml;ßig aus.
</p>
<pre class="code"> host_perfdata_command=process-host-perfdata</pre>
<p>
Die referenzierten Commands m&uuml;ssen nat&uuml;rlich auch Nagios bekannt gegeben werden. Wie man sieht, sind f&uuml;r den Aufruf von process_perfdata.pl so gut wie keine Optionen n&ouml;tig. Einzig bei Performance-Daten der Host-Checks ist die Option -d ( DATATYPE ) n&ouml;tig. Wenn Sie die <a href="http://www.nagios-wiki.de/nagios/doku3/quickstart" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/quickstart" rel="nofollow">Schnellstart-Installationsanleitungen</a> f&uuml;r Nagios benutzt haben, k&ouml;nnen Sie die Definitionen in der Datei commands.cfg anpassen.
</p>
<pre class="code">
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
</pre>
<p>
<strong>HINWEIS:</strong> <code>process_perfdata.pl</code> kann nicht unter Kontrolle des ePN ( embedded <acronym title="Practical Extraction and Report Language">Perl</acronym> Nagios ) gestartet werden. Daher wird das Script explizit mit <code>/usr/bin/perl</code> aufgerufen. Wird ePN nicht verwendet oder wird Nagios 3.x verwendet, kann auf die Angabe von <code>/usr/bin/perl</code> verzichtet werden.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/verify" class="wikilink1" title="de:pnp-0.6:verify">Funktion pr&uuml;fen</a>
</p>
</div>
<!-- SECTION "Synchronous Mode" [244-2887] -->
<h2><a name="bulk_mode" id="bulk_mode">Bulk Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk.png?id=de%3Apnp-0.6%3Aconfig" class="media" title="bulk.png"><img src="/_media/bulk.png?w=150" class="mediaright" align="right" alt="" width="150" /></a>Der Bulk-Mode ist etwas komplizierter als der Synchronous-Mode, reduziert die Last auf dem Nagios Server jedoch merklich, da nun nicht mehr f&uuml;r jeden Service bzw. Host zus&auml;tzlich der Datensammler <code>process_perfdata.pl</code> gestartet werden muss.
</p>
<p>
Im Bulk-Mode schreibt Nagios die Daten in einem definierten Format in eine tempor&auml;re Datei. Diese Datei wiederum wird periodisch von <code>process_perfdata.pl</code> verarbeitet. Um den Start und den Intervall k&uuml;mmert sich dabei Nagios selbst.
</p>
<p>
Auch hier muss die Verarbeitung der Performance-Daten in der <code>nagios.cfg</code> eingeschaltet werden.
</p>
<pre class="code"> process_performance_data=1</pre>
<p>
Zus&auml;tzlich werden einige neue Parameter ben&ouml;tigt.
</p>
<pre class="code">
#
# Service Performance-Daten
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# Host Performance-Daten ab Nagios 3.x
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
</pre>
<p>
<strong>Achtung:</strong> Die Template-Definitionen weichen von denen in der Original-nagios.cfg ab!
</p>
<p>
Die Parameter und deren Bedeutung im Einzelnen:
</p>
<ul>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file</strong></code> Der Pfad zur tempor&auml;ren Datei, in der die Daten gesammelt werden sollen.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_template</strong></code> Das Format der tempor&auml;ren Datei. Hier werden die Daten &uuml;ber Nagios-Macros definiert.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_mode</strong></code> Die Option “a” definiert, dass an die Datei angehangen werden soll.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_processing_interval</strong></code> Das Intervall betr&auml;gt 15 Sekunden</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_processing_command</strong></code> das Command, das im definierten Intervall aufgerufen werden soll.</div>
</li>
</ul>
<p>
Die verwendeten Commands m&uuml;ssen Nagios wiederum bekannt gegeben werden. Wenn Sie die <a href="http://www.nagios-wiki.de/nagios/doku3/quickstart" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/quickstart" rel="nofollow">Schnellstart-Installationsanleitungen</a> f&uuml;r Nagios benutzt haben, k&ouml;nnen Sie die Definitionen in der Datei commands.cfg anpassen.
</p>
<pre class="code">
define command{
command_name process-service-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata
}
define command{
command_name process-host-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host-perfdata
}
</pre>
<div class="box" style="width: 90%; ">
<b class='xtop'><b class='xb1'></b><b class='xb2'></b><b class='xb3'></b><b class='xb4'></b></b>
<div class='xbox'>
<p class='box_title'><strong>HINWEIS:</strong></p>
<div class='box_content'> Da <code>process_perfdata.pl</code> nun mehr Daten zu verarbeiten hat als im Default Mode, kommt es nat&uuml;rlich auch zu l&auml;ngeren Laufzeiten. Daher ist der TIMEOUT Wert in der <code>etc/process_perfdata.cfg</code> zu &uuml;berpr&uuml;fen und ggf. anzupassen.</div>
</div>
<b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b>
</div>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/verify" class="wikilink1" title="de:pnp-0.6:verify">Funktion pr&uuml;fen</a>
</p>
</div>
<!-- SECTION "Bulk Mode" [2888-6319] -->
<h2><a name="bulk_mode_with_npcd" id="bulk_mode_with_npcd">Bulk Mode with NPCD</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk-npcd.png?id=de%3Apnp-0.6%3Aconfig" class="media" title="bulk-npcd.png"><img src="/_media/bulk-npcd.png?w=150" class="mediaright" align="right" alt="" width="150" /></a>Die Konfiguration ist identisch mit dem “Bulk Mode”, einzig das verwendete Command ist leicht abgewandelt.
</p>
<p>
Auch hier muss die Verarbeitung der Performance-Daten in der <code>nagios.cfg</code> eingeschaltet werden.
</p>
<pre class="code"> process_performance_data=1</pre>
<p>
Zus&auml;tzlich werden einige neue Parameter ben&ouml;tigt.
</p>
<pre class="code">
#
# Service Performance-Daten
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# Host Performance-Daten ab Nagios 3.x
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
</pre>
<p>
<strong>Achtung:</strong> Die Template-Definitionen weichen von denen in der Original-nagios.cfg ab!
</p>
<p>
Die Parameter und deren Bedeutung im Einzelnen:
</p>
<ul>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file</strong></code> Der Pfad zur tempor&auml;ren Datei, in der die Daten gesammelt werden sollen.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_template</strong></code> Das Format der tempor&auml;ren Datei. Hier werden die Daten &uuml;ber Nagios-Macros definiert.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_mode</strong></code> Die Option “a” definiert, dass an die Datei angehangen werden soll.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_processing_interval</strong></code> Das Intervall betr&auml;gt 15 Sekunden</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_processing_command</strong></code> das Command, das im definierten Intervall aufgerufen werden soll.</div>
</li>
</ul>
<p>
Die verwendeten Commands m&uuml;ssen Nagios wiederum bekannt gegeben werden. Wenn Sie die <a href="http://www.nagios-wiki.de/nagios/doku3/quickstart" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/quickstart" rel="nofollow">Schnellstart-Installationsanleitungen</a> f&uuml;r Nagios benutzt haben, k&ouml;nnen Sie die Definitionen in der Datei commands.cfg anpassen.
</p>
<pre class="code">
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
</pre>
<p>
Durch die Kommandos wird immer nach Ablauf des &uuml;ber <code><strong>service_perfdata_file_processing_interval</strong></code> eingestellten Intervalls die Datei service-perfdata nach var/spool/ verschoben. Dabei wird das Nagios-Macro $TIMET$ verwendet, an den Dateinamen angeh&auml;ngt, um zu verhindern, dass alte Dateien ungewollt &uuml;berschrieben werden. Das Macro $TIMET$ enth&auml;lt den aktuellen Zeitstempel in Unix-Time-Format ( Sekunden seit 1.1.1970 ).
</p>
<p>
Somit sammeln sich Dateien im Verzeichnis /usr/local/pnp4nagios/var/spool/, die nun mit Hilfe des NPCD verarbeitet werden.
</p>
<p>
NPCD &uuml;berwacht das Spool-Verzeichnis und &uuml;bergibt wiederum alle gefundenen Dateien an <code>process_perfdata.pl</code>. Damit ist die Verarbeitung der Performancedaten komplett von Nagios entkoppelt. Wir m&uuml;ssen nur noch den NPCD starten.
</p>
<pre class="code"> /usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg</pre>
<p>
Die Option <code>-d</code> veranlasst NPCD im Hintergund als Daemon seinen Dienst zu verrichten.
</p>
<p>
Das Init Script f&uuml;r den NPCD wir w&auml;hrend der Installation &uuml;ber “make install-init” installiert und kann somit auch f&uuml;r den Start verwendet werden.
</p>
<pre class="code"> /etc/init.d/npcd start</pre>
<p>
In der Config-Datei des NPCD, der <code>npcd.cfg</code>, ist vor dem ersten Start zu pr&uuml;fen, ob die Pfade zum Spool-Verzeichnis und zu <code>process_perfdata.pl</code> richtig gesetzt sind.
</p>
<p>
Weitere Informationen zu NPCD findet ihr <a href="/de/pnp-0.6/npcd" class="wikilink1" title="de:pnp-0.6:npcd">hier</a>.
</p>
</div>
<!-- SECTION "Bulk Mode with NPCD" [6320-10440] -->
<h2><a name="bulk_mode_with_npcd_und_npcdmod" id="bulk_mode_with_npcd_und_npcdmod">Bulk Mode with NPCD und npcdmod</a></h2>
<div class="level2">
<p>
<strong>Achtung</strong>
<em>Beginnend mit Nagios 4 haben sich die internen Strukturen ge&auml;ndert, so dass der Start des Moduls fehlschl&auml;gt. Bisher gibt es keine Pl&auml;ne, Nagios 4 zu unterst&uuml;tzen. Bitte w&auml;hlen Sie einen der anderen Modi.</em>
</p>
<p>
<a href="/_detail/bulk-npcdmod.png?id=de%3Apnp-0.6%3Aconfig" class="media" title="bulk-npcdmod.png"><img src="/_media/bulk-npcdmod.png?w=150" class="mediaright" align="right" alt="" width="150" /></a> Bei diesem Modus kommt das Eventbroker-Modul npcdmod.o zu Einsatz. Der Datenfluss ist jedoch identisch zum “Bulk Mode mit NPCD”. Die internen Perfdata-Routinen von Nagios, die &uuml;ber die “*_perf_data_*” Optionen in der <code>nagios.cfg</code> konfiguriert werden, kommen <strong>NICHT</strong> mehr zu Einsatz. Das Modul npcdmod.o k&uuml;mmert sich um die f&uuml;r PNP n&ouml;tige Aufbereitung der Daten.
</p>
<p>
Vorteil:
</p>
<ul>
<li class="level1"><div class="li"> Die Perfdata-Routinen innerhalb von Nagios stehen wieder f&uuml;r andere Addons zur Verf&uuml;gung.</div>
</li>
<li class="level1"><div class="li"> Die Konfiguration reduziert sich.</div>
</li>
<li class="level1"><div class="li"> Die bevorzugte Methode der PNP-Entwickler.</div>
</li>
</ul>
<p>
Anpassung in der <code>nagios.cfg</code>:
</p>
<pre class="code">
process_performance_data=1
broker_module=/usr/local/pnp4nagios/lib/npcdmod.o config_file=/usr/local/pnp4nagios/etc/npcd.cfg
</pre>
<p>
Alle anderen auf dieser Seite gezeigten Optionen d&uuml;rfen f&uuml;r diesen Modus <strong>NICHT</strong> mehr verwendet werden.
</p>
<p>
<strong>Achtung:</strong> Wichtig sind in diesem Zusammenhang auch die <code>event_broker_options</code> bei einem von -1 abweichenden Wert. F&uuml;r PNP m&uuml;ssen die Bits 2 und 3 gesetzt sein (0b01100; siehe auch <a href="http://www.nagios-wiki.de/nagios/ndo/eventbroker_optionen" class="urlextern" title="http://www.nagios-wiki.de/nagios/ndo/eventbroker_optionen" rel="nofollow">http://www.nagios-wiki.de/nagios/ndo/eventbroker_optionen</a>).
</p>
<p>
Nach dem Neustart von Nagios werden Informationen zum Ladevorgang des Moduls protokolliert.
</p>
<p>
Auszug aus den nagios.log
</p>
<pre class="code">
[1277545053] npcdmod: Copyright (c) 2008-2009 Hendrik Baecker (andurin@process-zero.de) - http://www.pnp4nagios.org
[1277545053] npcdmod: /usr/local/pnp4nagios/etc/npcd.cfg initialized
[1277545053] npcdmod: spool_dir = &#039;/usr/local/pnp4nagios/var/spool/&#039;.
[1277545053] npcdmod: perfdata file &#039;/usr/local/pnp4nagios/var/perfdata.dump&#039;.
[1277545053] npcdmod: Ready to run to have some fun!
[1277545053] Event broker module &#039;/usr/local/pnp4nagios/lib/npcdmod.o&#039; initialized successfully.
</pre>
</div>
<!-- SECTION "Bulk Mode with NPCD und npcdmod" [10441-12453] -->
<h2><a name="gearman_mode" id="gearman_mode">Gearman Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/gearman.png?id=de%3Apnp-0.6%3Aconfig" class="media" title="gearman.png"><img src="/_media/gearman.png?w=150" class="mediaright" align="right" alt="" width="150" /></a>
</p>
<p>
PNP4Nagios kann seit Version 0.6.12 als Gearman-Worker betrieben werden. So sind große verteilte Nagios-Umgebungen auf Basis von mod_gearman realisierbar. Außerdem kann man dadurch Nagios und PNP4Nagios auf unterschiedliche Rechner verteilen.
</p>
<p>
Ben&ouml;tigt wird eine fertig eingerichtete mod_gearman Installation wie von Sven Nierlein unter <a href="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> beschrieben.
</p>
<p>
In <code>etc/process_perfdata.cfg</code> gibt es einen gearman-Abschnitt:
</p>
<pre class="code"> PREFORK = 1
GEARMAN_HOST = localhost:4730
REQUESTS_PER_CHILD = 10000
ENCRYPTION = 1
KEY = should_be_changed
#KEY_FILE = /usr/local/pnp4nagios/etc/secret.key
</pre>
<p>
Dort ist mit <code>PREFORK = &lt;n&gt;</code> die Anzahl der zu startenden Kindprozessen anzugeben.
</p>
<p>
<code>GEARMAN_HOST = &lt;host&gt;:&lt;port&gt;</code> definiert Rechner und Port, auf dem der gearman-Daemon die Daten bereitstellt.
&Uuml;ber <code>REQUESTS_PER_CHILD = &lt;n&gt;</code> kann die maximal zu verarbeitende Anzahl von Anforderungen pro Prozess eingestellt werden.
</p>
<p>
<code>ENCRYPTION = &lt;1|0&gt;</code> stellt ein, ob Verschl&uuml;sselung benutzt werden soll. Die Standardeinstellung ist eine aktivierte Verschl&uuml;sselung (“1”) und das sollte nur in Ausnahmef&auml;llen ver&auml;ndert werden.
Dabei kann entweder &uuml;ber <code>KEY = &lt;Schl&uuml;ssel&gt;</code> der zu benutzende Schl&uuml;ssel definiert oder per <code>KEY_FILE = &lt;Schl&uuml;sseldatei&gt;</code> der Standort einer Schl&uuml;sseldatei angegeben werden.
</p>
<p>
<code>/etc/init.d/pnp_gearman_worker</code> enth&auml;lt Verweise auf die <acronym title="Practical Extraction and Report Language">Perl</acronym>-Prozedur <code>process_perfdata.pl</code> sowie die Konfigurationsdatei <code>process_perfdata.cfg</code>.
</p>
<p>
Nach dem Start des PNP-Daemons per
</p>
<pre class="code"> /etc/init.d/pnp_gearman_worker start</pre>
<p>
werden die Performance-Daten verarbeitet, die &uuml;ber den gearmand-Daemon auf dem Nagios-Rechner zur Verf&uuml;gung gestellt werden.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/verify" class="wikilink1" title="de:pnp-0.6:verify">Funktion pr&uuml;fen</a>
</p>
</div>
<!-- SECTION "Gearman Mode" [12454-] -->

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
en_US/dwnld.html

View File

@@ -0,0 +1,208 @@
<h1><a name="installation" id="installation">Installation</a></h1>
<div class="level1">
<p>
Im Folgenden wird die Installation von PNP beschrieben. Dabei wird davon ausgegangen, dass Nagios aus den Sourcen &uuml;bersetzt und im Verzeichnis /usr/local/nagios installiert wurde.<br/>
<strong>Achtung:</strong> Die Beschreibung bezieht sich auf die Developer-Version PNP 0.6.0.<br/>
Bitte vergessen Sie nicht, dass PNP nach der Installation noch konfiguriert werden muss.
</p>
</div>
<!-- SECTION "Installation" [1-385] -->
<h2><a name="make_und_co" id="make_und_co">Make und Co</a></h2>
<div class="level2">
<p>
Die Installation von PNP wird wie bei Nagios auch &uuml;ber <a href="http://de.wikipedia.org/wiki/Makefile" class="interwiki iw_wpde" title="http://de.wikipedia.org/wiki/Makefile">Makefile</a>s gesteuert. Dabei wird durch den Aufruf von ./configure das System analysiert und die ermittelten Werte in Makefiles &uuml;bernommen.
</p>
<p>
Als User root wird PNP in /usr/local/src entpackt.
</p>
<pre class="code">
tar -xvzf pnp4nagios-HEAD.tar.gz
cd pnp4nagios
</pre>
<p>
Im Verzeichnis pnp4nagios wird nun ./configure aufgerufen.
</p>
<pre class="code">
./configure
</pre>
<p>
<strong>Hinweis:</strong> Ohne weitere Optionen werden als Benutzer und Gruppe “nagios” verwendet. Bei abweichenden Werten sind die Parameter ”--with-nagios-user” und ”--with-nagios-group” zu benutzen. Im Falle von Icinga k&ouml;nnte der Aufruf so aussehen
</p>
<pre class="code">
./configure --with-nagios-user=icinga --with-nagios-group=icinga
</pre>
<p>
Es laufen einige Zeilen &uuml;ber den Bildschirm. Wichtig ist die Ausgabe zum Schluss.
</p>
<pre class="code">
*** Configuration summary for pnp4nagios-0.6.2 23-12-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/pnp4nagios/share
Config Dir: /usr/local/pnp4nagios/etc
Location of rrdtool binary: /usr/bin/rrdtool Version 1.2.12
RRDs Perl Modules: FOUND (Version 1.2012)
RRD Files stored in: /usr/local/pnp4nagios/var/perfdata
process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options: ------------------------- -------------------
HTML URL: http://localhost/pnp4nagios/
Apache Config File: /etc/apache2/conf.d/pnp4nagios.conf
Review the options above for accuracy. If they look okay,
type &#039;make all&#039; to compile.</pre>
<p>
Die angezeigten Pfade sollten nun gepr&uuml;ft werden. Falls die gezeigten Werte nicht passen, kann durch einen erneuten Aufruf von ./configure mit den passenden Optionen Abhilfe geschaffen werden.<br/>
<strong>ACHTUNG:</strong> Nachdem es immer wieder Schwierigkeiten gibt: “Location of rrdtool binary” bedeutet inkl. Namen des Binary! Bei Bedarf kann man das beim ./configure als Parameter angeben:
</p>
<pre class="code"> ./configure --with-rrdtool=/usr/local/rrdtool-1.2.xx/bin/rrdtool</pre>
<pre class="code"> ./configure --help </pre>
<p>
zeigt, welche Optionen m&ouml;glich sind.<br/>
<br/>
Ein
</p>
<pre class="code">make all</pre>
<p>
kompiliert nun die in C geschriebenen Komponenten wie NPCD
</p>
<pre class="code">make install</pre>
<p>
kopiert alles an die richtige Stelle im Filesystem. Die Pfade wurden ja beim ./configure bereits gezeigt.
</p>
<p>
Nach der Installation der Programm- und <acronym title="HyperText Markup Language">HTML</acronym>-Dateien wird mit
</p>
<pre class="code">make install-webconf</pre>
<p>
eine Konfigurationsdatei in das Konfigurationsverzeichnis des Apache-Web-Servers kopiert.
</p>
<p>
Optional kann noch
</p>
<pre class="code">make install-config</pre>
<p>
aufgerufen werden. Damit werden Config-Files f&uuml;r process_perfdata.pl und npcd nach etc/pnp kopiert.
</p>
<p>
Wird das INIT Script f&uuml;r den NPCD ben&ouml;tigt, so sorgt
</p>
<pre class="code">make install-init</pre>
<p>
f&uuml;r die Installation nach /etc/init.d
</p>
<p>
Zusammenfassen lassen sich diese einzelnen Commands durch
</p>
<pre class="code">make fullinstall</pre>
<p>
<strong>Hinweis:</strong> Wie oben schon beschrieben wird standardm&auml;ssig mit den Nagios-Einstellungen installiert. Wird Icinga genutzt, muss in der Datei ”/etc/apache2/conf.d/pnp4nagios.conf” der Pfad zum AuthUserFile angepasst werden (Pfad evtl. je nach Distri anpassen):
</p>
<pre class="code">
# AuthUserFile /usr/local/nagios/etc/htpasswd.users
AuthUserFile /usr/local/icinga/etc/htpasswd.users
</pre>
<p>
<strong>Achtung:</strong> Nach dem Kopieren der Konfigurationsdatei f&uuml;r den Web-Server bzw. &Auml;ndern des AuthUserFile ist ein Restart des Web-Servers notwendig (<code>service httpd restart</code> bzw. <code>/etc/init.d/apache2 restart</code>).
</p>
</div>
<!-- SECTION "Make und Co" [386-4176] -->
<h2><a name="update" id="update">Update</a></h2>
<div class="level2">
<p>
Das Update einer 0.6.x-Version funktioniert (fast) genauso wie die Installation. Bitte beachten Sie, dass Sie beim ”./configure” die gleichen Optionen wie bei der Erstinstallation benutzen!
Bitte pr&uuml;fen Sie außerdem, ob Sie &Auml;nderungen im Verzeichnis <code>share/templates.dist</code> vorgenommen haben. Eigene Templates sollten im Ordner <code>share/templates</code> abgelegt werden.<br/>
<strong>Achtung</strong>: Wenn Sie in der Datei config.php &Auml;nderungen vorgenommen haben, sollten Sie diese Datei sichern, bevor sie bei einem “make install-config” &uuml;berschrieben wird.
</p>
<p>
Sie k&ouml;nnen die Schritte <code>make install-webconf</code> und <code>make install-init</code> &uuml;berspringen, denn zwischen den 0.6.x-Versionen gab es an dieser Stelle keine &Auml;nderungen.
</p>
</div>
<!-- SECTION "Update" [4177-4912] -->
<h2><a name="die_komponenten" id="die_komponenten">Die Komponenten</a></h2>
<div class="level2">
<p>
Nach der Installation sind einige Komponenten von PNP an die passenden Stellen im Dateisystem kopiert worden.
</p>
<p>
Im Folgenden sind dies die <acronym title="Hypertext Preprocessor">PHP</acronym>-Files f&uuml;r das Web-Frontend unter
</p>
<pre class="code"> /usr/local/pnp4nagios/share</pre>
<p>
Der Datensammler process_perfdata.pl in
</p>
<pre class="code"> /usr/local/pnp4nagios/libexec</pre>
<p>
Beispiel-Config-Files mit der Dateierweiterung <code>-sample</code> in
</p>
<pre class="code"> /usr/local/pnp4nagios/etc</pre>
<p>
Die Config-Datei config.php f&uuml;r das Web-Frontend in
</p>
<pre class="code"> /usr/local/pnp4nagios/etc</pre>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">Zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/config" class="wikilink1" title="de:pnp-0.6:config">Konfiguration</a>
</p>
</div>
<!-- SECTION "Die Komponenten" [4913-] -->

View File

@@ -0,0 +1,89 @@
<h1><a name="mobile_ui" id="mobile_ui">Mobile UI</a></h1>
<div class="level1">
<p>
Mit PNP4Nagios 0.6.14 ist ein Webinterface f&uuml;r mobile Endger&auml;te in PNP4Nagios integriert worden.
</p>
<p>
Das Design wurde mit <a href="http://jquerymobile.com/" class="urlextern" title="http://jquerymobile.com/" rel="nofollow">jQuery Mobile</a> realisiert und ist somit mit den aktuellen mobilen Browsern kompatibel. Auf der Liste der <a href="http://jquerymobile.com/gbs/" class="urlextern" title="http://jquerymobile.com/gbs/" rel="nofollow">unterst&uuml;tzten Ger&auml;te</a> sind die einzelnen Browser aufgef&uuml;hrt und nach Grad der Unterst&uuml;tzung klassifiziert.
</p>
</div>
<!-- SECTION "Mobile UI" [1-423] -->
<h1><a name="landing_page" id="landing_page">Landing Page</a></h1>
<div class="level1">
<p>
Das Webinterface wurde so gestaltet, dass die &uuml;blichen Links auf das klassische Interface abgefangen und auf die entsprechende mobile Seite umgeleitet werden. Somit k&ouml;nnen weiterhin innerhalb der Nagios-Mails Links zu PNP-Graphen eingebunden werden, die je nach Endger&auml;t auf die passende Seite verweisen.
</p>
<table class="inline">
<tr class="row0">
<th class="col0"> Classic </th><th class="col1"> Mobile </th>
</tr>
<tr class="row1">
<td class="col0 leftalign"> /pnp4nagios/graph </td><td class="col1"> /pnp4nagios/mobile </td>
</tr>
<tr class="row2">
<td class="col0 leftalign"> /pnp4nagios/graph?host=localhost </td><td class="col1"> /pnp4nagios/mobile/host/localhost </td>
</tr>
<tr class="row3">
<td class="col0"> /pnp4nagios/graph?host=localhost&amp;srv=ping </td><td class="col1"> /pnp4nagios/mobile/graph/localhost/ping </td>
</tr>
</table>
</div>
<!-- SECTION "Landing Page" [424-1019] -->
<h1><a name="browser-erkennung" id="browser-erkennung">Browser-Erkennung</a></h1>
<div class="level1">
<p>
Browser werden anhand ihres “User-Agent”-Strings als mobile Browser erkannt.
Die Erkennung kann in der Datei <code>pnp4nagios/etc/<a href="/de/pnp-0.6/webfe_cfg" class="wikilink1" title="de:pnp-0.6:webfe_cfg">config_local.php</a></code> beeinflusst werden.
</p>
<pre class="code">
$conf[&#039;mobile_devices&#039;] = &#039;iPhone|iPod|iPad|android&#039;;
</pre>
<p>
Die Option &#039;mobile_devices&#039; beinhaltet einen regul&auml;ren Ausdruck, welcher mit dem “User Agent” des Browsers verglichen wird.
</p>
<p>
Der “User Agent” eines Browsers wird im Webserver-Access-Log protokolliert und sieht f&uuml;r ein iOS-Device in etwa wie folgt aus.
</p>
<pre class="code">
&quot;Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7&quot;
</pre>
</div>
<!-- SECTION "Browser-Erkennung" [1020-1721] -->
<h1><a name="screenshots" id="screenshots">Screenshots</a></h1>
<div class="level1">
<p>
Screenshot aufgenommen mit einem iPhone und iOS 4.2
</p>
<table class="inline">
<tr class="row0">
<td class="col0"> <a href="/_detail/mobile-home.png?id=de%3Apnp-0.6%3Amobile" class="media" title="mobile-home.png"><img src="/_media/mobile-home.png?w=150" class="media" title=" Home Screen" alt=" Home Screen" width="150" /></a> </td><td class="col1"> Homescreen </td><td class="col2"> <a href="/_detail/mobile-loading.png?id=de%3Apnp-0.6%3Amobile" class="media" title="mobile-loading.png"><img src="/_media/mobile-loading.png?w=150" class="media" title=" Loading..." alt=" Loading..." width="150" /></a> </td><td class="col3"> Loading … </td>
</tr>
<tr class="row1">
<td class="col0"> <a href="/_detail/mobile-hostlist.png?id=de%3Apnp-0.6%3Amobile" class="media" title="mobile-hostlist.png"><img src="/_media/mobile-hostlist.png?w=150" class="media" title=" Hosts Liste " alt=" Hosts Liste " width="150" /></a> </td><td class="col1"> Liste aller Hosts </td><td class="col2"> <a href="/_detail/mobile-servicelist.png?id=de%3Apnp-0.6%3Amobile" class="media" title="mobile-servicelist.png"><img src="/_media/mobile-servicelist.png?w=150" class="media" title=" Liste aller services" alt=" Liste aller services" width="150" /></a> </td><td class="col3"> Liste aller Services eines Hosts</td>
</tr>
<tr class="row2">
<td class="col0"> <a href="/_detail/mobile-graphs.png?id=de%3Apnp-0.6%3Amobile" class="media" title="mobile-graphs.png"><img src="/_media/mobile-graphs.png?w=150" class="media" title=" Graphen" alt=" Graphen" width="150" /></a> </td><td class="col1"> Graphen eines Services </td><td class="col2"> </td><td class="col3"> </td>
</tr>
</table>
</div>
<!-- SECTION "Screenshots" [1722-] -->

View File

@@ -0,0 +1,152 @@
<h1><a name="die_kunst_daten_zu_sammeln" id="die_kunst_daten_zu_sammeln">Die Kunst Daten zu sammeln</a></h1>
<div class="level1">
<p>
PNP unterst&uuml;tzt mehrere Arten, die Performance-Daten zu verarbeiten. Die einzelnen Modi unterscheiden sich durch ihre Komplexit&auml;t und die zu erwartende Performance.
</p>
<p>
Das folgende Bild zeigt die Verbindungen zwischen Nagios, PNP und RRDtool
</p>
<p>
Nagios f&uuml;hrt f&uuml;r jeden Host- und jeden Service, dessen Performance-Daten gesammelt werden sollen, einen Befehl aus. Abh&auml;ngig vom gew&auml;hlten Modus werden die Daten entweder direkt an ein <acronym title="Practical Extraction and Report Language">Perl</acronym>-Script &uuml;bergeben oder in tempor&auml;re Dateien geschrieben und sp&auml;ter verarbeitet. process_perfdata.pl legt die Datei in <acronym title="Extensible Markup Language">XML</acronym>-Dateien ab und speichert sie mit Hilfe von RRDtool in RRD-Dateien.<br/>
</p>
<p>
Bevor Ihr euch auf einen Modus festlegt, lest euch alles durch und entscheidet selbst, welcher Weg f&uuml;r eure Installation der Beste ist.
</p>
</div>
<!-- SECTION "Die Kunst Daten zu sammeln" [1-812] -->
<h1><a name="die_modi_im_vergleich" id="die_modi_im_vergleich">Die Modi im Vergleich</a></h1>
<div class="level1">
</div>
<!-- SECTION "Die Modi im Vergleich" [813-850] -->
<h2><a name="synchronous_mode" id="synchronous_mode">Synchronous Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/synchronous.png?id=de%3Apnp-0.6%3Amodes" class="media" title="synchronous.png"><img src="/_media/synchronous.png?w=150" class="medialeft" align="left" alt="" width="150" /></a>Der “Sync Mode” ist der einfachste und am leichtesten einzurichten. Nagios ruft f&uuml;r jeden Service (bzw. Host) zus&auml;tzlich das <acronym title="Practical Extraction and Report Language">Perl</acronym>-Script process_perfdata.pl auf, um die Daten zu verarbeiten.
</p>
<p>
Der sync-Mode funktioniert sehr gut bis ca. 1000 Services in einem Intervall von 5 Minuten.
Dieser Modus belastet aber auch Nagios am meisten, daher ist es auch in kleinen Installationen ratsam, die weiteren Modi zu beachten.
</p>
</div>
<!-- SECTION "Synchronous Mode" [851-1327] -->
<h2><a name="bulk_mode" id="bulk_mode">Bulk Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk.png?id=de%3Apnp-0.6%3Amodes" class="media" title="bulk.png"><img src="/_media/bulk.png?w=150" class="medialeft" align="left" alt="" width="150" /></a>Im Bulk-Mode schreibt Nagios die ben&ouml;tigten Daten in eine tempor&auml;re Datei. Nach Ablauf einer definierten Zeit wird die Datei an einem St&uuml;ck abgearbeitet und gel&ouml;scht.
</p>
<p>
Die Anzahl der Aufrufe von process_perfdata.pl reduziert sich um ein Vielfaches. Abh&auml;ngig von der Zeit und den gesammelten Daten werden wesentlich weniger Systemaufrufe ausgef&uuml;hrt. Daf&uuml;r l&auml;uft process_perfdata.pl l&auml;nger.
</p>
<p>
<strong>Hinweis</strong>
Bei diesem Modus sollte man die Laufzeit von process_perfdata.pl im Auge behalten. So lange, wie process_perfdata.pl zum Verarbeiten der Daten ben&ouml;tigt, so lange kann Nagios keine Checks ausf&uuml;hren.
</p>
<p>
Auszug aus var/perfdata.log:
</p>
<pre class="code">
2007-10-18 12:05:01 [21138] 71 Lines processed
2007-10-18 12:05:01 [21138] .../spool/service-perfdata-1192701894-PID-21138 deleted
2007-10-18 12:05:01 [21138] PNP exiting (runtime 0.060969s) ...
</pre>
<p>
71 Zeilen wurden in 0,06 Sekunden verarbeitet. Das ist das Datenvolumen bei ca. 2000 Services und der Verarbeitung im 10-Sekunden-Intervall. Wir haben Nagios also genau f&uuml;r 0.06 Sekunden blockiert.
</p>
</div>
<!-- SECTION "Bulk Mode" [1328-2426] -->
<h2><a name="bulk_mode_mit_npcd" id="bulk_mode_mit_npcd">Bulk Mode mit NPCD</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk-npcd.png?id=de%3Apnp-0.6%3Amodes" class="media" title="bulk-npcd.png"><img src="/_media/bulk-npcd.png?w=150" class="medialeft" align="left" alt="" width="150" /></a>Dies ist aus Nagios-Sicht die sauberste Art der Verarbeitung. Nagios wird nicht blockiert.
</p>
<p>
Nagios benutzt wieder eine tempor&auml;re Datei, um die Daten zu speichern, und f&uuml;hrt nach Ablauf der Zeit wieder ein Command aus. Jedoch wird die Datei nicht sofort von Process_perfdata.pl verarbeitet, sondern in ein spool-Verzeichnis verschoben. Da das Verschieben einer Datei im gleichen Filesystem so gut wie keine Zeit beansprucht, ist Nagios sofort wieder in der Lage, wichtige Arbeiten auszuf&uuml;hren.
</p>
<p>
Der NPCD ( Nagios Performance C Daemon ) &uuml;berwacht nun das Verzeichnis auf neue Dateien und &uuml;bergibt diese an process_perfdata.pl. Die Verarbeitung der Performancedaten ist also komplett von Nagios entkoppelt. NPCD wiederum ist in der Lage, zum Verarbeiten der Daten mehrere Threads zu starten.
</p>
</div>
<!-- SECTION "Bulk Mode mit NPCD" [2427-3277] -->
<h2><a name="bulk_mode_mit_npcdmod" id="bulk_mode_mit_npcdmod">Bulk Mode mit npcdmod</a></h2>
<div class="level2">
<p>
<strong>Achtung</strong>
<em>Beginnend mit Nagios 4 haben sich die internen Strukturen ge&auml;ndert, so dass der Start des Moduls fehlschl&auml;gt. Bisher gibt es keine Pl&auml;ne Nagios 4 zu unterst&uuml;tzen. Bitte w&auml;hlen Sie einen der anderen Modi.</em>
</p>
<p>
<a href="/_detail/bulk-npcdmod.png?id=de%3Apnp-0.6%3Amodes" class="media" title="bulk-npcdmod.png"><img src="/_media/bulk-npcdmod.png?w=150" class="medialeft" align="left" alt="" width="150" /></a>In diesem Szenario kommt npcdmod.o, ein NEB-Modul, zum Einsatz.
Diese Modul reduziert die Konfiguration des “Bulk Mode mit NPCD” auf zwei Zeilen in der nagios.cfg.
</p>
<p>
Dieser Modus ist gleichzusetzen mit dem “Bulk Mode mit NPCD”. Es ist auch genau der gleiche Ablauf und die gleiche Performance.
</p>
</div>
<!-- SECTION "Bulk Mode mit npcdmod" [3278-3861] -->
<h2><a name="gearman_mode" id="gearman_mode">Gearman Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/gearman.png?id=de%3Apnp-0.6%3Amodes" class="media" title="gearman.png"><img src="/_media/gearman.png?w=150" class="medialeft" align="left" alt="" width="150" /></a>
</p>
<p>
PNP4Nagios kann seit Version 0.6.12 als Gearman Worker betrieben werden. So sind große verteilte Nagios Umgebungen auf Basis von mod_gearman realisierbar.
</p>
<p>
Ben&ouml;tigt wird eine fertig eingerichtete mod_gearman Installation wie von Sven Nierlein unter <a href="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> beschrieben.
</p>
</div>
<!-- SECTION "Gearman Mode" [3862-4229] -->
<h2><a name="die_entscheidung" id="die_entscheidung">Die Entscheidung</a></h2>
<div class="level2">
<p>
Welchen der beschriebenen Wege ihr verwendet, h&auml;ngt also stark von der Gr&ouml;ße der Nagios-Installation ab.
</p>
<p>
Die verwendeten Begriffe werden euch aber in der Dokumentation immer wieder &uuml;ber den Weg laufen.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">Zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/install" class="wikilink1" title="de:pnp-0.6:install">Installation</a>
</p>
</div>
<!-- SECTION "Die Entscheidung" [4230-] -->

View File

@@ -0,0 +1,67 @@
<h2><a name="neues_in_pnp_06x" id="neues_in_pnp_06x">Neues in PNP 0.6.x</a></h2>
<div class="level2">
<p>
<a href="/_detail/pnp-0.6/gallery/pnp-preview-05-08-2009.png?id=de%3Apnp-0.6%3Anew-features" class="media" title="pnp-0.6:gallery:pnp-preview-05-08-2009.png"><img src="/_media/pnp-0.6/gallery/pnp-preview-05-08-2009.png?w=200" class="mediaright" align="right" title="PNP 0.6.x Preview " alt="PNP 0.6.x Preview " width="200" /></a>
</p>
<p>
Die Arbeit an der Version 0.6.x ist in vollem Gange.
</p>
<p>
Mit Version 0.6.x steigen wir von Subversion auf GIT um. Der Sourcecode ist bereits auf Sourceforge erh&auml;ltlich.
</p>
<p>
<a href="http://pnp4nagios.git.sourceforge.net" class="urlextern" title="http://pnp4nagios.git.sourceforge.net" rel="nofollow">http://pnp4nagios.git.sourceforge.net</a>
</p>
<p>
<strong>Bisher umgesetzte Funktionen:</strong>
</p>
<ul>
<li class="level1"><div class="li"> Webfrontend basiert auf <a href="http://www.kohanaphp.com" class="urlextern" title="http://www.kohanaphp.com" rel="nofollow">Kohana</a></div>
</li>
<li class="level1"><div class="li"> Webfrontend basiert auf <a href="http://jqueryui.com/themeroller/" class="urlextern" title="http://jqueryui.com/themeroller/" rel="nofollow">jQuery Themes</a></div>
</li>
<li class="level1"><div class="li"> Javascript-Funktionen &uuml;ber <a href="http://jquery.com/" class="urlextern" title="http://jquery.com/" rel="nofollow">jQuery</a> Plugins </div>
</li>
<li class="level1"><div class="li"> process_perfdata.pl wird in der Lage sein, pro Datenreihe eine eigene RRD-Datenbank zu verwenden.</div>
</li>
<li class="level1"><div class="li"> Installer weiter verbessert. Angabe von Directory-Layouts &uuml;ber --with-layout</div>
</li>
<li class="level1"><div class="li"> RRDtool-Fehler werden als Bild dargestellt. Keine fehlenden Bilder mehr.</div>
</li>
<li class="level1"><div class="li"> PNP-Templates k&ouml;nnen keine internen Variablen mehr &uuml;berschreiben.</div>
</li>
<li class="level1"><div class="li"> PNP-Templates der Version 0.4.x k&ouml;nnen weiter verwendet werden.</div>
</li>
<li class="level1"><div class="li"> <acronym title="Portable Document Format">PDF</acronym>-Funktionen neu umgesetzt.</div>
</li>
<li class="level1"><div class="li"> Template default.php optimiert.</div>
</li>
<li class="level1"><div class="li"> Export aus den RRD-Datenbanken im <acronym title="Extensible Markup Language">XML</acronym>,CSV und JSON Format &uuml;ber die RRDtool “xport” Funktion.</div>
</li>
<li class="level1"><div class="li"> Page-Funktionen neu umgesetzt.</div>
</li>
<li class="level1"><div class="li"> Fehlerseiten verweisen auf online <a href="http://docs.pnp4nagios.org/de/faq" class="urlextern" title="http://docs.pnp4nagios.org/de/faq" rel="nofollow">FAQ-Artikel</a>.</div>
</li>
<li class="level1"><div class="li"> Mouseover Popup im Nagios-Frontend &uuml;ber jQuery.clueTip Plugin</div>
</li>
<li class="level1"><div class="li"> Volle Unterst&uuml;tzung des rrdcached.</div>
</li>
</ul>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/about#anforderungen" class="wikilink1" title="de:pnp-0.6:about">Anforderungen</a>
</p>
</div>

View File

@@ -0,0 +1,323 @@
<h1><a name="npcd" id="npcd">NPCD</a></h1>
<div class="level1">
<p>
NPCD (Nagios-Perfdata-C-Daemon) wurde geschrieben, um die asynchrone Bearbeitung von Nagios Performance-Daten zu erm&ouml;glichen.
</p>
</div>
<!-- SECTION "NPCD" [1-148] -->
<h2><a name="einleitung" id="einleitung">Einleitung</a></h2>
<div class="level2">
<p>
In großen Nagios-Installationen kann es zu nicht akzeptierbaren Versp&auml;tungen seitens der Checks kommen. Das bedeutet, dass Nagios einen Check zum Zeitpunkt <code>x</code> ausf&uuml;hren soll, diesen aber erst <code>y</code> Sekunden sp&auml;ter tats&auml;chlich ausf&uuml;hrt.
</p>
<p>
Wenn man dem Nagios-Daemon mitteilt, dass man nach jedem einzelnen Check auch die Performance-Daten verarbeiten m&ouml;chte, so geht dies bis zu einem bestimmten Grad gut, ab einer gewissen Anzahl von Checks pro Sekunde allerdings kommt man relativ schnell zu den sog. Latency-Problemen.
</p>
<p>
Um die Anzahl der Aktionen pro Check zu verringern, kann man nun PNP im <a href="/de/pnp-0.6/modes#bulk_mode" class="wikilink1" title="de:pnp-0.6:modes">Bulk-Mode</a> verwenden, wobei die Performance-Daten zun&auml;chst vom Nagios-Prozess gesammelt und anschließend ebenfalls vom Nagios-Prozess selbst verarbeitet werden.
</p>
<p>
Man kann aber auch dem Nagios-Prozess mitteilen, dass die Verarbeitung der Performance-Daten lediglich durch das Verschieben der Dateien in ein Spool-Verzeichnis geschehen soll, welches f&uuml;r den Nagios-Prozess selbst eine sehr schnelle Aktion ist und die Performance nicht nennenswert beeinflusst und somit dem Core mehr Zeit f&uuml;r seine eigentliche Arbeit l&auml;sst: weitere Checks ausf&uuml;hren, Alamierungen bereitstellen, etc.
</p>
</div>
<!-- SECTION "Einleitung" [149-1384] -->
<h2><a name="wie_npcd_arbeitet" id="wie_npcd_arbeitet">Wie NPCD arbeitet</a></h2>
<div class="level2">
<p>
Wie bereits erw&auml;hnt, ist die Arbeit der Performance-Daten-Verarbeitung durch das schnelle Verschieben der Datei bereits erledigt, aber das bringt die Performance-Daten noch nicht in die RRD-Datenbank.
</p>
<p>
Um den Transport der Performance-Daten-Dateien k&uuml;mmert sich nun der NPCD-Daemon, unabh&auml;ngig vom Nagios-Prozess, indem er regelm&auml;ßig in das Spool-Verzeichnis guckt und f&uuml;r jede dort gefundene Datei eine Aktion ausf&uuml;hrt.
</p>
<p>
Nachdem NPCD gestartet wurde, erstellt er sich eine Liste von Dateinamen des Spool-Verzeichnisses und startet f&uuml;r jede gefundene Datei einen Thread zur weiteren Verarbeitung mit Hilfe des <code>perfdata_file_run_cmd</code> und dem optionalen <code>perfdata_file_run_cmd_arg</code> als zus&auml;tzlichem Argument.
</p>
<p>
Da das Format der Performance-Daten-Dateien dem Format der &#039;normalen&#039; PNP-Bulk-Modus-Dateien gleicht, kann NPCD nun f&uuml;r jede gefundene Datei also <code>process_perfdata.pl</code> im <a href="/de/pnp-0.6/modes#bulk_mode" class="wikilink1" title="de:pnp-0.6:modes">Bulk Modus</a> aufrufen.
</p>
</div>
<!-- SECTION "Wie NPCD arbeitet" [1385-2353] -->
<h2><a name="vor-_und_nachteile" id="vor-_und_nachteile">Vor- und Nachteile</a></h2>
<div class="level2">
<p>
<strong>Pro:</strong>
</p>
<ul>
<li class="level1"><div class="li"> bessere Performance f&uuml;r Nagios</div>
<ul>
<li class="level2"><div class="li"> aufgrund der vom Nagios-Prozess getrennten Verarbeitung der Performance-Daten hat Nagios mehr Zeit f&uuml;r die wichtigen Dinge</div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> kein Datenverlust</div>
<ul>
<li class="level2"><div class="li"> solange Nagios Performance-Daten-Dateien im Spool-Verzeichnis ablegt, gehen keine Daten verloren. Selbst wenn der NPCD mal nicht laufen sollte (Bsp. nach Neustart des Systems), werden die Dateien nach Wiederanlauf in chronologischer Reihenfolge bearbeitet ($TIMET$ Makro beim verschieben ins Spool-Verzeichnis)</div>
</li>
</ul>
</li>
</ul>
<p>
<strong>Kontra:</strong>
</p>
<ul>
<li class="level1"><div class="li"> Keine Echtzeitverarbeitung der Performance-Daten</div>
<ul>
<li class="level2"><div class="li"> aufgrund des Rhythmusses, wann Nagios die Performance-Daten-Dateien verschiebt (<code>service_perfdata_file_processing_interval</code>)</div>
</li>
<li class="level2"><div class="li"> nach jedem Lauf durch alle Dateien des Spool-Verzeichnisses wartet NPCD 10 Sekunden lang auf neue Dateien</div>
</li>
</ul>
</li>
</ul>
</div>
<!-- SECTION "Vor- und Nachteile" [2354-3211] -->
<h1><a name="npcd_config" id="npcd_config">NPCD Config</a></h1>
<div class="level1">
<p>
NPCD muss zwangsl&auml;ufig &uuml;ber eine Konfigurationsdatei gesteuert werden. Eine Beispielkonfiguration liegt der PNP-Installation als <code>npcd.cfg-sample</code> bei.
</p>
<p>
Nach Umbenennen der <code>-sample</code> Datei zu <code>npcd.cfg</code> kann NPCD nun wie folgt gestartet werden:
</p>
<pre class="code _bash">/usr/local/pnp4nagios/bin/npcd -f /usr/local/pnp4nagios/etc/npcd.cfg</pre>
<p>
oder
</p>
<pre class="code _bash">/usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg</pre>
<p>
um NPCD im Hintergrund als Daemon laufen zu lassen.
</p>
<p>
<strong>Hinweis:</strong>
Die <code>-sample</code> Datei sollte in jedem Fall in <code>npcd.cfg</code> umbenannt werden, da sie sonst bei einem Update von PNP &uuml;berschrieben werden k&ouml;nnte.
</p>
</div>
<!-- SECTION "NPCD Config" [3212-3888] -->
<h2><a name="npcdcfg-sample" id="npcdcfg-sample">npcd.cfg-sample</a></h2>
<div class="level2">
<p>
Dies sind die essentiellen Konfigurationsdirektiven f&uuml;r NPCD:
</p>
<pre class="code"># Privilege Options
user = nagios
group = nagios
# Logging Options
log_type = syslog
log_file = /usr/local/pnp4nagios/var/npcd.log
max_logfile_size = 10485760
log_level=0
# Processing Options
perfdata_spool_dir = /usr/local/pnp4nagios/var/spool/perfdata/
perfdata_file_run_cmd = /usr/local/pnp4nagios/libexec/process_perfdata.pl
perfdata_file_run_cmd_args = -b
# Thread Options
npcd_max_threads=5
# greedy options
use_load_threshold = 0
load_threshold = 10.0
# Process Options
pid_file=/var/run/npcd.pid
</pre>
</div>
<!-- SECTION "npcd.cfg-sample" [3889-4505] -->
<h2><a name="die_direktiven" id="die_direktiven">Die Direktiven</a></h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> <strong>Privilege-Optionen</strong></div>
<ul>
<li class="level2"><div class="li"> user &lt;username&gt; </div>
<ul>
<li class="level3"><div class="li"> NPCD versucht die Userberechtigung zu diesem User zu wechseln.</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> nagios</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> group &lt;groupname&gt;</div>
<ul>
<li class="level3"><div class="li"> NPCD versucht die Gruppenberechtigung zu dieser Gruppe zu wechseln.</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> nagios</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Logging-Optionen</strong></div>
<ul>
<li class="level2"><div class="li"> log_type &lt;syslog&gt; oder &lt;file&gt; </div>
<ul>
<li class="level3"><div class="li"> Log-Type, den NPCD zum Loggen verwenden wird</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> syslog</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> log_file &lt;/pfad/zu/datei&gt; </div>
<ul>
<li class="level3"><div class="li"> Falls <code>log_type = file</code> wird diese Logdatei verwendet</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /usr/local/pnp4nagios/var/npcd.log</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> max_logfile_size &lt;bytes&gt; </div>
<ul>
<li class="level3"><div class="li"> NPCD wird nach Erreichen der hier angegebenen Dateigr&ouml;ße eigenst&auml;ndig eine Logrotation durchf&uuml;hren</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 10485760 = 10 MByte</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> log_level &lt;integer&gt;</div>
<ul>
<li class="level3"><div class="li"> Wie viel soll aufgezeichnet werden, m&ouml;glich ist:</div>
<ul>
<li class="level4"><div class="li"> 0 = Kein Log - außer Fehlern</div>
</li>
<li class="level4"><div class="li"> 1 = wenig Log - etwas mehr Aufzeichnen</div>
</li>
<li class="level4"><div class="li"> 2 = Mehr Log (aktuell ALLES)</div>
</li>
<li class="level4"><div class="li"> -1 = DEBUG Mode - Es wird alles aufgezeichnet und die Bearbeitung wird verlangsamt</div>
</li>
</ul>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 0</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Bearbeitungs-Optionen</strong></div>
<ul>
<li class="level2"><div class="li"> perfdata_spool_dir &lt;/path/to/spool/dir/&gt;</div>
<ul>
<li class="level3"><div class="li"> Das Verzeichnis, in das Nagios die Dateien verschiebt</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /usr/local/pnp4nagios/var/spool/</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> perfdata_file_run_cmd &lt;/path/to/bin/filename&gt;</div>
<ul>
<li class="level3"><div class="li"> Das Programm, welches Nagios f&uuml;r jede Datei aufrufen soll</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /usr/local/pnp4nagios/libexec/process_perfdata.pl</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> perfdata_file_run_cmd_args &lt;option&gt; </div>
<ul>
<li class="level3"><div class="li"> Das Argument, welches optional an <code>perfdata_file_run_cmd</code> angeh&auml;ngt wird</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> ”-b”</div>
</li>
<li class="level3"><div class="li"> <img src="/lib/images/smileys/icon_exclaim.gif" class="middle" alt=":!:" /> Die Kommandozeile wird nach folgendem Schema aufgebaut: <pre class="code">&lt;perfdata_file_run_cmd&gt; &lt;perfdata_file_run_cmd_args&gt; &lt;filename_from_perfdata_spool_dir&gt;</pre>
</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Thread-Optionen</strong></div>
<ul>
<li class="level2"><div class="li"> npcd_max_threads &lt;integer value&gt;</div>
<ul>
<li class="level3"><div class="li"> Anzahl der maximal zu startenden parallelen Threads</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 5</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Greedy-Optionen</strong></div>
<ul>
<li class="level2"><div class="li"> use_load_threshold &lt;0 oder 1&gt;</div>
<ul>
<li class="level3"><div class="li"> definiert, ob NPCD bei Erreichen des load_thresholds die Anzahl der Threads begrenzen soll</div>
<ul>
<li class="level4"><div class="li"> 0 = ausschalten (weitere Threads starten)</div>
</li>
<li class="level4"><div class="li"> 1 = einschalten</div>
</li>
</ul>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 0</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> load_threshold &lt;float value&gt;</div>
<ul>
<li class="level3"><div class="li"> wenn <code>use_load_threshold</code> auf 1 gesetzt ist, werden bei Erreichen dieses load limits keine neuen Threads gestartet</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 10.0</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Process-Optionen</strong></div>
<ul>
<li class="level2"><div class="li"> pid_file &lt;/path/to/pid.file&gt;</div>
<ul>
<li class="level3"><div class="li"> Pfad zum PID File</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /var/run/npcd.pid</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/wrapper" class="wikilink1" title="de:pnp-0.6:wrapper">Wrapper-Script</a>
</p>
</div>
<!-- SECTION "Die Direktiven" [4506-] -->

View File

@@ -0,0 +1,93 @@
<h1><a name="pages" id="pages">Pages</a></h1>
<div class="level1">
<p>
„pages“ bieten die M&ouml;glichkeit, Grafiken von verschiedenen Hosts/Services auf einer Seite zusammenzufassen. Auf diese Weise k&ouml;nnen z.B. die &Uuml;bertragungsraten der Netzwerk-Interfaces aller Tape-Libraries dargestellt werden. Innerhalb der Definitionen sind regul&auml;re Ausdr&uuml;cke m&ouml;glich, so dass entsprechende Namen vorausgesetzt - mit wenig Aufwand viel erreicht werden kann.
Das Verzeichnis, das in <code>config.php</code> durch den Konfigurationseintrag „$conf[&#039;page_dir&#039;]“ angegeben wurde, enth&auml;lt ein oder mehrere Dateien mit der Endung „.cfg“.
</p>
<p>
Kommentare beginnen mit einem &#039;#&#039; und sind auch innerhalb einer Zeile m&ouml;glich.
Jede Datei enth&auml;lt eine „page“-Definition, die neben dem Namen der Seite festlegt, ob die nachfolgenden Grafikdefinitionen regul&auml;re Ausdr&uuml;cke enthalten.<br/>
Die Bezeichnung hinter <code>page_name</code> erscheint in der Liste der verf&uuml;gbaren Seiten und wird als Titel im Browser angezeigt.
<strong>Achtung:</strong> “host_name” und “service_desc” beziehen sich auf die Namen der Dateien im perfdata-Ordner, nicht auf die Nagios-Bezeichnungen. Leerzeichen werden durch Unterstriche (“_”) ersetzt.
</p>
<pre class="code">define page {
use_regex 1 # 0 = keine regul&auml;ren Ausdr&uuml;cke, 1 = regul&auml;re Ausdr&uuml;cke
page_name Test-Seite # Beschreibung der Seite
}</pre>
<p>
Danach folgen ein oder mehrere „graph“-Definitionen:
</p>
<pre class="code">define graph {
host_name host1,host2,host3
service_desc Current_Load
}</pre>
<p>
<strong>Achtung:</strong> Damit die oben gezeigte Liste von Host-Namen funktioniert, muss <code>use_regex 0</code> gesetzt sein!
</p>
<pre class="code">define graph {
host_name host4
service_desc Current_Users
}</pre>
<p>
Und jetzt mit regul&auml;ren Ausdr&uuml;cken. Zuerst alle Hosts, deren Name mit „Tape“ beginnen:
</p>
<pre class="code">define graph {
host_name ^Tape
service_desc Traffic
}</pre>
<p>
alle Hosts, deren Namen mit “00” enden
</p>
<pre class="code">define graph {
host_name 00$
service_desc Load
}</pre>
<p>
alle Services des localhost, deren Namen ein „a“ oder „o“ enthalten:
</p>
<pre class="code">define graph {
host_name localhost
service_desc a|o
}</pre>
<p>
alle Services, die im Namen nach einem „_“ (mindestens) drei Ziffern haben auf allen Hosts, deren Namen mit „UX“ beginnen:
</p>
<pre class="code">define graph {
host_name ^UX
service_desc _\d{3}
}</pre>
<p>
In einigen F&auml;llen m&ouml;chten Sie vielleicht die Anzeige auf einen Graphen beschr&auml;nken. Um dies zu erreichen, k&ouml;nnen Sie die optionale Direktive “source” benutzen, gefolgt von einer Zahl, die die Position in der RRD-Datei angibt. Die Z&auml;hlung beginnt ab 0
</p>
<pre class="code">define graph {
host_name host1,host2,host3
service_desc PING
source 1
}</pre>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/xport" class="wikilink1" title="de:pnp-0.6:xport">Datenexport</a>
</p>
</div>

View File

@@ -0,0 +1,62 @@
<table class="inline">
<tr class="row0">
<th class="col0">2.6. Performance-Daten</th>
</tr>
<tr class="row1">
</tr>
</table>
<p>
&#039;Bezeichnung&#039;=Wert[UOM];[warn];[crit];[min];[max]
</p>
<p>
Anmerkungen:
</p>
<ol>
<li class="level1"><div class="li"> Leerzeichen trennen Listen von Bezeichnung/Werte-Paaren</div>
</li>
<li class="level1"><div class="li"> Bezeichnungen k&ouml;nnen beliebige Zeichen enthalten</div>
</li>
<li class="level1"><div class="li"> die Bezeichnung muss in Apostrophe eingeschlossen sein, wenn diese Gleichheitszeichen (<code>=</code>), Apostroph (<code></code>&#039;) oder Leerzeichen (<code> </code>) enth&auml;lt, ansonsten sind die Apostrophe optional</div>
</li>
<li class="level1"><div class="li"> die L&auml;nge der Bezeichnung ist beliebig, aber idealerweise sind die ersten 19 Zeichen eindeutig (aufgrund einer Beschr&auml;nkung in RRD). Bitte beachten Sie, dass es eine L&auml;ngenbegrenzung bei der Menge von Daten gibt, die von NRPE an Nagios geliefert werden kann</div>
</li>
<li class="level1"><div class="li"> um ein Apostroph darzustellen, nutzen Sie zwei einzelne Apostrophe</div>
</li>
<li class="level1"><div class="li"> <em>warn</em>, <em>crit</em>, <em>min</em> und/oder <em>max</em> k&ouml;nnen leer sein (z.B. wenn der Schwellwert nicht definiert ist oder wenn min oder max nicht zutreffen). Nachfolgende, nicht gef&uuml;llte Semikola k&ouml;nnen entfallen</div>
</li>
<li class="level1"><div class="li"> <em>min</em> und <em>max</em> sind nicht erforderlich, wenn UOM = %</div>
</li>
<li class="level1"><div class="li"> <em>Wert</em>, <em>min</em> und <em>max</em> sind aus der Klasse [-0-9.] (Ziffern, Minuszeichen und Dezimalpunkt). Alle m&uuml;ssen das gleiche UOM benutzen</div>
</li>
<li class="level1"><div class="li"> <em>warn</em> und <em>crit</em> sind im “Range”-Format (siehe Abschnitt 2.5 der Original-Dokumentation). Alle m&uuml;ssen das gleiche UOM benutzen.</div>
</li>
<li class="level1"><div class="li"> UOM (unit of measurement, Maßeinheit) ist eins von:</div>
<ul>
<li class="level3"><div class="li"> keine Einheit angegeben - angenommen wird eine Zahl (int oder float) von Dingen (z.B. Benutzer, Prozesse, Load)</div>
</li>
<li class="level3"><div class="li"> s - Sekunden (auch us, ms)</div>
</li>
<li class="level3"><div class="li"> % - Prozent</div>
</li>
<li class="level3"><div class="li"> B - Bytes (auch KB, <acronym title="Megabyte">MB</acronym>, TB; <acronym title="Gigabyte">GB</acronym>?)</div>
</li>
<li class="level3"><div class="li"> c - ein fortlaufender Z&auml;hler (z.B. Bytes, die &uuml;ber ein Interface &uuml;bertragen werden)</div>
</li>
</ul>
</li>
</ol>
<p>
Es bleibt Drittanbietern &uuml;berlassen, aus den Performance-Daten Graphen zu erzeugen.|
</p>
<p>
Quelle: <a href="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" class="urlextern" title="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" rel="nofollow">http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201</a>
</p>

View File

@@ -0,0 +1,84 @@
<h1><a name="rrd_storage_type_multiple" id="rrd_storage_type_multiple">RRD_STORAGE_TYPE = MULTIPLE</a></h1>
<div class="level1">
<p>
<strong>Verf&uuml;gbar ab PNP 0.6.3</strong>
</p>
<p>
Mit PNP-Version 0.6 ist es m&ouml;glich, die Performance-Daten nicht in einer einzelnen RRD-Datenbank (SINGLE), sondern in mehreren RRD Datenbanken (MULTIPLE) zu speichern.
</p>
<p>
Nach dem Anlegen eines RRD-Files ist es nicht mehr m&ouml;glich, dieses um eine Datasource (DS) zu erweitern. Daraus ergeben sich Probleme f&uuml;r Nagios-Plugins, die im Laufe der Zeit die Anzahl der Datenreihen dynamisch &auml;ndern.
</p>
<p>
Ein Beispiel w&auml;re check_disk, wenn man pauschal alle verf&uuml;gbaren Filesysteme in einem Service &uuml;berwacht. Kommt ein Filesystem hinzu, so kann die RRD-Datenbank nicht mehr aktualisiert werden. Die Struktur der neuen Daten passt einfach nicht mehr zur RRD-Struktur.
</p>
<p>
PNP arbeitet per Default mit der Option <code>RRD_STORAGE_TYPE = SINGLE</code>, welche in der process_perfdata.cfg definiert ist.
</p>
<p>
Diese Einstellung sollte <strong>nicht</strong> global ver&auml;ndert werden, da PNP nach der Umstellung auf MULTIPLE sofort beginnt, neue RRD-Files anzulegen. Alte Daten gehen damit sofort verloren!
</p>
<p>
Weiterhin ist es im Hinblick auf die Performance nicht sinnvoll, global mit <code>RRD_STORAGE_TYPE = MULTIPLE</code> zu arbeiten. Die Anzahl der RRD-Datenbanken und somit auch der Disk-I/O w&auml;hrend der Updates vervielfacht sich. Entsprechend sollte man mit Bedacht w&auml;hlen, welche Nagios-Check-Commands mit welcher Einstellung behandelt werden sollen.
</p>
<p>
Im Abschnitt <a href="/de/pnp-0.6/tpl_custom" class="wikilink1" title="de:pnp-0.6:tpl_custom">Custom Templates</a> ist beschrieben, wie die Einstellungen vorgenommen werden k&ouml;nnen.
</p>
</div>
<!-- SECTION "RRD_STORAGE_TYPE = MULTIPLE" [1-1502] -->
<h2><a name="ein_konverter" id="ein_konverter">Ein Konverter</a></h2>
<div class="level2">
<p>
Das Script <code>libexec/rrd_convert.pl</code> dient zum Umschalten des RRD_STORAGE_TYPE auf MULTIPLE und zum gleichzeitigen migrieren der RRD-Datenbanken.
</p>
<p>
Maßgeblich ist dabei wie immer bei PNP das Nagios-Check-Command.
</p>
<pre class="code">rrd_convert.pl --check_command=&lt;nagios_check_command&gt; | --list_commands [ --dry-run ] [ --tmp_dir=&lt;temp-dir&gt; ]
[[ --no_structure_check ]]</pre>
<p>
Das Script erwartet &uuml;ber die Option <code>--check-command=</code> das Check-Command, nach dem gesucht werden soll.
</p>
<p>
<code>rrd_convert.pl</code> wird nun alle PNP-<acronym title="Extensible Markup Language">XML</acronym>-Dateien nach diesem Command durchsuchen und eine Statistik ausgeben.
</p>
<p>
Nach Best&auml;tigung durch den User beginnt das Konvertieren der einzelnen RRD-Datenbanken, wobei der aktuelle Ablauf angezeigt wird. Das Script endet, wenn Sie &lt;ENTER&gt; dr&uuml;cken, also geben Sie bitte einen Buchstaben ein.
</p>
<p>
Die Option <code>--dry-run</code> sorgt daf&uuml;r, dass die RRD-Datenbanken zwar konvertiert, jedoch in <code>/tmp/rrd_convert</code> in separaten Verzeichnissen je Host gespeichert werden. So kann man sich einen &Uuml;berblick &uuml;ber die zu erwartende Laufzeit und das Datenvolumen verschaffen.
</p>
<p>
Wenn Sie das tempor&auml;re Verzeichnis &auml;ndern m&ouml;chten, dann k&ouml;nnen Sie das mit Hilfe der Option <code>--tmp_dir=&lt;alternatives TMP-Directory&gt; tun.
Ab und zu passt die Anzahl der Datasources in den RRD-Dateien nicht zu der Anzahl in den <acronym title="Extensible Markup Language">XML</acronym>-Dateien. Das passiert z.B. dann, wenn Plugins pl&ouml;tzlich eine andere Zahl von Datenreihen liefern (siehe oben check_disk). Mit der Option </code>--no_structure_check&#039;&#039; werden auch diese RRD-Dateien konvertiert.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">back to contents</a> | <a href="/de/pnp-0.6/npcd" class="wikilink1" title="de:pnp-0.6:npcd">NPCD-Details</a>
</p>
</div>
<!-- SECTION "Ein Konverter" [1503-] -->

View File

@@ -0,0 +1,153 @@
<h1><a name="rrdtool_cache_daemon" id="rrdtool_cache_daemon">RRDtool Cache Daemon</a></h1>
<div class="level1">
<p>
In großen Installationen wird man &uuml;ber kurz oder lang feststellen, dass die Verarbeitung der Performance-Daten eine recht hohe I/O-Last zur Folge hat. RRDtool muss extrem viele Updates auf Disk schreiben, kann dabei jedoch den Disk-Cache nicht optimal ausnutzen.
</p>
<p>
Eine Optimierung stellt das Sammeln und Sortieren der Daten dar. Es ist f&uuml;r das System effektiver, viele Updates im Block in eine RRD-Datenbank zu schreiben. Der Disk-Cache kann dabei effektiver genutzt werden.
</p>
<p>
In der aktuellen RRDtool-Version ( <a href="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> ) ist der rrdcached enthalten, der genau diese Situation verbessern soll.
</p>
<p>
An dieser Stelle m&ouml;chte ich mich bei Florian octo Forster, Kevin Brintnall und Tobi Oetiker bedanken. Die Entwicklung dieses Daemons wurde vorbildlich auf der <a href="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> Mailingliste koordiniert.
</p>
</div>
<!-- SECTION "RRDtool Cache Daemon" [1-979] -->
<h2><a name="arbeitsweise" id="arbeitsweise">Arbeitsweise</a></h2>
<div class="level2">
<p>
Der rrdcached arbeitet als Daemon im Hintergrund und &ouml;ffnet einen UNIX- oder TCP-Socket, auf dem er auf Anfragen von rrdtool wartet. Aufgrund von Sicherheitsbedenken ist es in neueren Versionen von rrdcached aber nicht mehr m&ouml;glich absolute Pfadangaben (wie bei pnp4nagios &uuml;blich) bei Netzwerkzugriffen zu verwenden, daher ist derzeit nur Nutzung von UNIX-Sockets m&ouml;glich.
</p>
</div>
<!-- SECTION "Arbeitsweise" [980-1383] -->
<h3><a name="rrdcached" id="rrdcached">rrdcached</a></h3>
<div class="level3">
<p>
Der rrdcached kennt einige wichtige Optionen, die beim Start &uuml;bergeben werden.
</p>
<p>
Option -l definiert den Socket, auf dem der rrdcached Requests annimmt. Der Default-UDP-Port ist 42217, der Default-UNIX-Socket /tmp/rrdcached.sock.
</p>
<pre class="code">
-l unix:/pfad/zum/rrdcached.sock
-l /pfad/zum/rrdcached.sock
-l 127.0.0.1
-l 127.0.0.1:8888
</pre>
<p>
Option -P gibt die f&uuml;r die nachfolgenden Sockets (mit -l spezifiziert) erlaubten Befehle an, welche auf die RRD-Datenbanken angewendet werden k&ouml;nnen.
</p>
<pre class="code">-P FLUSH,PENDING</pre>
<p>
Option -s erlaubt es die Gruppenzugeh&ouml;rigkeit der nachfolgenden UNIX-Sockets zu &auml;ndern.
</p>
<pre class="code">-s nagios</pre>
<p>
Option -m setzt die Zugriffsrechte f&uuml;r die nachfolgenden UNIX-Sockets auf die (in oktal) angegebenen Werte.
</p>
<pre class="code">-m 0660</pre>
<p>
Option -w bestimmt den Intervall in Sekunden, in dem die Daten auf Disk geschrieben werden sollen.
</p>
<pre class="code">-w 1800</pre>
<p>
Option -z definiert einen Delay, der die &uuml;ber die Option -w definierten Schreibzyklen in einen zuf&auml;lligen Bereich [0-delay] verteilt, um gleichzeitige Schreibzugriffe zu verhindern. Der Wert der Option -z darf nicht gr&ouml;ßer gew&auml;hlt werden als -w.
</p>
<pre class="code">-z 1800</pre>
<p>
Option -p definiert ein PID File
</p>
<pre class="code">-p /var/run/rrdcached.pid</pre>
<p>
Option -j definiert den Pfad zu einem Journal-Verzeichnis. Dort werden alle Auftr&auml;ge protokolliert und ggf. beim n&auml;chsten Start nachgefahren, falls der rrdcached-Daemon abst&uuml;rzt.
</p>
<pre class="code">-j /var/cache/rrdcached</pre>
<p>
Daraus ergibt sich beispielsweise ein Aufruf von rrdached mit folgenden Parametern
</p>
<pre class="code"> rrdcached -w 1800 -z 1800 -p /tmp/rrdcached.pid -j /tmp -s nagios -m 0660 -l unix:/tmp/rrdcached.sock</pre>
</div>
<!-- SECTION "rrdcached" [1384-3068] -->
<h3><a name="rrdtool" id="rrdtool">rrdtool</a></h3>
<div class="level3">
<p>
RRDtool selbst wird die Existenz des Daemons &uuml;ber die Option --daemon=&lt;socket&gt; mitgeteilt.
</p>
<pre class="code"> rrdtool --daemon=unix:/tmp/rrdcached.sock update ...</pre>
<p>
Dies muss nat&uuml;rlich mit den Startoptionen des rrdcached &uuml;bereinstimmen!
</p>
</div>
<!-- SECTION "rrdtool" [3069-3312] -->
<h2><a name="integration_in_pnp" id="integration_in_pnp">Integration in PNP</a></h2>
<div class="level2">
<p>
Da zwei Bestandteile von PNP auf den rrdcached vorbereitet werden m&uuml;ssen, ergeben sich &Auml;nderungen in zwei Config-Files. Außerdem muß der User unter welchem der Webserver l&auml;uft zur Gruppe unter der Nagios l&auml;uft hinzugef&uuml;gt werden.
</p>
<p>
1. Anpassen der <code>process_perfdata.cfg</code> f&uuml;r den Datensammler <code>process_perfdata.pl</code>
</p>
<pre class="code">
# EXPERIMENTAL rrdcached Support
# Use only with rrdtool svn revision 1511+
#
RRD_DAEMON_OPTS = unix:/var/run/rrdcached.sock
</pre>
<p>
2. Anpassen der <code>config_local.php</code> (bzw. config.php) f&uuml;r das Webinterface
</p>
<pre class="code">
#
# EXPERIMENTAL rrdcached Support
# Use only with rrdtool svn revision 1511+
#
# $conf[&#039;RRD_DAEMON_OPTS&#039;] = &#039;unix:/tmp/rrdcached.sock&#039;;
$conf[&#039;RRD_DAEMON_OPTS&#039;] = &#039;unix:/var/run/rrdcached.sock&#039;;
</pre>
<p>
Die passenden Optionen sind bereits in den Beispieldateien enthalten.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/rrd_convert" class="wikilink1" title="de:pnp-0.6:rrd_convert">migrieren von RRD-Dateien</a>
</p>
</div>
<!-- SECTION "Integration in PNP" [3313-] -->

View File

@@ -0,0 +1,199 @@
<h1><a name="dokumentation" id="dokumentation">Dokumentation</a></h1>
<div class="level1">
<div class="box red centered" style="width: 99%; ">
<b class='xtop'><b class='xb1'></b><b class='xb2'></b><b class='xb3'></b><b class='xb4'></b></b>
<div class='xbox'>
<div class='box_content'>PNP4Nagios Broker Module npcdmod.o ist nicht kompatibel mit Nagios Core 4.x</div>
</div>
<b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b>
</div>
<p>
<div class="flattr_left"><a class="FlattrButton" style="display:none;" title="PNP Dokumentation" href="http://docs.pnp4nagios.org/de/pnp-0.6/start" rev="flattr;uid:44827;category:text;language:de;tags:;">PNP4Nagios Dokumentation Version 0.6.x[...]</a></div>
</p>
<p>
<a href="/_detail/pnp-0.6/gallery/pnp-preview-05-08-2009.png?id=de%3Apnp-0.6%3Astart" class="media" title="pnp-0.6:gallery:pnp-preview-05-08-2009.png"><img src="/_media/pnp-0.6/gallery/pnp-preview-05-08-2009.png?w=215" class="mediaright" align="right" title="Theme &quot;smoothness&quot;" alt="Theme &quot;smoothness&quot;" width="215" /></a>
</p>
<p>
PNP ist ein Addon f&uuml;r Nagios, das es erm&ouml;glicht, die von Nagios Plugins gelieferten Performancedaten zu analysieren und automatisch in RRD Datenbanken zu speichern.
</p>
<p>
W&auml;hrend der Entwicklung von PNP haben wir Wert auf eine einfache Installation und auf wenig Aufwand im laufenden Betrieb gelegt. Ein Administrator hat besseres zu tun als Graphing Tools zu konfigurieren.
</p>
<p>
Um diese Aufgabe zu erf&uuml;llen, setzen wir bewusst auf Standards. PNP verarbeitet nur Performancedaten, die sich strikt an die <a href="http://nagiosplug.sourceforge.net/developer-guidelines.html" class="urlextern" title="http://nagiosplug.sourceforge.net/developer-guidelines.html" rel="nofollow">Developer Guidelines</a> f&uuml;r Nagios Plugins halten. Mit dieser Einschr&auml;nkung wollen wir bewusst die Arbeit der <a href="http://nagiosplugins.org" class="urlextern" title="http://nagiosplugins.org" rel="nofollow">Nagios Plugin Developer</a> honorieren, die sich f&uuml;r die Einhaltung der Richtlinien einsetzen.
</p>
<p>
F&uuml;r alle, die nun noch neugierig sind, steht die folgende Dokumentation bereit, um den Einstieg in PNP zu erleichtern.
</p>
<p>
<a href="/de/pnp-0.6/doc_complete" class="wikilink1" title="de:pnp-0.6:doc_complete">komplette Dokumentation auf &quot;einer&quot; Seite</a>
</p>
</div>
<!-- SECTION "Dokumentation" [1-1298] -->
<h2><a name="dokumentation1" id="dokumentation1">Dokumentation</a></h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> <strong>&Uuml;ber PNP</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/new-features" class="wikilink1" title="de:pnp-0.6:new-features">Neue Funktionen in PNP 0.6.x</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/about#anforderungen" class="wikilink1" title="de:pnp-0.6:about">Anforderungen</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/about#lizenz" class="wikilink1" title="de:pnp-0.6:about">Lizenz</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/about#download" class="wikilink1" title="de:pnp-0.6:about">Download</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/about#support" class="wikilink1" title="de:pnp-0.6:about">Support</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/about#datenhaltung" class="wikilink1" title="de:pnp-0.6:about">Speicherung</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Release Notes (en)</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/dwnld" class="wikilink1" title="pnp-0.6:dwnld">Changelog</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Upgrade</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/upgrade" class="wikilink1" title="de:pnp-0.6:upgrade">Upgrade von 0.4.x auf 0.6.x</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Welcher Modus ist f&uuml;r mich richtig ?</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/modes" class="wikilink1" title="de:pnp-0.6:modes">Synchronous Mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/modes#bulk_mode" class="wikilink1" title="de:pnp-0.6:modes">Bulk Mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/modes#bulk_mode_mit_npcd" class="wikilink1" title="de:pnp-0.6:modes">Bulk Mode mit NPCD</a> </div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/modes#bulk_mode_mit_npcdmod" class="wikilink1" title="de:pnp-0.6:modes">Bulk Mode mit npcdmod</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/modes#gearman_mode" class="wikilink1" title="de:pnp-0.6:modes">Gearman Mode</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Die Installation</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/install" class="wikilink1" title="de:pnp-0.6:install">Make und Co</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/install#update" class="wikilink1" title="de:pnp-0.6:install">Update</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/install#die_komponenten" class="wikilink1" title="de:pnp-0.6:install">Die Komponenten</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Konfiguration</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/config" class="wikilink1" title="de:pnp-0.6:config">Synchronous Mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/config#bulk_mode" class="wikilink1" title="de:pnp-0.6:config">Bulk Mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/config#bulk_mode_with_npcd" class="wikilink1" title="de:pnp-0.6:config">Bulk Mode mit NPCD</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/config#bulk_mode_with_npcd_und_npcdmod" class="wikilink1" title="de:pnp-0.6:config">Bulk Mode mit npcdmod</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/config#gearman_mode" class="wikilink1" title="de:pnp-0.6:config">Gearman Mode</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Der erste Test / Troubleshooting</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/verify" class="wikilink1" title="de:pnp-0.6:verify">Funktion pr&uuml;fen</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/verify_pnp_config" class="wikilink1" title="de:pnp-0.6:verify_pnp_config">Pr&uuml;f-Script</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Das Web Frontend</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/webfe" class="wikilink1" title="de:pnp-0.6:webfe">Nagios und PNP</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/webfe" class="wikilink1" title="de:pnp-0.6:webfe">action_url</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/webfe_cfg" class="wikilink1" title="de:pnp-0.6:webfe_cfg">Konfigurationsoptionen</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/mobile" class="wikilink1" title="de:pnp-0.6:mobile">Mobile UI (neu in 0.6.14)</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/timeranges" class="wikilink1" title="de:pnp-0.6:timeranges">Timeranges</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/pages" class="wikilink1" title="de:pnp-0.6:pages">Pages</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/xport" class="wikilink1" title="de:pnp-0.6:xport">Datenexport</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/widgets" class="wikilink1" title="de:pnp-0.6:widgets">Widgets</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>PNP Templates</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/tpl" class="wikilink1" title="de:pnp-0.6:tpl">Was sind Templates ?</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/tpl" class="wikilink1" title="de:pnp-0.6:tpl">Wann wird welches Template verwendet?</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/tpl" class="wikilink1" title="de:pnp-0.6:tpl">Eigene Templates erstellen</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/tpl_custom" class="wikilink1" title="de:pnp-0.6:tpl_custom">Custom Templates</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/tpl_special" class="wikilink1" title="de:pnp-0.6:tpl_special">Special Templates(neu in 0.6.5)</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/tpl_helper" class="wikilink1" title="de:pnp-0.6:tpl_helper">Helper Functions (neu in 0.6.5)</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/tpl_helper_pnp" class="wikilink1" title="de:pnp-0.6:tpl_helper_pnp">Helper Functions, Teil II (neu in 0.6.10)</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Advanced Features</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/advanced" class="wikilink1" title="de:pnp-0.6:advanced">PNP in verteilten Umgebungen</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/advanced" class="wikilink1" title="de:pnp-0.6:advanced">check_multi Unterst&uuml;tzung</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/rrdcached" class="wikilink1" title="de:pnp-0.6:rrdcached">rrdcached Unterst&uuml;tzung</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/rrd_convert" class="wikilink1" title="de:pnp-0.6:rrd_convert">Migrieren von RRD Files f&uuml;r RRD_STORAGE_TYPE = MULTIPLE</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>NPCD</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/npcd" class="wikilink1" title="de:pnp-0.6:npcd">NPCD Details</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Anhang</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="http://docs.pnp4nagios.org/de/faq" class="urlextern" title="http://docs.pnp4nagios.org/de/faq" rel="nofollow">FAQ</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/wrapper" class="wikilink1" title="de:pnp-0.6:wrapper">wrapper-Script</a></div>
</li>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/perfdata_format" class="wikilink1" title="de:pnp-0.6:perfdata_format">Format Performance-Daten</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Helferlein (unsupported)</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/de/pnp-0.6/ndo2pnp" class="wikilink1" title="de:pnp-0.6:ndo2pnp">NDO to PNP</a></div>
</li>
</ul>
</li>
</ul>
</div>
<!-- SECTION "Dokumentation" [1299-] -->

View File

@@ -0,0 +1,96 @@
<h1><a name="timeranges" id="timeranges">Timeranges</a></h1>
<div class="level1">
<p>
In der &Uuml;bersicht zeigt PNP f&uuml;nf Zeitbereiche, die frei in der config.php definiert werden k&ouml;nnen.
</p>
<p>
Es gibt aber auch die M&ouml;glichkeit, die Zeitbereiche &uuml;ber die <acronym title="Uniform Resource Locator">URL</acronym> zu beeinflussen. Dies ist hilfreich, wenn z.B. automatisch <acronym title="Portable Document Format">PDF</acronym>-Dokumente erstellt werden sollen
</p>
<p>
Die Zeitbereiche werden &uuml;ber die Optionen <code>start</code> und <code>end</code> definiert.
</p>
<p>
Beispiel:
</p>
<pre class="code"> pnp4nagios/graph?host=&lt;hostname&gt;&amp;srv=&lt;servicedesc&gt;&amp;start=-1week</pre>
<pre class="code"> pnp4nagios/graph?host=&lt;hostname&gt;&amp;srv=&lt;servicedesc&gt;&amp;start=2011102322:50:00&amp;end=2011102409:50:00</pre>
<p>
Der Startzeitpunkt der Graphen wird somit, ausgehend vom aktuellen Datum, um eine Woche nach hinten verschoben. Der Endzeitpunkt bleibt auf dem aktuellen Zeitstempel. Aber auch <code>end</code> l&auml;sst sich &uuml;ber diesen Weg beeinflussen, wobei beide Optionen auch einzeln manipuliert werden d&uuml;rfen.
</p>
<table class="inline">
<tr class="row0">
<th class="col0"> start </th><th class="col1"> end </th><th class="col2"> view </th><th class="col3"> Ergebnis </th>
</tr>
<tr class="row1">
<td class="col0 leftalign"> </td><td class="col1 leftalign"> </td><td class="col2 leftalign"> </td><td class="col3">Alle Ansichten enden mit der aktuellen Zeit </td>
</tr>
<tr class="row2">
<td class="col0 centeralign"> x </td><td class="col1 leftalign"> </td><td class="col2 leftalign"> </td><td class="col3">Alle Ansichten beginnen mit dem angegebenen Datum </td>
</tr>
<tr class="row3">
<td class="col0 leftalign"> </td><td class="col1 centeralign"> x </td><td class="col2 leftalign"> </td><td class="col3">Alle Ansichten enden mit dem angegebenen Datum </td>
</tr>
<tr class="row4">
<td class="col0 centeralign"> x </td><td class="col1 centeralign"> x </td><td class="col2 leftalign"> </td><td class="col3">Eine Ansicht zwischen den beiden Zeitangaben </td>
</tr>
<tr class="row5">
<td class="col0 leftalign"> </td><td class="col1 leftalign"> </td><td class="col2 centeralign"> x </td><td class="col3">Eine Ansicht endet mit der aktuellen Zeit </td>
</tr>
<tr class="row6">
<td class="col0 centeralign"> x </td><td class="col1 leftalign"> </td><td class="col2 centeralign"> x </td><td class="col3">Eine Ansicht beginnt mit dem angegebenen Datum </td>
</tr>
<tr class="row7">
<td class="col0 leftalign"> </td><td class="col1 centeralign"> x </td><td class="col2 centeralign"> x </td><td class="col3">Eine Ansicht endet mit dem angegebenen Datum </td>
</tr>
</table>
<p>
Beispiele zur Datumsangabe:
</p>
<table class="inline">
<tr class="row0">
<th class="col0 centeralign"> Format </th><th class="col1 leftalign"> Beschreibung </th>
</tr>
<tr class="row1">
<td class="col0 leftalign"> 2009W04 </td><td class="col1"> 4. KW 2009 </td>
</tr>
<tr class="row2">
<td class="col0 leftalign"> 1.5.2009 </td><td class="col1"> 1. Mai 2009 </td>
</tr>
<tr class="row3">
<td class="col0 leftalign"> -1 day </td><td class="col1"> Einen Tag zur&uuml;ck </td>
</tr>
<tr class="row4">
<td class="col0 leftalign"> -3 weeks </td><td class="col1 leftalign"> 3 Wochen zur&uuml;ck </td>
</tr>
<tr class="row5">
<td class="col0 leftalign"> -1 year </td><td class="col1 leftalign"> Ein Jahr zur&uuml;ck </td>
</tr>
<tr class="row6">
<td class="col0"> yesterday </td><td class="col1"> Gestern </td>
</tr>
<tr class="row7">
<td class="col0"> 2011102322:50:00 </td><td class="col1"> 23.10.2011 ab 22:50:00 Uhr</td>
</tr>
</table>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/pages" class="wikilink1" title="de:pnp-0.6:pages">Pages</a>
</p>
</div>

View File

@@ -0,0 +1,243 @@
<h1><a name="was_sind_templates" id="was_sind_templates">Was sind Templates ?</a></h1>
<div class="level1">
<p>
PNP benutzt Templates, um das Aussehen der RRD-Graphen zu beeinflussen.
</p>
<p>
Dabei bestimmt das verwendete check_command, welches Template zur Darstellung herangezogen wird. Im Folgenden wird beschrieben, wo Templates gespeichert werden und wie die Entscheidung f&uuml;r das “richtige” Template getroffen wird.
</p>
</div>
<!-- SECTION "Was sind Templates ?" [1-340] -->
<h2><a name="wann_wird_welches_template_verwendet" id="wann_wird_welches_template_verwendet">Wann wird welches Template verwendet ?</a></h2>
<div class="level2">
<p>
Templates werden an zwei Stellen im Dateisystem gespeichert.
</p>
<ul>
<li class="level1"><div class="li"> share/templates.dist - f&uuml;r Templates, die im PNP-Paket bereits enthalten sind.</div>
</li>
<li class="level1"><div class="li"> share/templates - f&uuml;r selbst erstellte Templates. Diese werden bei Updates nicht ver&auml;ndert.</div>
</li>
</ul>
<p>
Weiterhin k&ouml;nnen seit Version 0.6.5 weitere Template Verzeichnisse in der Config Datei <code>pnp4nagios/etc/config.php</code> hinzugef&uuml;gt werden.
</p>
<p>
Soll der Graph f&uuml;r den Service “http” auf Host “localhost” angezeigt werden, so sucht PNP zuerst nach der <acronym title="Extensible Markup Language">XML</acronym>-Datei <code>perfdata/localhost/http.xml</code> und liest diese ein. Diese <acronym title="Extensible Markup Language">XML</acronym>-Dateien werden automatisch erstellt und enthalten Informationen zum jeweiligen Host und Service. Weiterhin enth&auml;lt der Kopf Informationen &uuml;ber das Plugin und die Performance-Daten. Im folgenden Beispiel erkennt man anhand des <acronym title="Extensible Markup Language">XML</acronym>-Tags <code>&lt;TEMPLATE&gt;</code>, welches PNP-Template f&uuml;r diesen Graphen verwendet werden soll.
</p>
<p>
<code><strong>/localhost/http.xml</strong></code>
</p>
<pre class="code xml"><span class="sc3"><span class="re1">&lt;NAGIOS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;TEMPLATE<span class="re2">&gt;</span></span></span>check_http<span class="sc3"><span class="re1">&lt;/TEMPLATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DS<span class="re2">&gt;</span></span></span>1<span class="sc3"><span class="re1">&lt;/DS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAME<span class="re2">&gt;</span></span></span>time<span class="sc3"><span class="re1">&lt;/NAME<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;UNIT<span class="re2">&gt;</span></span></span>s<span class="sc3"><span class="re1">&lt;/UNIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;ACT<span class="re2">&gt;</span></span></span>0.006721<span class="sc3"><span class="re1">&lt;/ACT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;WARN<span class="re2">&gt;</span></span></span>1.000000<span class="sc3"><span class="re1">&lt;/WARN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;CRIT<span class="re2">&gt;</span></span></span>2.000000<span class="sc3"><span class="re1">&lt;/CRIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MIN<span class="re2">&gt;</span></span></span>0.000000<span class="sc3"><span class="re1">&lt;/MIN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MAX<span class="re2">&gt;</span></span><span class="re1">&lt;/MAX<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;TEMPLATE<span class="re2">&gt;</span></span></span>check_http<span class="sc3"><span class="re1">&lt;/TEMPLATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DS<span class="re2">&gt;</span></span></span>2<span class="sc3"><span class="re1">&lt;/DS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAME<span class="re2">&gt;</span></span></span>size<span class="sc3"><span class="re1">&lt;/NAME<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;UNIT<span class="re2">&gt;</span></span></span>B<span class="sc3"><span class="re1">&lt;/UNIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;ACT<span class="re2">&gt;</span></span></span>263<span class="sc3"><span class="re1">&lt;/ACT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;WARN<span class="re2">&gt;</span></span><span class="re1">&lt;/WARN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;CRIT<span class="re2">&gt;</span></span><span class="re1">&lt;/CRIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MIN<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/MIN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MAX<span class="re2">&gt;</span></span><span class="re1">&lt;/MAX<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/DATASOURCE<span class="re2">&gt;</span></span></span>
...
<span class="sc3"><span class="re1">&lt;/NAGIOS<span class="re2">&gt;</span></span></span></pre>
<p>
PNP h&auml;ngt <code>.php</code> an und sucht nun nach einem Template mit dem Namen <code>check_http.php</code> in folgender Reihenfolge:
</p>
<ol>
<li class="level1"><div class="li"> templates/check_http.php</div>
</li>
<li class="level1"><div class="li"> templates.dist/check_http.php</div>
</li>
<li class="level1"><div class="li"> templates/default.php</div>
</li>
<li class="level1"><div class="li"> templates.dist/default.php</div>
</li>
</ol>
<p>
Das Template default.php nimmt somit eine Sonderstellung ein und wird immer verwendet, wenn vorher kein anderes Template gefunden wird.
</p>
</div>
<!-- SECTION "Wann wird welches Template verwendet ?" [341-2179] -->
<h2><a name="eigene_templates_erstellen" id="eigene_templates_erstellen">Eigene Templates erstellen</a></h2>
<div class="level2">
<p>
PNP-Templates sind <acronym title="Hypertext Preprocessor">PHP</acronym>-Dateien, die zur Laufzeit von PNP &uuml;ber die <acronym title="Hypertext Preprocessor">PHP</acronym>-Funktion include() eingebunden werden.
Dies bedeutet, dass jeder <acronym title="Hypertext Preprocessor">PHP</acronym>-Code in Templates interpretiert wird. Daher ist die Manipulation aller Werte &uuml;ber <acronym title="Hypertext Preprocessor">PHP</acronym> m&ouml;glich.
</p>
<p>
PNP-Templates m&uuml;ssen folgende Eigenschaften besitzen:
</p>
<ol>
<li class="level1"><div class="li"> Templates m&uuml;ssen g&uuml;ltigen <acronym title="Hypertext Preprocessor">PHP</acronym>-Code enthalten.</div>
</li>
<li class="level1"><div class="li"> Templates d&uuml;rfen keine Ausgabe erzeugen.</div>
</li>
<li class="level1"><div class="li"> innerhalb der Templates werden die zwei Arrays $opt[] und $def[] gef&uuml;llt.</div>
</li>
</ol>
<p>
Die beiden <acronym title="Hypertext Preprocessor">PHP</acronym>-Arrays $opt[] und $def[] zusammen bilden den Aufruf von <code>&#039;rrdtool graph</code>&#039;. Somit sind alle Optionen m&ouml;glich, die RRDtool bietet. Die Optionen von RRDtool sind auf der <a href="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> genauestens beschrieben.
</p>
<p>
Wenn beide Arrays mehrere Datens&auml;tze enthalten, so wird f&uuml;r jeden Datensatz ein Graph erstellt.
</p>
<p>
Weiterhin stehen innerhalb der Templates die Daten aus dem zugeh&ouml;rigen <acronym title="Extensible Markup Language">XML</acronym>-File zur Verf&uuml;gung, die zum Erstellen der Graphen wieder verwendet werden k&ouml;nnen.
</p>
<p>
Am Beispiel des recht einfachen Templates response.php lassen sich die wichtigsten Optionen recht gut beschreiben.
</p>
<pre class="code php"><span class="kw2">&lt;?php</span>
<span class="co2">#
</span><span class="re0">$opt</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;--title <span class="es1">\&quot;</span>Response Time For <span class="es4">$hostname</span> / <span class="es4">$servicedesc</span><span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="co2">#
</span><span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;DEF:var1=<span class="es4">$RRDFILE[1]</span>:<span class="es4">$DS[1]</span>:AVERAGE &quot;</span> <span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;AREA:var1#00FF00:<span class="es1">\&quot;</span>Response Times <span class="es1">\&quot;</span> &quot;</span> <span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;LINE1:var1#000000 &quot;</span> <span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;GPRINT:var1:LAST:<span class="es1">\&quot;</span>%3.4lg <span class="es6">%s</span><span class="es4">$UNIT[1]</span> LAST <span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;GPRINT:var1:MAX:<span class="es1">\&quot;</span>%3.4lg <span class="es6">%s</span><span class="es4">$UNIT[1]</span> MAX <span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;GPRINT:var1:AVERAGE:<span class="es1">\&quot;</span>%3.4lg <span class="es6">%s</span><span class="es4">$UNIT[1]</span> AVERAGE <span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="sy1">?&gt;</span></pre>
<p>
<strong><code>$opt[1] = ”--title …”</code></strong> setzt RRDtool-Optionen f&uuml;r den ersten Datensatz im Array. Hier ist das der Titel des Graphen.
Wie man sieht, werden eingebettete Anf&uuml;hrungszeichen durch einen Backslash (\) maskiert.
Die beiden Variablen <code>$hostname</code> und <code>$servicedesc</code> sind durch den Aufruf von PNP ermittelt worden und stehen nun auch im Template zur Verf&uuml;gung.
</p>
<p>
<strong><code>$def[1] = “DEF:var1=$RRDFILE[1]:$DS[1]:AVERAGE ”;</code></strong> definiert, welche Daten aus welchem RRD-File gelesen werden sollen. $RRDFILE[1] enth&auml;lt den Pfad zur RRD-Datei dieses Services. $DS[1] verweist auf die Datenreihe eins aus der RRD-Datei.
</p>
<p>
<strong><code>$def[1] .= “AREA:var1#00FF00:\”Response Times \” ”;</code></strong> durch den Operator ”.=” werden weitere Daten an das Array $def[1] angeh&auml;ngt. Gezeichnet wird eine Fl&auml;che (AREA) mit den Daten der Variable var1. Die Farbe wird im HEX-Code #00FF00 definiert. Als Beschriftung wird “Response Times” verwendet.
</p>
<p>
<strong><code>$def[1] .= “LINE1:var1#000000 ”;</code></strong> Als Abschluss der eben gezeichneten Fl&auml;che wird eine Linie (LINE1) in Schwarz (#000000) gezeichnet.
</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>
Die drei GPRINT Zeilen bilden die Legende des Graphen. Die aktuellen Werte werden dabei &uuml;ber die <a href="http://en.wikipedia.org/wiki/printf" class="interwiki iw_wp" title="http://en.wikipedia.org/wiki/printf">printf</a> Syntax formatiert.
</p>
</div>
<!-- SECTION "Eigene Templates erstellen" [2180-5177] -->
<h2><a name="verfuegbare_variablen" id="verfuegbare_variablen">Verf&uuml;gbare Variablen</a></h2>
<div class="level2">
<p>
PNP speichert &uuml;ber den Datensammler <code>process_perfdata.pl</code> zur Laufzeit nicht nur Performancedaten, sondern auch weitere von Nagios exportierte Werte. Diese Werte werden in der jeweils f&uuml;r den Service g&uuml;ltigen <acronym title="Extensible Markup Language">XML</acronym>-Datei gespeichert.
</p>
<p>
Im ersten Teil der <acronym title="Extensible Markup Language">XML</acronym>-Datei werden die Performancedaten in ihre Einzelteile zerlegt gespeichert.
</p>
<pre class="code xml"><span class="sc3"><span class="re1">&lt;NAGIOS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;TEMPLATE<span class="re2">&gt;</span></span></span>check_http<span class="sc3"><span class="re1">&lt;/TEMPLATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DS<span class="re2">&gt;</span></span></span>1<span class="sc3"><span class="re1">&lt;/DS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAME<span class="re2">&gt;</span></span></span>time<span class="sc3"><span class="re1">&lt;/NAME<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;UNIT<span class="re2">&gt;</span></span></span>s<span class="sc3"><span class="re1">&lt;/UNIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;ACT<span class="re2">&gt;</span></span></span>0.006721<span class="sc3"><span class="re1">&lt;/ACT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;WARN<span class="re2">&gt;</span></span></span>1.000000<span class="sc3"><span class="re1">&lt;/WARN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;CRIT<span class="re2">&gt;</span></span></span>2.000000<span class="sc3"><span class="re1">&lt;/CRIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MIN<span class="re2">&gt;</span></span></span>0.000000<span class="sc3"><span class="re1">&lt;/MIN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MAX<span class="re2">&gt;</span></span><span class="re1">&lt;/MAX<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/DATASOURCE<span class="re2">&gt;</span></span></span>
...
<span class="sc3"><span class="re1">&lt;/NAGIOS<span class="re2">&gt;</span></span></span></pre>
<p>
Das Feld &lt;DS&gt; bezeichnet die DataSource und dient der Identifizierung der Datenreihen innerhalb der RRD-Dateien, ist aber auch der Schl&uuml;ssel der folgenden Arrays.
</p>
<p>
Im Array <code>$UNIT[1]</code> ist somit die Einheit der ersten Datenreihe gespeichert.
</p>
<p>
Die <acronym title="Extensible Markup Language">XML</acronym>-Datei enth&auml;lt jedoch noch weitere Informationen. Wird <code>process_perdata.pl</code> im sync-Mode verwendet, so sind alle verf&uuml;gbaren Makros mit den aktuellen Werten verf&uuml;gbar. Der folgende Ausschnitt ist jedoch zu Gunsten der Lesbarkeit gek&uuml;rzt.
</p>
<pre class="code xml"><span class="sc3"><span class="re1">&lt;NAGIOS<span class="re2">&gt;</span></span></span>
...
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICENOTIFICATIONID<span class="re2">&gt;</span></span></span>8418<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICENOTIFICATIONID<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICENOTIFICATIONNUMBER<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICENOTIFICATIONNUMBER<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEOUTPUT<span class="re2">&gt;</span></span></span>HTTP OK HTTP/1.1 200 OK - 10087 bytes in 0.125 seconds<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEOUTPUT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPERCENTCHANGE<span class="re2">&gt;</span></span></span>0.00<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEPERCENTCHANGE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPERFDATA<span class="re2">&gt;</span></span></span>time=0.124811s;;;0.000000 size=10087B;;;0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEPERFDATA<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPERFDATAFILE<span class="re2">&gt;</span></span><span class="re1">&lt;/NAGIOS_SERVICEPERFDATAFILE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPROBLEMID<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEPROBLEMID<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICESTATE<span class="re2">&gt;</span></span></span>OK<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICESTATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICESTATEID<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICESTATEID<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICESTATETYPE<span class="re2">&gt;</span></span></span>HARD<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICESTATETYPE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SHORTDATETIME<span class="re2">&gt;</span></span></span>27-12-2007 13:51:23<span class="sc3"><span class="re1">&lt;/NAGIOS_SHORTDATETIME<span class="re2">&gt;</span></span></span>
...
<span class="sc3"><span class="re1">&lt;/NAGIOS<span class="re2">&gt;</span></span></span></pre>
<p>
Die einzelnen <acronym title="Extensible Markup Language">XML</acronym>-Felder sind als Variablen in den PNP-Templates verwendbar, wobei jedes Feld als Variable gleichen Namens verf&uuml;gbar ist.
</p>
<p>
Aus <code>&lt;NAGIOS_SERVICEOUTPUT&gt;</code> wird die Variable <code>$NAGIOS_SERVICEOUTPUT</code>.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/tpl_custom" class="wikilink1" title="de:pnp-0.6:tpl_custom">Custom Templates</a>
</p>
</div>
<!-- SECTION "Verf&uuml;gbare Variablen" [5178-] -->

View File

@@ -0,0 +1,326 @@
<h1><a name="custom_templates" id="custom_templates">Custom Templates</a></h1>
<div class="level1">
<p>
Wie bereits unter ”<a href="/de/pnp-0.6/tpl" class="wikilink1" title="de:pnp-0.6:tpl">Was sind Templates ?</a>” beschrieben, ist die Darstellung der Graphen abh&auml;ngig vom verwendeten Check-Command.
</p>
<p>
Es gibt jedoch Situationen, in denen dieses Verhalten &uuml;bersteuert werden muss, zum Beispiel dann wenn allgemeing&uuml;ltige Commands definiert wurden.
</p>
<p>
PNP, speziell process_perfdata.pl, sucht zur Laufzeit f&uuml;r jedes check_command im Verzeichnis etc/check_commands nach einer Config-Datei (&lt;check_command&gt;.cfg) und liest diese, wenn vorhanden, ein.
Folgende Optionen k&ouml;nnen darin definiert werden:
</p>
</div>
<!-- SECTION "Custom Templates" [1-565] -->
<h2><a name="custom_template" id="custom_template">CUSTOM_TEMPLATE</a></h2>
<div class="level2">
<p>
Geht man von folgendem Beispiel einer Nagios command-Definition aus:
</p>
<pre class="code">
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a &quot;$ARG2$&quot;
}
</pre>
<p>
Die Folge w&auml;re, dass immer das Template check_nrpe.php verwendet werden w&uuml;rde, auch wenn auf dem zu &uuml;berwachenden Server via NRPE ein ganz anderes Plugin aufgerufen wurde.
</p>
<p>
Da unser Beispiel-Command check_nrpe lautet, wird nach etc/check_commands/check_nrpe.cfg gesucht.
</p>
<p>
Eine Beispiel-Config wird bereits w&auml;hrend der Installation mit der Dateierweiterung .cfg-sample in etc/check_commands gespeichert.
</p>
<pre class="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> sorgt daf&uuml;r, dass nur der Inhalt von $ARG1$ als Template-Name verwendet wird. Da in diesem Beispiel $ARG1$ mit dem Wert “load” gef&uuml;llt ist, ergibt sich als Template-Name “load.php”
</p>
<p>
<code>CUSTOM_TEMPLATE = 0,1</code> ergibt → “check_nrpe_load.php”
</p>
<p>
<code>CUSTOM_TEMPLATE = 1,0</code> ergibt → “load_check_nrpe.php”
</p>
<p>
Diese Option hat nur Einfluss, wenn die RRD Datenbank neu erstellt wird.
</p>
</div>
<!-- SECTION "CUSTOM_TEMPLATE" [566-1811] -->
<h2><a name="datatype" id="datatype">DATATYPE</a></h2>
<div class="level2">
<p>
&Uuml;ber die Option “DATATYPE” kann beeinflusst werden, mit welchem Datentyp die RRD-Datenbank angelegt werden soll.
Default ist in diesem Fall “GAUGE”. F&uuml;r fortlaufende Werte wird aber hier der Datentyp COUNTER ben&ouml;tigt.
Normalerweise sollten Plugin-Entwickler f&uuml;r Daten von Typ Counter die Einheit “c” verwenden. Dies ist jedoch nicht immer der Fall.
</p>
<p>
Alle Datenreihen auf Typ COUNTER einstellen.
</p>
<pre class="code">DATATYPE = COUNTER</pre>
<p>
Einzelnen Datenreihen spezielle Datentypen zuweisen
</p>
<pre class="code">DATATYPE = GAUGE,GAUGE,COUNTER,COUNTER</pre>
<p>
Weitere Datentypen sind in der RRDTool-Dokumentation unter <a href="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> erkl&auml;rt.
</p>
<p>
Diese Option hat nur Einfluss, wenn die RRD Datenbank neu erstellt wird.
</p>
</div>
<!-- SECTION "DATATYPE" [1812-2580] -->
<h2><a name="use_min_on_create_und_use_max_on_create" id="use_min_on_create_und_use_max_on_create">USE_MIN_ON_CREATE und USE_MAX_ON_CREATE</a></h2>
<div class="level2">
<p>
In einigen wenigen Situationen ist es notwendig, die f&uuml;r RRDTool g&uuml;ltigen Daten zu begrenzen.
</p>
<p>
RRD-Datenbanken lassen sich mit definierten Minimum- und Maximum-Werten anlegen.
Weitere Infos unter <a href="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>
Ber&uuml;cksichtigen des Maximum-Wertes aus den Performance-Daten
</p>
<pre class="code">USE_MAX_ON_CREATE = 1</pre>
<p>
Ber&uuml;cksichtigen des Minimum-Wertes aus den Performance-Daten
</p>
<pre class="code">USE_MIN_ON_CREATE = 1</pre>
<p>
Diese Option hat nur Einfluss, wenn die RRD Datenbank neu erstellt wird.
</p>
</div>
<!-- SECTION "USE_MIN_ON_CREATE und USE_MAX_ON_CREATE" [2581-3154] -->
<h2><a name="rrd_storage_type" id="rrd_storage_type">RRD_STORAGE_TYPE</a></h2>
<div class="level2">
<pre class="code">RRD_STORAGE_TYPE = SINGLE</pre>
<p>
Die Option RRD_STORAGE_TYPE definiert die Art der Datenhaltung.
</p>
<p>
M&ouml;gliche Werte sind MULTIPLE und SINGLE
</p>
<p>
SINGLE: Eine RRD-Datenbank pro Service
</p>
<p>
MULTIPLE: Ein oder mehrere RRD-Datenbanken pro Service. F&uuml;r jede Datenreihe wird eine eigene RRD-Datenbank erstellt.
</p>
<p>
<strong>ACHTUNG:</strong> Daten werden nicht automatisch migriert!<br/>
Ein Konvertierungs-Script finden Sie <a href="/de/pnp-0.6/rrd_convert" class="wikilink1" title="de:pnp-0.6:rrd_convert">hier</a>.
</p>
<p>
Diese Option hat nur Einfluss, wenn die RRD Datenbank neu erstellt wird.
</p>
</div>
<!-- SECTION "RRD_STORAGE_TYPE" [3155-3680] -->
<h2><a name="rrd_heartbeat" id="rrd_heartbeat">RRD_HEARTBEAT</a></h2>
<div class="level2">
<p>
<strong>G&uuml;ltig ab PNP 0.6.1</strong>
</p>
<pre class="code">RRD_HEARTBEAT = 305</pre>
<p>
Nach &lt;RRD_HEARTBEAT&gt; Sekunden erwartet RRDtool neue Daten.
</p>
<p>
Mehr dazu unter <a href="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>
Diese Option hat nur Einfluss, wenn die RRD Datenbank neu erstellt wird.
</p>
</div>
<!-- SECTION "RRD_HEARTBEAT" [3681-3970] -->
<h2><a name="hints_on_template_names" id="hints_on_template_names">Hints on Template Names</a></h2>
<div class="level2">
<p>
In den meisten Situationen, kann man erw&uuml;nsche Template Namen relativ einfach, durch die Verwendung geeignter command Objekt Definitionen, erhalten.
</p>
<p>
Man betrachte folgendes Beispiel:
</p>
<pre class="code">
define command {
command_name check_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$
}
</pre>
<p>
mit commands wie diesem:
</p>
<pre class="code">
check_command check_by_ssh!/usr/lib/nagios/plugins/check_load -w 4,4,4 -c 5,5,5
</pre>
<p>
Selbst wenn man “CUSTOM_TEMPLATE = 1” benutz, w&uuml;rde man template Namen wie diesen “_usr_lib_nagios_plugins_check_load_-w_4,4,4_-c_5,5,5” erhalten, was h&ouml;chst unerw&uuml;nscht ist, insbesondere wegen den darin enthaltenen Parametern.
</p>
<p>
<strong>L&ouml;sung 1: Die Parameter in eigenst&auml;ndige $ARGn$ auslagern</strong>
</p>
<p>
Eine einfache L&ouml;sung ist die Verwendung der folgenden command Objekt Definition:
</p>
<pre class="code">
define command {
command_name check_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$ $ARG2$
}
</pre>
<p>
mit commands wie diesem:
</p>
<pre class="code">
check_command check_by_ssh!/usr/lib/nagios/plugins/check_load!-w 4,4,4 -c 5,5,5
</pre>
<p>
(man beachte das hinzugekommene “!”)
</p>
<p>
Dies funktioniert selbst dann, wann $ARG2$ leer bleibt.
</p>
<p>
Selbstverst&auml;ndlich m&uuml;sste man immer noch “CUSTOM_TEMPLATE = 1” setzen.
</p>
<p>
<strong>L&ouml;sung 2: Den remote executor in der command Objekt Definition verstecken</strong>
</p>
<p>
Eine andere L&ouml;sung ist es, den remote excutor in den jeweiligen command Objekt Definitionen zu verstekcne.
</p>
<p>
Anstatt folgender Definition:
</p>
<pre class="code">
define command {
command_name check_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$ $ARG2$
}
</pre>
<p>
w&uuml;rde man dies f&uuml;r <strong>jeden</strong> fern auszuf&uuml;hrenden command definieren:
</p>
<pre class="code">
define command {
command_name check_load_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ /usr/lib/nagios/plugins/check_load $ARG1$
}
</pre>
<p>
mit commands wie diesem:
</p>
<pre class="code">
check_load_by_ssh!-w 4,4,4 -c 5,5,5
</pre>
<p>
Nat&uuml;rlich darf “CUSTOM_TEMPLATE = 1” bei dieser L&ouml;sung nicht mehr gesetzt werden.
</p>
<p>
Welche der obigen L&ouml;sungen verwendet wird, ist weitgehend Geschmacksache.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/advanced" class="wikilink1" title="de:pnp-0.6:advanced">PNP in verteilten Umgebungen</a>
</p>
</div>
<!-- SECTION "Hints on Template Names" [3971-] -->

View File

@@ -0,0 +1,246 @@
<h1><a name="template_helper_functions" id="template_helper_functions">Template Helper Functions</a></h1>
<div class="level1">
<p>
Helper-Funktionen sind dazu gedacht, die Templates zu vereinfachen und Fehler abzufangen.
</p>
</div>
<!-- SECTION "Template Helper Functions" [1-132] -->
<h2><a name="rrddef" id="rrddef">rrd::def</a></h2>
<div class="level2">
<p>
string <strong>rrd::def</strong> ( $vname, $rrdfile, $ds, [ $cf=&#039;AVERAGE&#039; ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">def</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="re0">$RRDFILE</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$DS</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st_h">'MAX'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html</a>
</p>
</div>
<!-- SECTION "rrd::def" [133-351] -->
<h2><a name="rrdcdef" id="rrdcdef">rrd::cdef</a></h2>
<div class="level2">
<p>
string <strong>rrd::cdef</strong> ( $vname, $rpn, )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cdef</span><span class="br0">&#40;</span><span class="st_h">'var1_bits'</span><span class="sy0">,</span> <span class="st_h">'var1,8,*'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html</a>
</p>
</div>
<!-- SECTION "rrd::cdef" [352-536] -->
<h2><a name="rrdvdef" id="rrdvdef">rrd::vdef</a></h2>
<div class="level2">
<p>
string <strong>rrd::vdef</strong> ( $vname, $rpn, )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">vdef</span><span class="br0">&#40;</span><span class="st_h">'var1_avg'</span><span class="sy0">,</span> <span class="st_h">'var1,AVERAGE'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html</a>
</p>
</div>
<!-- SECTION "rrd::vdef" [537-724] -->
<h2><a name="rrdline_1-3" id="rrdline_1-3">rrd::line[1-3]</a></h2>
<div class="level2">
<p>
string <strong>rrd::line[1-3]</strong> ( $vname, $color, [ $text ], [ $stack ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line1</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="co2">#ff00ff );</span></pre>
<p>
Eine einfache Linie, ein Pixel breit, ohne Label-Text
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line3</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'#ff00ff'</span><span class="sy0">,</span> <span class="st_h">'Load'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Eine Linie, drei Pixel breit, und dem Label “Load”
</p>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html</a>
</p>
</div>
<!-- SECTION "rrd::line[1-3]" [725-1114] -->
<h2><a name="rrdarea" id="rrdarea">rrd::area</a></h2>
<div class="level2">
<p>
string <strong>rrd::area</strong> ( $vname, $color, [ $text ], [ $stack ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">area</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'#ff00ff'</span><span class="sy0">,</span> <span class="st_h">'Load'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Eine Fl&auml;che mit dem Label “Load”
</p>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html</a>
</p>
</div>
<!-- SECTION "rrd::area" [1115-1362] -->
<h2><a name="rrdgprint" id="rrdgprint">rrd::gprint</a></h2>
<div class="level2">
<p>
string <strong>rrd::gprint</strong> ( $vname, $cf, [ $text ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'MAX'</span><span class="sy0">,</span> <span class="st_h">'%4.2lf %s Max'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st_h">'MIN'</span><span class="sy0">,</span> <span class="st_h">'MAX'</span><span class="sy0">,</span> <span class="st_h">'AVERAGE'</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="st_h">'%4.2lf %s'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Ist $cf ein Array, so wird automatisch eine Legende formatiert ausgegeben.
</p>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html</a>
</p>
</div>
<!-- SECTION "rrd::gprint" [1363-1743] -->
<h2><a name="rrdcolor" id="rrdcolor">rrd::color</a></h2>
<div class="level2">
<p>
string <strong>rrd::color</strong> ( $num [, $num ])
</p>
<p>
Liefert eine Farbe aus der <acronym title="HyperText Markup Language">HTML</acronym>-Farbtabelle. Als zweites (optionales) Argument kann man einen Alpha-Wert angeben, der die Transparenz der Farbe festlegt.
</p>
<p>
Beginnend mit PNP 0.6.18 akzeptiert die Funktion ein drittes Argument, das auf Farbschemadefinitionen in <code>config.php</code> verweist (oder in <code>config_local.php</code>, die bei Updates nicht &uuml;berschrieben wird). Dort finden Sie das Array $scheme[], z.B.
</p>
<pre class="code">$scheme[&#039;Reds&#039;] = array (...)</pre>
<p>
Im Template definieren Sie
</p>
<pre class="code">$schema = $this-&gt;config-&gt;scheme[&#039;Reds&#039;]
...
rrd:color ($key, &#039;&#039;, $schema);</pre>
<p>
Aus diese Weise w&auml;hlen Sie den Wert von $scheme[&#039;Reds&#039;][$key]. Falls $key nicht innerhalb des Arrays liegt oder der Name nicht korrekt ist (<strong>case-sensitiv</strong>), dann wird die Standardpalette verwendet.
</p>
</div>
<!-- SECTION "rrd::color" [1744-2569] -->
<h2><a name="rrdgradient" id="rrdgradient">rrd::gradient</a></h2>
<div class="level2">
<p>
string <strong>rrd::gradient</strong> ( $vname, [$start_color], [$end_color], [$label], [$steps], [$lower] )
</p>
<p>
Erzeugt einen Farbverlauf von $start_color nach $end_color
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gradient</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'#ff0000'</span><span class="sy0">,</span> <span class="st_h">'#ffff00'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/gradient" class="wikilink1" title="templates:gradient">Beispiel</a>
</p>
</div>
<!-- SECTION "rrd::gradient" [2570-2860] -->
<h2><a name="rrdcut" id="rrdcut">rrd::cut</a></h2>
<div class="level2">
<p>
string <strong>rrd::cut</strong> ( $text, $length )
</p>
<pre class="code php"><span class="re0">$label</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cut</span><span class="br0">&#40;</span><span class="re0">$LABEL</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> 18<span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Schneidet einen Text auf eine gegebene L&auml;nge $length ab oder f&uuml;llt wenn n&ouml;tig auf $length auf.
Diese Funktion ist hilfreich, wenn die Legende ausgerichtet werden soll, aber die L&auml;nge des Labels nicht bekannt ist.
</p>
</div>
<!-- SECTION "rrd::cut" [2861-3195] -->
<h2><a name="rrdticker" id="rrdticker">rrd::ticker</a></h2>
<div class="level2">
<p>
string <strong>rrd::ticker</strong> ( $vname, $warning, $critical, [$fraction], [$opacity], [$color_OK], [$color_WARN], [$color_CRIT] )
</p>
<p>
Erzeugt einen farbigen Balken am oberen Rand des Graphen, der je nach OK, WARNING &amp; CRITICAL unterschiedliche Farben annimmt
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">ticker</span><span class="br0">&#40;</span> <span class="st0">&quot;var1&quot;</span><span class="sy0">,</span> <span class="re0">$WARN</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$CRIT</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/ticker" class="wikilink1" title="templates:ticker">Beispiel</a>
</p>
</div>
<!-- SECTION "rrd::ticker" [3196-3572] -->
<h2><a name="rrdalerter" id="rrdalerter">rrd::alerter</a></h2>
<div class="level2">
<p>
string <strong>rrd::alerter</strong> ( $vname, $label, $warning, $critical, [$opacity], [$unit], [$color_OK], [$color_WARN], [$color_CRIT], [$line_col] )
</p>
<p>
Erzeugt Areas, die entsprechend der Werte OK, WARNING &amp; CRITICAL unterschiedliche Farben annehmen
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">alerter</span><span class="br0">&#40;</span> <span class="st0">&quot;var1&quot;</span><span class="sy0">,</span> <span class="re0">$LABEL</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$WARN</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$CRIT</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st0">&quot;FF&quot;</span><span class="sy0">,</span> <span class="re0">$UNIT</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/alerter" class="wikilink1" title="templates:alerter">Beispiel</a>
</p>
</div>
<!-- SECTION "rrd::alerter" [3573-3970] -->
<h2><a name="rrdalerter_gr" id="rrdalerter_gr">rrd::alerter_gr</a></h2>
<div class="level2">
<p>
string <strong>rrd::alerter_gr</strong> ( $vname, $label, $warning, $critical, [$opacity], [$unit], [$color_OK], [$color_WARN], [$color_CRIT], [$line_col], [$start_color] )
</p>
<p>
Erzeugt Gradienten, die entsprechend der Werte OK, WARNING &amp; CRITICAL unterschiedliche Farben annehmen
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">alerter_gr</span><span class="br0">&#40;</span> <span class="st0">&quot;var1&quot;</span><span class="sy0">,</span> <span class="re0">$LABEL</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$WARN</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$CRIT</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st0">&quot;FF&quot;</span><span class="sy0">,</span> <span class="re0">$UNIT</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/alerter_gr" class="wikilink1" title="templates:alerter_gr">Beispiel</a>
</p>
</div>
<!-- SECTION "rrd::alerter_gr" [3971-] -->

View File

@@ -0,0 +1,91 @@
<h1><a name="pnp_helper_functions" id="pnp_helper_functions">PNP Helper Functions</a></h1>
<div class="level1">
<p>
PNP-Helper-Funktionen sind dazu gedacht, die Erstellung von Templates zu vereinfachen. Im Gegensatz zu den rrd-Helper-Funktionen rufen sie keine existierenden RRDtool-Funktionen auf.
</p>
</div>
<!-- SECTION "PNP Helper Functions" [1-220] -->
<h2><a name="pnpadjust_unit" id="pnpadjust_unit">pnp::adjust_unit</a></h2>
<div class="level2">
<p>
(string,number,string,number) <strong>pnp::adjust_unit</strong> ( $value, $base=1000, $format=&#039;%.3lf&#039; )
</p>
<p>
Der Zweck dieser Funktion ist die “Normalisierung” von großen Zahlen. Moderne Festplatten haben Gr&ouml;ßen von mehreren <acronym title="Gigabyte">GB</acronym> oder TB erreicht und wenn Sie auf Zahlen wie 1521073648234 schauen, dann fangen Sie an, die Ziffern zu z&auml;hlen, also w&auml;re es sch&ouml;n, diese Zahlen in ein “handliches” Format zu verwandeln. Das Gleiche gilt f&uuml;r Netzwerkverkehr.
</p>
<p>
An die Funktion werden bis zu drei Parameter &uuml;bergeben und in jedem Fall ein Array mit vier Elementen zur&uuml;ckgeliefert.
</p>
<ul>
<li class="level1"><div class="li"> Der erste &uuml;bergebene Parameter ist der Wert (ggf. inklusive die “UOM”)</div>
</li>
<li class="level1"><div class="li"> Der zweite Parameter ist optional (Default “1000”, z.B. f&uuml;r “Traffic”), bzw. “1024” (z.B. Festplattengr&ouml;ßen)</div>
</li>
<li class="level1"><div class="li"> Der dritte Parameter ist optional (Default &#039;%.3lf&#039;) und gibt das Format des zur&uuml;ckzugebenden Wertes an</div>
</li>
</ul>
<pre class="code php"><span class="re0">$size</span> <span class="sy0">=</span> pnp<span class="sy0">::</span><span class="me2">adjust_unit</span><span class="br0">&#40;</span><span class="nu0">1521073648234</span><span class="sy0">,</span><span class="nu0">1024</span><span class="sy0">,</span><span class="st_h">'%7.3lf'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Bitte beachten Sie, dass “$size” ein Array ist, das aus vier Feldern besteht:
</p>
<pre class="code"> $size[0] := &quot; 1.383 T&quot;</pre>
<p>
enth&auml;lt den formatierten Wert inkl. der Einheit
</p>
<pre class="code"> $size[1] := &quot;1.383&quot;</pre>
<p>
enth&auml;lt den formatierten Wert (ohne f&uuml;hrende Leerzeichen)
</p>
<pre class="code"> $size[2] := &quot;T&quot;</pre>
<p>
enth&auml;lt die Einheit
</p>
<pre class="code"> $size[3] := &quot;1099511627776&quot;</pre>
<p>
enth&auml;lt den Divisor
</p>
<p>
Angenommen das Plugin “check_disk” liefert “<acronym title="Megabyte">MB</acronym>” als UOM, dann k&ouml;nnen Sie diese Einheit ebenfalls &uuml;bergeben
</p>
<pre class="code php"><span class="re0">$disk</span> <span class="sy0">=</span> pnp<span class="sy0">::</span><span class="me2">adjust_unit</span><span class="br0">&#40;</span><span class="st0">&quot;1524MB&quot;</span><span class="sy0">,</span><span class="nu0">1024</span><span class="sy0">,</span><span class="st_h">'%7.3lf'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
liefert als Ergebnis u.a.
$disk[0] := “1.448 <acronym title="Gigabyte">GB</acronym>
</p>
<p>
<a href="/_detail/templates/check_disk_1.png?id=de%3Apnp-0.6%3Atpl_helper_pnp" class="media" title="templates:check_disk_1.png"><img src="/_media/templates/check_disk_1.png" class="media" alt="" /></a><br/>
“altes” check_disk-Template mit der %s Direktive<br/>
</p>
<p>
<a href="/_detail/templates/check_disk_2.png?id=de%3Apnp-0.6%3Atpl_helper_pnp" class="media" title="templates:check_disk_2.png"><img src="/_media/templates/check_disk_2.png" class="media" alt="" /></a><br/>
“neues” check_disk-Template mit pnp::adjust_unit
</p>
</div>
<!-- SECTION "pnp::adjust_unit" [221-] -->

View File

@@ -0,0 +1,188 @@
<h1><a name="special_templates" id="special_templates">Special Templates</a></h1>
<div class="level1">
<p>
“Special Templates” dienen zum Zusammenfassen von Daten beliebiger Hosts und Services und sind somit nicht direkt mit einem Host oder Service verknüpft.
</p>
<p>
Oftmals ist es gewünscht Daten verschiedener Services in einem Graphen darzustellen. Immer wenn die <a href="/de/pnp-0.6/pages" class="wikilink1" title="de:pnp-0.6:pages">&quot;Pages&quot;</a> nicht genügen, können die Special Templates ins Spiel kommen.
</p>
</div>
<!-- SECTION "Special Templates" [1-372] -->
<h2><a name="grundlagen" id="grundlagen">Grundlagen</a></h2>
<div class="level2">
<p>
“Special Templates” werden in <code>pnp4nagios/share/templates.special</code> gesucht und müssen die Dateiendung <code>.php</code> besitzen.
</p>
<p>
Aufgerufen werden “Special Templates” über den Controller “special” unter
</p>
<pre class="code">http://&lt;your-nagios-server&gt;/pnp4nagios/special?tpl=&lt;template&gt;</pre>
<p>
<code>&lt;template&gt;</code> ist entsprechend durch das jeweilige Template ohne die Dateiendung .php zu ersetzen.
</p>
<p>
Ein entsprechender Link erscheint im PNP-Interface, wenn mindestens ein “Special Template” gefunden wurde.
</p>
</div>
<!-- SECTION "Grundlagen" [373-873] -->
<h2><a name="beispiel" id="beispiel">Beispiel</a></h2>
<div class="level2">
<p>
Aufgabe ist die Antwortzeiten aller Webserver mit dem Hostnamen websrv01, websrv02 und websrv03 in einem Graphen anzuzeigen. Die Daten sollen aus dem Service “<acronym title="Hyper Text Transfer Protocol">HTTP</acronym>” stammen.
</p>
<p>
Step 1: Anlegen eines Templates “websrv_response_times.php” unter pnp4nagios/share/templates.special
</p>
<p>
“Special Templates” beginnen immer mit der Definition des Titels und eines Kommentars.
</p>
<pre class="code php"><span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'TITLE'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times&quot;</span><span class="sy0">;</span>
<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'COMMENT'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times for all Cluster Nodes&quot;</span><span class="sy0">;</span></pre>
<p>
Step 2: Eine Liste aller in Frage kommenden Hosts/Services erstellen. PNP stellt hierfür die Funktion <code>tplGetServices()</code> bereit.
</p>
<p>
tplGetServices() erwartet zwei Parameter.
</p>
<p>
Parameter 1 ist ein regulärer Ausdruck auf den zu suchenden Host, Parameter 2 ist entsprechend ein regulärer Ausdruck für den Service.
</p>
<pre class="code php"><span class="re0">$services</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetServices</span><span class="br0">&#40;</span><span class="st0">&quot;websrv&quot;</span><span class="sy0">,</span><span class="st0">&quot;HTTP&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
$services enthält nun ein Array aller gefundenen Services.
</p>
<p>
Um die Entwicklung der Templates zu erleichtern und Einblick in die Datenstrukturen zu erhalten, kann man Kohana durch Auslösen einer Exception zum Abbrechen der Verarbeitung zwingen.
</p>
<p>
Um Einblick in die Daten von $services zu erhalten, genügt die folgende Zeile.
</p>
<pre class="code php">throw <span class="kw2">new</span> Kohana_exception<span class="br0">&#40;</span><a href="http://www.php.net/print_r"><span class="kw3">print_r</span></a><span class="br0">&#40;</span><span class="re0">$services</span><span class="sy0">,</span><span class="kw4">TRUE</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Ausgabe bei Aufruf von pnp4nagios/special?tpl=websrv_response_times
</p>
<pre class="code">
Array (
[0] =&gt; Array (
[host] =&gt; websrv01
[service] =&gt; HTTP
)
[1] =&gt; Array (
[host] =&gt; websrv02
[service] =&gt; HTTP
)
[2] =&gt; Array (
[host] =&gt; websrv03
[service] =&gt; HTTP
)
)
</pre>
<p>
Die Variable $services enthält somit ein Array aller gefundenen Services, in diesem Fall also drei Hosts mit dem Service “<acronym title="Hyper Text Transfer Protocol">HTTP</acronym>
</p>
<p>
Step 3: Durchlaufen des Array $services und erstellen der Graph-Definitionen.
</p>
<pre class="code php"><span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$services</span> <span class="kw1">as</span> <span class="re0">$key</span><span class="sy0">=&gt;</span><span class="re0">$val</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
<span class="re0">$data</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetData</span><span class="br0">&#40;</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'host'</span><span class="br0">&#93;</span><span class="sy0">,</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'service'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$hostname</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cut</span><span class="br0">&#40;</span><span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'MACRO'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'HOSTNAME'</span><span class="br0">&#93;</span><span class="sy0">,</span> 15<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">def</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span> <span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'RRDFILE'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line1</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> rrd<span class="sy0">::</span><span class="me2">color</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="re0">$hostname</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&quot;MAX&quot;</span><span class="sy0">,</span> <span class="st0">&quot;AVERAGE&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre>
<p>
Die Funktion <code>tplGetData()</code> wird innerhalb der Schleife verwendet, um das jeweilige <acronym title="Extensible Markup Language">XML</acronym>-File einzulesen. Die Daten werden als Array zurückgeliefert und stehen nun in $data zur Verfügung.
</p>
<p>
In diesem Beispiel kommen weitere kleine PNP-Helfer zum Einsatz, zu erkennen am Präfix <code>rrd::</code>.
</p>
<p>
Die Funktion <a href="/de/pnp-0.6/tpl_helper#rrdcut" class="wikilink1" title="de:pnp-0.6:tpl_helper">rrd::cut()</a> schneidet einen String auf eine bestimmte Länge oder füllt auf diese Länge auf. Dies ist hilfreich, um die Legende auszurichten.
</p>
<p>
Die Funktion <a href="/de/pnp-0.6/tpl_helper#rrdgprint" class="wikilink1" title="de:pnp-0.6:tpl_helper">rrd::gprint()</a> erzeugt die Legende unter dem Graphen.
</p>
<p>
Die Funktion <a href="/de/pnp-0.6/tpl_helper#rrdcolor" class="wikilink1" title="de:pnp-0.6:tpl_helper">rrd::color()</a> liefert eine Farbe aus einer fest definierten Farbliste zurück.
</p>
<p>
Mehr Informationen zu den PNP-Helper-Funktionen finden Sie <a href="/de/pnp-0.6/tpl_helper" class="wikilink1" title="de:pnp-0.6:tpl_helper">hier</a>.
</p>
<pre class="code php"><span class="kw2">&lt;?php</span>
<span class="co2">#
</span><span class="co2"># Special Template websrv_response_times.php
</span><span class="co2">#
</span><span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'TITLE'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times&quot;</span><span class="sy0">;</span>
<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'COMMENT'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times for all Cluster Nodes&quot;</span><span class="sy0">;</span>
<span class="co2">#
</span><span class="co2"># Get a List of Services by regex
</span><span class="co2"># Option 1 = 'Host Regex'
</span><span class="co2"># Option 2 = 'Service Regex'
</span><span class="co2">#
</span><span class="re0">$services</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetServices</span><span class="br0">&#40;</span><span class="st0">&quot;websrv&quot;</span><span class="sy0">,</span><span class="st0">&quot;HTTP&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co2">#throw new Kohana_exception(print_r($services,TRUE));
</span><span class="co2">#
</span><span class="co2"># The Datasource Name for Graph 0
</span><span class="re0">$ds_name</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;Response Times&quot;</span><span class="sy0">;</span>
<span class="re0">$opt</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;--title <span class="es1">\&quot;</span>Response Times<span class="es1">\&quot;</span>&quot;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;&quot;</span><span class="sy0">;</span>
<span class="co2">#
</span><span class="co2"># Iterate through the list of hosts
</span><span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$services</span> <span class="kw1">as</span> <span class="re0">$key</span><span class="sy0">=&gt;</span><span class="re0">$val</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
<span class="co2">#
</span> <span class="co2"># get the data for a given Host/Service
</span> <span class="re0">$data</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetData</span><span class="br0">&#40;</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'host'</span><span class="br0">&#93;</span><span class="sy0">,</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'service'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co2">#
</span> <span class="co2"># Throw an exception to debug the content of $a
</span> <span class="co2"># Just to get Infos about the Array Structure
</span> <span class="co2">#
</span> <span class="co2">#throw new Kohana_exception(print_r($a,TRUE));
</span> <span class="re0">$hostname</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cut</span><span class="br0">&#40;</span><span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'MACRO'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'HOSTNAME'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">def</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span> <span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'RRDFILE'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line1</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> rrd<span class="sy0">::</span><span class="me2">color</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="re0">$hostname</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&quot;MAX&quot;</span><span class="sy0">,</span> <span class="st0">&quot;AVERAGE&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="sy1">?&gt;</span></pre>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">Zurück zur Übersicht</a>
</p>
</div>
<!-- SECTION "Beispiel" [874-] -->

View File

@@ -0,0 +1,218 @@
<h1><a name="upgrade_auf_version_06x" id="upgrade_auf_version_06x">Upgrade auf Version 0.6.x</a></h1>
<div class="level1">
<p>
Das Web-Frontend ist komplett neu geschrieben worden und basiert nun auf dem <acronym title="Hypertext Preprocessor">PHP</acronym> MVC Framework <a href="http://www.kohanaphp.com" class="urlextern" title="http://www.kohanaphp.com" rel="nofollow">Kohana</a>. Somit ergeben sich grundlegend andere Abh&auml;ngigkeiten, die dringend vor der Installation gepr&uuml;ft werden m&uuml;ssen.
</p>
<p>
Anmerkung: Ein Upgrade l&auml;uft zuerst wie eine Neuinstallation. Anschließend sind einige Anpassungen durchzuf&uuml;hren, die weiter unten beschrieben sind.
</p>
<p>
PNP 0.4.x wurde ohne weitere Angabe von Optionen beim Aufruf von <code>./configure</code> unterhalb einer Nagios-Installation unter <code>/usr/local/nagios</code> installiert.
</p>
<p>
PNP 0.6.x wird bei Angabe keiner weiteren Optionen unter <code>/usr/local/pnp4nagios</code> installiert, ist also wie Nagios als eigenst&auml;ndige Applikation zu sehen.
</p>
<p>
Anmerkung: Es reicht aus, die *.rrd-Dateien vom alten ins neue Verzeichnis zu kopieren. Sie enthalten die eigentlichen Daten. Die *.xml-Dateien werden jedes Mal neu angelegt, wenn Performance-Daten verarbeitet werden, denn sie enthalten lediglich Meta-Informationen. Außerdem hat sich die interne Struktur ge&auml;ndert, so dass sie sowieso nicht nutzbar sind.
</p>
</div>
<!-- SECTION "Upgrade auf Version 0.6.x" [1-1118] -->
<h2><a name="vergleich_der_struktur" id="vergleich_der_struktur">Vergleich der Struktur</a></h2>
<div class="level2">
<p>
Summary einer Installation von PNP 0.4.14
</p>
<pre class="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
RRDs Perl Modules: FOUND (Version 1.3001)
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
</pre>
<p>
Summary einer Installation von 0.6.0
</p>
<pre class="code">
./configure
...
*** Configuration summary for pnp4nagios-0.6.0 07-30-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/pnp4nagios/share
Config Dir: /usr/local/pnp4nagios/etc
Location of rrdtool binary: /usr/bin/rrdtool Version 1.3.1
RRDs Perl Modules: FOUND (Version 1.3001)
RRD Files stored in: /usr/local/pnp4nagios/var/perfdata
process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options: ------------------------- -------------------
HTML URL: http://localhost/pnp4nagios/
Apache Config File: /etc/apache2/conf.d/pnp4nagios.conf
</pre>
<p>
Aus diesen Infos ergeben sich die zu &auml;ndernden Parameter und somit die Upgrade-Strategie.
</p>
</div>
<!-- SECTION "Vergleich der Struktur" [1119-3024] -->
<h2><a name="anpassungen" id="anpassungen">Anpassungen</a></h2>
<div class="level2">
<p>
Die Vorlagen der action_url-Definitionen haben sich ver&auml;ndert. Statt ”/nagios/pnp” ist ”/pnp4nagios” einzutragen und statt “index.php” wird nun “graph” benutzt
</p>
<pre class="code">define host {
name host-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
register 0
}</pre>
<p>
&Auml;hnliches gilt f&uuml;r die Preview-Popup-Funktion
</p>
<pre class="code">define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=_HOST_&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/index.php/popup?host=$HOSTNAME$&amp;srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/popup?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
register 0
}</pre>
<p>
<strong>Achtung</strong>: Es ist <em>kein</em> Fehler, dass die Zeichenketten vor und nach “class” jeweils nur ein Apostroph enthalten.
</p>
<p>
Anders als in der 0.4.x Dokumentation vermerkt gelten die Templates f&uuml;r Nagios 2.x und 3.x. Der einzige Unterschied besteht darin, dass die action_url-Direktive in Nagios 2.x nicht in der Service-Definition, sondern in eigenen serviceextinfo-Definitionen verf&uuml;gbar ist.
</p>
<p>
Innerhalb der <acronym title="Hypertext Preprocessor">PHP</acronym>-Dateien im templates-Verzeichnis m&uuml;ssen alle Variablen vor der ersten Benutzung initialisiert werden, z.B.
</p>
<pre class="code">$lower = &quot;&quot;</pre>
<p>
Das gilt auch f&uuml;r Variablen, an die fr&uuml;her “angeh&auml;ngt” werden konnte, ohne sie vorher zu initialisieren. Daher wird aus
</p>
<pre class="code">foreach ($DS as $i) {
$def[1] .= &quot;DEF:var$i=$rrdfile:$DS[$i]:AVERAGE &quot; ;</pre>
<p>
nun
</p>
<pre class="code">
$def[1] = &quot;&quot;;
foreach ($DS as $i) {
$def[1] .= &quot;DEF:var$i=$rrdfile:$DS[$i]:AVERAGE &quot; ;</pre>
<p>
<br/>
Konstanten in Template-Dateien funktionieren nicht mehr, so dass diese in Variablen umzuwandeln sind. Aus
</p>
<pre class="code">define(&quot;_WARNRULE&quot;, &#039;#FFFF00&#039;);</pre>
<p>
wird dann z.B.
</p>
<pre class="code"> $WARNRULE = &#039;#FFFF00&#039;;</pre>
<p>
Man sollte daran denken, alle Vorkommen in der Datei zu &auml;ndern <img src="/lib/images/smileys/icon_wink.gif" class="middle" alt=";-)" />.
</p>
</div>
<!-- SECTION "Anpassungen" [3025-5026] -->
<h2><a name="upgrade_szenario_mit_npcd" id="upgrade_szenario_mit_npcd">Upgrade Szenario mit NPCD</a></h2>
<div class="level2">
<ol>
<li class="level1"><div class="li"> Planen des neuen Aufbaus.</div>
</li>
<li class="level1"><div class="li"> Testinstallation durchf&uuml;hren und sich mit dem neuen System vertraut machen.</div>
</li>
<li class="level1"><div class="li"> Backup erstellen.</div>
</li>
<li class="level1"><div class="li"> PNP 0.6.x nach <code>/usr/local/pnp4nagios</code> installieren.</div>
</li>
<li class="level1"><div class="li"> make install-config</div>
</li>
<li class="level1"><div class="li"> make install-webconf</div>
</li>
<li class="level1"><div class="li"> Apache reload.</div>
</li>
<li class="level1"><div class="li"> Apache-Config testen. </div>
<ol>
<li class="level2"><div class="li"> Aufruf <code>/pnp4nagios</code> muss ein leeres Perfdata-Verzeichnis melden.</div>
</li>
</ol>
</li>
<li class="level1"><div class="li"> <code>/usr/local/pnp4nagios/etc/npcd.cfg</code> aus der <code>npcd.cfg-sample</code> erstellen.</div>
<ol>
<li class="level2"><div class="li"> Pfade &uuml;berpr&uuml;fen und ggf. &Auml;nderungen der 0.4.x nachziehen.</div>
</li>
</ol>
</li>
<li class="level1"><div class="li"> Alle Pfade zur neuen Installation in der nagios.cfg anpassen.</div>
</li>
<li class="level1"><div class="li"> Alle Pfade in den Command-Definitionen anpassen.</div>
</li>
<li class="level1"><div class="li"> npcd &uuml;ber <code>/etc/init.d/npcd stop</code> anhalten.</div>
</li>
<li class="level1"><div class="li"> <code>make install-init</code> installiert das neue Init Script f&uuml;r den npcd.</div>
</li>
<li class="level1"><div class="li"> Nagios anhalten.</div>
</li>
<li class="level1"><div class="li"> <code>/usr/local/nagios/share/perfdata</code> nach <code>/usr/local/pnp4nagios/var/perfdata</code> kopieren. Achtung: Auf Permissions achten.</div>
</li>
<li class="level1"><div class="li"> <code>/etc/init.d/npcd</code> start</div>
</li>
<li class="level1"><div class="li"> <code>/etc/init.d/nagios</code> start</div>
</li>
</ol>
</div>
<!-- SECTION "Upgrade Szenario mit NPCD" [5027-] -->

View File

@@ -0,0 +1,133 @@
<h1><a name="pruefen_der_installation" id="pruefen_der_installation">Pr&uuml;fen der Installation</a></h1>
<div class="level1">
<p>
Wenn bis jetzt alles sauber funktioniert hat, kann PNP zum ersten Mal im Browser aufgerufen werden.
Bei der Installation mit den Standardeinstellungen erfolgt der Aufruf &uuml;ber <a href="http://%3CServername%3E/pnp4nagios/" class="urlextern" title="http://&lt;Servername&gt;/pnp4nagios/" rel="nofollow">http://&lt;Servername&gt;/pnp4nagios/</a>.
</p>
<p>
Beim ersten Aufruf sieht man die Seite “PNP4Nagios Environment Tests”, die verschiedene Tests von notwendigen Komponenten enth&auml;lt. Offenkundig sollten alle Tests erfolgreich verlaufen, bevor es weitergehen kann. Bitte beachten Sie die Hinweise auf der Seite.<br/>
</p>
<p>
Sind alle Tests erfolgreich verlaufen, so kann die Datei <code>pnp4nagios/share/install.php</code> gel&ouml;scht oder umbenannt werden. Erst dann ist das Webinterface erreichbar.
</p>
<p>
Alternativ kann eine Datei <code>pnp4nagios/share/install.ignore</code> angelegt werden, um den Aufruf des Installers nach weiteren Updates zu ignorieren.
</p>
<p>
Ohne weitere Optionen sucht PNP nach RRD- und <acronym title="Extensible Markup Language">XML</acronym>-Dateien in <code>pnp4nagios/var/perfdata/</code> und zeigt alle Graphen des ersten Hosts in der &Uuml;bersicht an.
</p>
<p>
ACHTUNG: Direkt nach dem (Neu-)Start von Nagios nach dem Aktivieren der Verarbeitung von Performance-Daten wird der Aufruf im Browser zu Fehlermeldungen f&uuml;hren, weil zun&auml;chst Performance-Daten gesammelt und in den RRD-Dateien abgelegt werden m&uuml;ssen. Abh&auml;ngig vom Check-Intervall kann es einige Zeit dauern, bis die ersten Graphen angezeigt werden k&ouml;nnen.
</p>
</div>
<!-- SECTION "Pr&uuml;fen der Installation" [1-1347] -->
<h2><a name="logfile" id="logfile">Logfile</a></h2>
<div class="level2">
<p>
W&auml;hrend der Installation wurde durch den Aufruf von <code>make install-config</code> ein Beispiel-Config-File <code>etc/process_perfdata.cfg-sample</code> erzeugt. Die Werte in der sample-Datei entsprechen den Default-Werten, die auch in <code>process_perfdata.pl</code> fest hinterlegt sind, daher ist die <code>process_perfdata.cfg</code> f&uuml;r den Betrieb nicht zwingend notwendig.
</p>
<p>
Die Datei <code>process_perfdata.cfg-sample</code> kann somit als Vorlage f&uuml;r die <code>process_perfdata.cfg</code> dienen, die immer dann notwendig ist, wenn vom Standard abweichende Werte eingestellt werden sollen.
</p>
<p>
In der <code>process_perfdata.<strong>cfg</strong></code> l&auml;sst sich das Verhalten von <code>process_perfdata.pl</code> vielfach beeinflussen.
</p>
<p>
Die wichtigsten Optionen f&uuml;r die Inbetriebnahme sind LOG_LEVEL und LOG_FILE. Im laufenden Betrieb sollte der Log-Level immer auf 0 gesetzt sein, um die Performance von process_perfdata.pl nicht durch unn&ouml;tiges Schreiben von Logfiles zu beeintr&auml;chtigen.
</p>
<p>
W&auml;hrend der Inbetriebnahme sollte man jedoch den <code>LOG_LEVEL</code> auf “2” setzen, um zu sehen, was process_perfdata.pl bei der Verarbeitung der Performance-Daten so alles anstellt.
</p>
<p>
Sp&auml;testens bei <a href="/de/pnp-0.6/about#support" class="wikilink1" title="de:pnp-0.6:about">Support Anfragen</a> im Forum oder auf den Mailinglisten werden wir sowohl nach Ausz&uuml;gen aus dem perfdata.log als auch nach der Ausgabe des <a href="/de/pnp-0.6/verify_pnp_config" class="wikilink1" title="de:pnp-0.6:verify_pnp_config">verify_pnp_config-Scripts</a> fragen. Es empfiehlt sich also, diese Angaben gleich mitzuliefern <img src="/lib/images/smileys/icon_wink.gif" class="middle" alt=";-)" />.
</p>
</div>
<!-- SECTION "Logfile" [1348-2761] -->
<h2><a name="was_aber_wenn_nicht" id="was_aber_wenn_nicht">Was aber wenn nicht ?</a></h2>
<div class="level2">
<p>
Einige grundlegende Einstellungen sind zu pr&uuml;fen.
</p>
<p>
1. Sind RRD- und <acronym title="Extensible Markup Language">XML</acronym>-Files erzeugt worden ?
</p>
<p>
<code>process_perfdata.pl</code> legt f&uuml;r jeden Host unter var/perfdata ein neues Verzeichnis an. In diesem Verzeichnis wird wiederum f&uuml;r jeden Service eine RRD-Datenbank und ein <acronym title="Extensible Markup Language">XML</acronym>-File erstellt. F&uuml;r den Host-Check lautet der Dateinamen <code>_HOST_.xml</code> bzw. <code>_HOST_.rrd</code>.<br/>
Falls Graphen urpl&ouml;tzlich nicht mehr weitergef&uuml;hrt werden, dann hilft vielleicht ein Blick in die betroffene <acronym title="Extensible Markup Language">XML</acronym>-Datei. Dort gibt es u.a. die Tags &lt;RC&gt; und &lt;TXT&gt;. &lt;RC&gt; zeigt den Return-Code des RRDtool-Updates der RRD-Datei, &lt;TXT&gt; eine textuelle Beschreibung.<br/>
Allerdings liefern nicht alle Checks Performance-Daten, das gilt u.a. f&uuml;r “check_ping”, die Alternative “check_icmp” dagegen erzeugt Daten (ab Nagios-Plugin-Version 1.4.12 liefert auch check_ping Performance-Daten).<br/>
Teilweise muss man zus&auml;tzliche Optionen aktivieren, damit Performance-Daten ausgegeben werden. Evtl. kann das auch durch ein <a href="/de/pnp-0.6/wrapper" class="wikilink1" title="de:pnp-0.6:wrapper">Wrapper-Script</a> ge&auml;ndert werden.<br/>
In den Detailinformationen zu jedem Host/Service gibt es das Feld “Performance-Data”. Wenn dort keine Daten stehen, dann werden im jeweiligen Verzeichnis keine Dateien erzeugt und PNP kann deshalb auch keine grafischen Auswertungen liefern!<br/>
Das folgende Bild zeigt die Informationen zu einem “PING”-Service. Das blaue Feld enth&auml;lt den vom Plugin gelieferten Text, das rote die Performance-Daten, die Nagios erkannt hat.<br/>
<a href="/_detail/srv_info.png?id=de%3Apnp-0.6%3Averify" class="media" title="srv_info.png"><img src="/_media/srv_info.png?w=250" class="media" title="Informationen zu &quot;PING&quot;" alt="Informationen zu &quot;PING&quot;" width="250" /></a>
</p>
<p>
2. Hat Nagios <code>process_perfdata.pl</code> aufgerufen ?
</p>
<p>
In der Config-Datei f&uuml;r process_perfdata.pl, der <code>etc/process_perfdata.<strong>cfg</strong></code> l&auml;sst sich der Debug-Level erh&ouml;hen. Die Verarbeitung der Daten wird nun in <code>var/perfdata.log</code> bzw. im Syslog protokolliert.
</p>
<p>
3. Grafiken werden ohne Text angezeigt ?
</p>
<p>
siehe <a href="/de/pnp-0.6/about#anforderungen" class="wikilink1" title="de:pnp-0.6:about">Anforderungen</a>
</p>
<p>
4. Einige Graphen werden angezeigt, andere melden den Fehler <code>“parser error: Input is not proper UTF-8”</code> oder etwas &auml;hnliches. Bitte pr&uuml;fen Sie, ob die Daten “spezielle” Zeichen enthalten, die nicht im <acronym title="American Standard Code for Information Interchange">ASCII</acronym>-Zeichensatz vorhanden sind (Umlaute, etc). Versuchen Sie, in <code>process_perfdata.cfg</code> den Wert von <code><acronym title="Extensible Markup Language">XML</acronym>_ENC</code> auf <code><acronym title="International Organization for Standardization">ISO</acronym>-8859-1</code> oder einen anderen passenden Wert zu setzen. Warten Sie, bis die xml-Datei neu erzeugt wurde und probieren Sie es nochmal.
</p>
<p>
5. Bei aktiviertem npcdmod-Modul muss der Wert von <code>event_broker_options</code> in der nagios.cfg ggf. angepasst werden. Hinweise gibt es <a href="/de/pnp-0.6/config#bulk_mode_with_npcd_und_npcdmod" class="wikilink1" title="de:pnp-0.6:config">hier</a>.
</p>
<p>
6. verify_pnp_config
Das <acronym title="Practical Extraction and Report Language">Perl</acronym>-Script <a href="/de/pnp-0.6/verify_pnp_config" class="wikilink1" title="de:pnp-0.6:verify_pnp_config">verify_pnp_config.pl</a> erm&ouml;glicht die Pr&uuml;fung von Konfigurationseinstellungen und zeigt, ob Performance-Daten vorhanden sind.
</p>
<p>
7. Es scheint zu funktionieren, aber es bleiben einige Dateien Spool-Verzeichnis stehen (/usr/local/pnp4nagios/var/spool/&lt;perfdata_filename&gt;-PID-&lt;process_perfdata_pid&gt;). Wenn <code>process_perdata.pl</code> nicht in das Zielverzeichnis (/usr/local/pnp4nagios/share/perfdata/&lt;host&gt;) schreiben kann, wird es anhalten und die Quelldatei nicht l&ouml;schen. Das erh&ouml;ht die Gr&ouml;ße des Spool-Verzeichnisses und die Verarbeitung der Performance-Daten verlangsamen. Dieses Problem kann auftreten, wenn Sie Verzeichnisse aus einer vorherigen Installation kopiert und/oder manuell Verzeichnisse angelegt haben und dabei die falschen Benutzer/Berechtigungen verwendet haben.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/verify_pnp_config" class="wikilink1" title="de:pnp-0.6:verify_pnp_config">verify_pnp_config.pl</a>
</p>
</div>
<!-- SECTION "Was aber wenn nicht ?" [2762-] -->

View File

@@ -0,0 +1,153 @@
<h1><a name="verify_pnp_config" id="verify_pnp_config">verify_pnp_config</a></h1>
<div class="level1">
<p>
Bei Problemen kann das <acronym title="Practical Extraction and Report Language">Perl</acronym>-Script <code>verify_pnp_config</code> von <a href="http://verify.pnp4nagios.org" class="urlextern" title="http://verify.pnp4nagios.org" rel="nofollow">http://verify.pnp4nagios.org</a> helfen die aktuelle Nagios/Icinga Konfiguration zu pr&uuml;fen und entsprechend Hinweise zur L&ouml;sung liefern.
</p>
<p>
Bei <a href="/de/pnp-0.6/about#support" class="wikilink1" title="de:pnp-0.6:about">Support Anfragen</a> sollte immer die Ausgabe dieses Scripts mit angegeben werden, da die Entwickler sich so einen besseren &Uuml;berblick &uuml;ber das verwendete System machen k&ouml;nnen.
</p>
<p>
Feedback, Verbesserungsvorschl&auml;ge oder Patches bitte per Mail an support@pnp4nagios.org
</p>
</div>
<!-- SECTION "verify_pnp_config" [1-516] -->
<h2><a name="download" id="download">Download</a></h2>
<div class="level2">
<p>
Das Verify Script ist unter <a href="http://verify.pnp4nagios.org" class="urlextern" title="http://verify.pnp4nagios.org" rel="nofollow">http://verify.pnp4nagios.org</a> verf&uuml;gbar.
</p>
<pre class="code">
wget http://verify.pnp4nagios.org/verify_pnp_config
</pre>
</div>
<!-- SECTION "Download" [517-677] -->
<h2><a name="test" id="test">Test</a></h2>
<div class="level2">
<p>
Das Verify Script ben&ouml;tigt drei Optionen um die Funktion von PNP4Nagios zu pr&uuml;fen
</p>
<pre class="code">
lenny:~# perl verify_pnp_config
verify_pnp_config -m|--mode=[sync|bulk|bulk+npcd|npcdmod]
                 -c|--config=[path to nagios.cfg]
                 -p|--pnpcfg=[path to PNP config dir]
</pre>
<p>
Die wichtigste Infos ist der zu pr&uuml;fende Modus, welcher mit der Option <code>--mode</code> angegeben wird.<br/>
Weitere Infos &uuml;ber die einzelnen Modi und deren Konfiguration unter <a href="/de/pnp-0.6/modes" class="wikilink1" title="de:pnp-0.6:modes">&quot;Welcher Modus ist f&uuml;r mich richtig ?&quot;</a> und <a href="/de/pnp-0.6/config" class="wikilink1" title="de:pnp-0.6:config">&quot;Konfiguration&quot;</a>
</p>
<p>
Weiterhin ist der Pfad zur Nagios Config Datei (nagios.cfg) &uuml;ber die Option <code>--config</code> zu &uuml;bergeben. Auf einem Icinga System ist es entsprechend der Pfad zur icinga.cfg.
</p>
<p>
&Uuml;ber <code>--pnpcfg</code> wird der Pfad zum <code>etc</code> Verzeichnis der PNP4Nagios Installation &uuml;bergeben.<br/>
</p>
<p>
Beim Aufruf von <code>perl verify_pnp_config</code> werden die verf&uuml;gbaren Optionen ausgegeben.
</p>
<pre class="code">
lenny:~# perl verify_pnp_config --mode npcdmod --config=/usr/local/nagios/etc/nagios.cfg --pnpcfg=/usr/local/pnp4nagios/etc
[INFO]  ========== Starting Environment Checks ============
[INFO]  My version is: verify_pnp_config-0.6.14-R.31
[INFO]  Reading /usr/local/nagios/etc/nagios.cfg
[OK  ]  Running product is &#039;nagios&#039;
[OK  ]  object_cache_file is defined
[OK  ]  object_cache_file=/usr/local/nagios/var/objects.cache
[INFO]  Reading /usr/local/nagios/var/objects.cache
[OK  ]  resource_file is defined
[OK  ]  resource_file=/usr/local/nagios/etc/resource.cfg
[INFO]  Reading /usr/local/nagios/etc/resource.cfg
[INFO]  Reading /usr/local/pnp4nagios/etc/process_perfdata.cfg
[INFO]  Reading /usr/local/pnp4nagios/etc/pnp4nagios_release
[OK  ]  Found PNP4Nagios version &quot;0.6.14&quot;
[OK  ]  Effective User is &#039;nagios&#039;
[OK  ]  User nagios exists with ID &#039;1000&#039;
[OK  ]  Effective group is &#039;nagios&#039;
[OK  ]  Group nagios exists with ID &#039;1000&#039;
[INFO]  ========== Checking npcdmod Mode Config  ============
[OK  ]  process_performance_data is 1 compared with &#039;/1/&#039;
[OK  ]  event_broker_options is defined
[OK  ]  event_broker_options=-1
[OK  ]  event_broker_option bits 2 and 3 enabled (12)
[OK  ]  broker_module is defined
[OK  ]  broker_module=/usr/local/pnp4nagios/lib/npcdmod.o config_file=/usr/local/pnp4nagios/etc/npcd.cfg
[OK  ]  npcdmod.o config file is /usr/local/pnp4nagios/etc/npcd.cfg
[OK  ]  /usr/local/pnp4nagios/etc/npcd.cfg used by npcdmod.o is readable
[OK  ]  npcd daemon is running
[OK  ]  /usr/local/pnp4nagios/etc/npcd.cfg is used by npcd and readable
[OK  ]  npcd and npcdmod.o are using the same config file (/usr/local/pnp4nagios/etc/npcd.cfg)
[INFO]  Nagios config looks good so far
[INFO]  ========== Checking config values ============
[INFO]  Reading /usr/local/pnp4nagios/etc/npcd.cfg
[OK  ]  Script /usr/local/pnp4nagios/libexec/process_perfdata.pl is executable
[INFO]  ========== Starting global checks ============
[OK  ]  status_file is defined
[OK  ]  status_file=/dev/shm/status.dat
[INFO]  Reading /dev/shm/status.dat
[INFO]  ==== Starting rrdtool checks ====
[OK  ]  RRDTOOL is defined
[OK  ]  RRDTOOL=/usr/bin/rrdtool
[OK  ]  /usr/bin/rrdtool is executable
[OK  ]  RRDtool 1.3.1  Copyright 1997-2008 by Tobias Oetiker &lt;tobi@oetiker.ch&gt;
[OK  ]  USE_RRDs is defined
[OK  ]  USE_RRDs=1
[OK  ]  Perl RRDs modules are loadable
[INFO]  ==== Starting directory checks ====
[OK  ]  RRDPATH is defined
[OK  ]  RRDPATH=/usr/local/pnp4nagios/var/perfdata
[OK  ]  Perfdata directory &#039;/usr/local/pnp4nagios/var/perfdata&#039; exists
[WARN]  62 hosts/services are not providing performance data
[WARN]  &#039;process_perf_data 1&#039; is set for 43 hosts/services which are not providing performance data!
[WARN]  &#039;process_perf_data 0&#039; is set for 27 of your hosts/services
[OK  ]  &#039;process_perf_data 1&#039; is set for 243 of your hosts/services
[INFO]  ==== System sizing ====
[OK  ]  269 hosts/service objects defined
[INFO]  ==== Check statistics ====
[WARN]  Warning: 3, Critical: 0
[WARN]  Checks finished...
</pre>
</div>
<!-- SECTION "Test" [678-4764] -->
<h2><a name="performance_data" id="performance_data">Performance data</a></h2>
<div class="level2">
<p>
Beginnend mit <code>0.6.19-R.37</code> (2013-02-17) akzeptiert das Skript die Option<code>--object</code> (oder <code>-o</code>) gefolgt von einer Zeichenkette, die einen Host und/oder einen Service angibt. F&uuml;r diese/s Objekt(e) werden die Performance-Daten angegeben (falls vorhanden). Die Daten werden von eckigen Klammern begrenzt, gefolgt vom Wert der Direktive <code>process_performance_data</code> (<code>ppd</code>=n).
</p>
<p>
<code>host</code> = Performance-Informationen f&uuml;r den Host <code>host</code> zeigen<br/>
<code>;service</code> = Performance-Informationen f&uuml;r Service <code>service</code> zeigen<br/>
<code>host;service</code> = Performance-Informationen f&uuml;r Service <code>service</code> auf Host <code>host</code> zeigen
</p>
<p>
Die Zeichenketten werden als regul&auml;re Ausdr&uuml;cke angesehen (<acronym title="Practical Extraction and Report Language">Perl</acronym>-Syntax).
</p>
</div>
<!-- SECTION "Performance data" [4765-] -->

View File

@@ -0,0 +1,149 @@
<h1><a name="das_nagios_web_frontend" id="das_nagios_web_frontend">Das Nagios Web Frontend</a></h1>
<div class="level1">
<p>
PNP soll nat&uuml;rlich schnell erreichbar sein. Man m&ouml;chte nicht lange nach den richtigen Graphen suchen.
</p>
<p>
Nagios selbst bietet die M&ouml;glichkeit, externe URLs &uuml;ber die sogenannte Extended Info Config einzubinden.
Da es in diesem Bereich eine &Auml;nderung zwischen Nagios 2.x und der Version 3.0 gibt, wird anschließend auf beide Versionen getrennt eingegangen.
</p>
</div>
<!-- SECTION "Das Nagios Web Frontend" [1-398] -->
<h2><a name="nagios_2x" id="nagios_2x">Nagios 2.x</a></h2>
<div class="level2">
<p>
Bis Nagios 2.x erfolgt die Einbindung externer URLs in das Nagios-Web-Interface &uuml;ber die <a href="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#serviceextinfo" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#serviceextinfo" rel="nofollow">Extended-Info-Objekte</a>. F&uuml;r PNP verwenden wir die Option action_url, um das PNP-Web-Frontend mit den passenden Optionen aufzurufen.
</p>
<pre class="code">
define serviceextinfo {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
register 0
}
</pre>
<p>
Dieses Template kann nun &uuml;ber “use srv-pnp” in der serviceextinfo-Definition verwendet werden. Wenn Sie die Schnellstart-Installationsanleitungen benutzt haben, k&ouml;nnen Sie beispielsweise in der Datei localhost.cfg die Definitionen wie folgt erweitern:
</p>
<pre class="code">
define serviceextinfo {
use srv-pnp ; Name of service templates to use
host_name localhost
service_description load
}
</pre>
</div>
<!-- SECTION "Nagios 2.x" [399-1348] -->
<h2><a name="nagios_3x" id="nagios_3x">Nagios 3.x</a></h2>
<div class="level2">
<p>
Seit Nagios 3.0 ist die Direktive action_url in die <a href="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#host" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#host" rel="nofollow">Host</a>- bzw. <a href="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#service" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#service" rel="nofollow">Service</a>-Definition verschoben worden. Die <a href="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#serviceextinfo" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#serviceextinfo" rel="nofollow">serviceextinfo</a>- und <a href="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#hostextinfo" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/objectdefinitions#hostextinfo" rel="nofollow">hostextinfo</a>-Definitionen sind entfallen. Damit wird die Definition der URLs zum PNP-Interface wesentlich vereinfacht.
</p>
<p>
Zuerst definieren wir zwei Nagios-Templates. Falls Sie die <a href="http://www.nagios-wiki.de/nagios/doku3/quickstart" class="urlextern" title="http://www.nagios-wiki.de/nagios/doku3/quickstart" rel="nofollow">Schnellstart-Installationsanleitungen</a> f&uuml;r Nagios benutzt haben, k&ouml;nnen Sie die folgenden Zeilen der Datei templates.cfg hinzuf&uuml;gen:
</p>
<pre class="code">
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
register 0
}
</pre>
<p>
Diese beiden Templates k&ouml;nnen nun &uuml;ber “use srv-pnp” in der Service-Definition oder “use host-pnp” in der Host-Definition verwendet werden. Wenn Sie die Schnellstart-Installationsanleitungen benutzt haben, k&ouml;nnen Sie beispielsweise in der Datei localhost.cfg die Definitionen wie folgt erweitern:
</p>
<pre class="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>
<pre class="code">define service{
use local-service,srv-pnp ; Name of service templates to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
</pre>
<p>
Die Links auf die richtigen URLs werden automagisch erstellt.
</p>
</div>
<!-- SECTION "Nagios 3.x" [1349-3559] -->
<h2><a name="preview_popup" id="preview_popup">Preview Popup</a></h2>
<div class="level2">
<p>
Außerdem gibt es die M&ouml;glichkeit, die Graphen bereits in der Status&uuml;bersicht beim &Uuml;berfahren des “Action Url Icons” mit der Maus einzublenden.
</p>
<p>
Erm&ouml;glicht wird dies durch die <a href="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>, die es uns erlauben, Javascript-Code an geeigneter Stelle im Seitenkopf der Status&uuml;bersicht einzubinden ( status.cgi ).
</p>
<p>
In den PNP-Quellen ist die Datei <code>contrib/ssi/status-header.ssi</code> bereits enthalten, die verwendeten URLs m&uuml;ssen aber unter Umst&auml;nden angepasst werden. Wir gehen hier davon aus, dass PNP &uuml;ber <code>/pnpnagios/index.php</code> erreichbar ist.
</p>
<p>
Die besagte Datei muss in das Verzeichnis <code>/usr/local/nagios/share/ssi/</code> kopiert werden und darf <strong>NICHT</strong> ausf&uuml;hrbar sein. Nagios w&uuml;rde die Datei sonst wirklich wie ein <acronym title="Common Gateway Interface">CGI</acronym> behandeln und ausf&uuml;hren, was aber in diesem Fall zu Fehlern f&uuml;hren w&uuml;rde. Die Apache-Admins m&ouml;gen bitte “Nagios <acronym title="Server Side Includes">SSI</acronym>” nicht mit “Apache <acronym title="Server Side Includes">SSI</acronym>” in Verbindung bringen. Beides hat nichts miteinander zu tun.
</p>
<p>
Die action_url ist entsprechend anzupassen:
</p>
<pre class="code">
define host {
name host-pnp
register 0
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=_HOST_&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/index.php/popup?host=$HOSTNAME$&amp;srv=_HOST_
}
define service {
name srv-pnp
register 0
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/index.php/popup?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
}
</pre>
<p>
Nach einem Restart von Nagios (nach Anpassung der Definitionen) sieht das Ergebnis ungef&auml;hr so aus:<br/>
<a href="/_detail/popup.png?id=de%3Apnp-0.6%3Awebfe" class="media" title="popup.png"><img src="/_media/popup.png?w=200" class="media" alt="" width="200" /></a>
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">Zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/webfe_cfg" class="wikilink1" title="de:pnp-0.6:webfe_cfg">Konfiguration Web-Frontend</a>
</p>
</div>
<!-- SECTION "Preview Popup" [3560-] -->

View File

@@ -0,0 +1,142 @@
<h1><a name="pnp_web_frontend" id="pnp_web_frontend">PNP Web Frontend</a></h1>
<div class="level1">
<p>
Das Verhalten des PNP-Web-Frontend l&auml;sst sich &uuml;ber die Config-Datei <code>etc/config.php</code> beeinflussen.
Diese Datei wird bei Updates von PNP immer wieder &uuml;berschrieben, da die meisten Pfade und Optionen bereits durch <code>./configure</code> ermittelt werden.
</p>
<p>
Eigene Anpassungen sollten daher in der Datei etc/config_local.php erfolgen. Sollte die Datei noch nicht existieren, kann die config.php als Vorlage verwendet werden.
</p>
</div>
<!-- SECTION "PNP Web Frontend" [1-452] -->
<h2><a name="etcpnpconfigphp" id="etcpnpconfigphp">etc/pnp/config.php</a></h2>
<div class="level2">
<p>
Im folgenden die wichtigsten Parameter:
</p>
<p>
Der Pfad zum RRDtool-Binary. Wird von <code>./configure</code> ermittelt.
</p>
<pre class="code"> $conf[&#039;rrdtool&#039;] = &quot;/usr/bin/rrdtool&quot;;</pre>
<hr />
<p>
H&ouml;he und Breite der RRD-Graphen
</p>
<pre class="code"> $conf[&#039;graph_width&#039;] = &quot;500&quot;;
$conf[&#039;graph_height&#039;] = &quot;100&quot;;</pre>
<hr />
<p>
Bildschirmdimensionen &auml;ndern sich, Blattgr&ouml;ßen nicht. Um unterschiedliche Einstellungen zu erm&ouml;glichen, k&ouml;nnen f&uuml;r die Generierung von <acronym title="Portable Document Format">PDF</acronym>-Dateien eigene Werte definiert werden. Wenn diese Variablen nicht definiert sind, werden die Werte der Graphen benutzt.
H&ouml;he und Breite der RRD-Graphen bei PDFs
</p>
<pre class="code"> $conf[&#039;pdf_width&#039;] = &quot;675&quot;;
$conf[&#039;pdf_height&#039;] = &quot;100&quot;;</pre>
<hr />
<p>
Zus&auml;tzliche Optionen, die bei jedem Aufruf von RRDTool mit &uuml;bergeben werden. Beispielsweise <code>--slope-mode</code>, um die Graphen etwas zu gl&auml;tten.
</p>
<pre class="code"> $conf[&#039;graph_opt&#039;] = &quot;&quot;;</pre>
<hr />
<p>
Der Pfad zu den von <code>process_perfdata.pl</code> erstellten RRD- und <acronym title="Extensible Markup Language">XML</acronym>-Dateien
</p>
<pre class="code"> $conf[&#039;rrdbase&#039;] = &quot;/usr/local/pnp4nagios/var/perfdata/&quot;;</pre>
<hr />
<p>
Pfad zu den Config-Files f&uuml;r die <a href="/de/pnp-0.6/pages" class="wikilink1" title="de:pnp-0.6:pages">Pages</a>.
</p>
<pre class="code"> $conf[&#039;page_dir&#039;] = &quot;/usr/local/pnp4nagios/etc/pages/&quot;;</pre>
<hr />
<p>
Wert in Sekunden, nachdem die PNP-Seiten neu geladen werden sollen.
</p>
<pre class="code"> $conf[&#039;refresh&#039;] = &quot;90&quot;;</pre>
<hr />
<p>
Maximales Alter der RRD-Files in Sekunden. Nach Erreichen dieses Wertes werden Links zu den Graphen als “inactive” gekennzeichnet.
</p>
<pre class="code"> $conf[&#039;max_age&#039;] = 60*60*6;</pre>
<hr />
<p>
Basis-<acronym title="Uniform Resource Locator">URL</acronym> zu den Nagios CGIs.
</p>
<pre class="code"> $conf[&#039;nagios_base&#039;] = &quot;/nagios/cgi-bin&quot;;</pre>
<hr />
<p>
Liste von Usern, f&uuml;r die Links zu den Services des aktuellen Hosts angezeigt werden sollen.
</p>
<pre class="code"> $conf[&#039;allowed_for_service_links&#039;] = &quot;EVERYONE&quot;;</pre>
<hr />
<p>
Liste von Usern, f&uuml;r die das Host-Suchfeld angezeigt werden soll.
</p>
<pre class="code"> $conf[&#039;allowed_for_host_search&#039;] = &quot;EVERYONE&quot;;</pre>
<hr />
<p>
Wird PNP nur mit der Angabe eines Hosts ( index.php?host=&lt;myserver&gt; ) aufgerufen, so wird eine &Uuml;bersicht aller Services angezeigt, wenn der User in dieser Liste enthalten ist.
</p>
<pre class="code"> $conf[&#039;allowed_for_host_overview&#039;] = &quot;EVERYONE&quot;;</pre>
<hr />
<p>
Das Array $views[] legt fest, welche Zeitspannen die RRD-Graphen dargestellen sollen. Der Titel und die Anzahl der Graphen kann somit hier zentral definiert werden.
</p>
<pre class="code">
$views[] = array(&#039;title&#039; =&gt; &#039;One Hour&#039;, &#039;start&#039; =&gt; (60*60) );
$views[] = array(&#039;title&#039; =&gt; &#039;4 Hours&#039;, &#039;start&#039; =&gt; (60*60*4) );
$views[] = array(&#039;title&#039; =&gt; &#039;25 Hours&#039;, &#039;start&#039; =&gt; (60*60*25) );
$views[] = array(&#039;title&#039; =&gt; &#039;One Week&#039;, &#039;start&#039; =&gt; (60*60*25*7) );
$views[] = array(&#039;title&#039; =&gt; &#039;One Month&#039;, &#039;start&#039; =&gt; (60*60*24*32) );
$views[] = array(&#039;title&#039; =&gt; &#039;One Year&#039;, &#039;start&#039; =&gt; (60*60*24*380) );
</pre>
<p>
Sie k&ouml;nnen hier auch weitere Views definieren, sollten aber dabei ber&uuml;cksichtigen, dass im Normalfall ALLE definierten Views angezeigt werden.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/timeranges" class="wikilink1" title="de:pnp-0.6:timeranges">Timeranges</a>
</p>
</div>
<!-- SECTION "etc/pnp/config.php" [453-] -->

View File

@@ -0,0 +1,30 @@
<p>
check_procs ist ein Beispiel f&uuml;r ein Plugin, das keine Performance-Daten ausgibt:
</p>
<pre class="code">./check_procs -a ndo2db -w 1: -c 0:
PROCS OK: 2 processes with args &#039;ndo2db&#039;</pre>
<p>
Mit dem folgenden Wrapper-Script kann das ge&auml;ndert werden
</p>
<p>
<strong>check_procs.sh</strong>
</p>
<pre class="code">#!/bin/bash
LINE=`/usr/local/nagios/libexec/check_procs $*`
RC=$?
COUNT=`echo $LINE | awk &#039;{print $3}&#039;`
PROCS=`expr $COUNT - 1`
LINE=`echo $LINE | sed &quot;s/: $COUNT /: $PROCS /&quot;`
echo $LINE \| procs=$PROCS
exit $RC</pre>
<p>
Nun wird die Zahl zusammen mit einer Bezeichnung ausgegeben.
</p>
<pre class="code">./check_procs.sh -a ndo2db -w 1: -c 0:
PROCS OK: 2 processes with args &#039;ndo2db&#039;| procs=2</pre>

View File

@@ -0,0 +1,43 @@
<h1><a name="datenexport" id="datenexport">Datenexport</a></h1>
<div class="level1">
<p>
PNP bietet &uuml;ber den <code>xport</code> Controller Zugriff auf die RRD-Daten. Dabei kann das Ausgabeformat gew&auml;hlt werden. Zur Zeit sind die Formate <code>xml</code>, <code>json</code> und <code>csv</code> realisiert.
</p>
<p>
Aufgerufen wird der Controller &uuml;ber die <acronym title="Uniform Resource Locator">URL</acronym>
</p>
<pre class="code">/pnp4nagios/xport/&lt;format&gt;?host=&lt;hostname&gt;&amp;srv=&lt;servicedesc&gt;</pre>
<p>
wobei &lt;format&gt; durch das jeweils gew&uuml;nschte Format zu ersetzen ist.
</p>
<p>
Sie k&ouml;nnen außerdem <code>wget</code> benutzen, um Bilder zu erzeugen und diese in regelm&auml;ßigen Reports einzuf&uuml;gen. Ein Beispiel:
</p>
<pre class="code">wget -O image.png &#039;http://&lt;user&gt;:&lt;pass&gt;@&lt;nagios-server&gt;/pnp4nagios/image?host=&lt;hostname&gt;&amp;srv=&lt;service&gt;&amp;view=2&amp;source=0&#039;</pre>
<p>
<code>view=&lt;n&gt;</code> begrenzt den Graphen auf die Zeitperiode, die in <code>config.php</code> definiert ist<br/>
<code>source=&lt;n&gt;</code> zeigt nur eine Data-Source, wenn mehrere in der RRD-Datei vorhanden sind
</p>
<p>
Anstatt <code>view</code> k&ouml;nnen Sie auch <code>start</code> und/oder <code>end</code> benutzen, um die Zeitspanne anzugeben. Details finden Sie in den <a href="/de/pnp-0.6/timeranges" class="wikilink1" title="de:pnp-0.6:timeranges">&quot;time ranges&quot;</a>.
</p>
<p>
<a href="/de/pnp-0.6/start" class="wikilink1" title="de:pnp-0.6:start">zur&uuml;ck zur &Uuml;bersicht</a> | <a href="/de/pnp-0.6/tpl" class="wikilink1" title="de:pnp-0.6:tpl">Templates</a>
</p>
</div>

View File

@@ -0,0 +1,186 @@
<h1><a name="about_pnp" id="about_pnp">About PNP</a></h1>
<div class="level1">
</div>
<!-- SECTION "About PNP" [1-26] -->
<h2><a name="system_requirements" id="system_requirements">System requirements</a></h2>
<div class="level2">
<p>
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>
<pre class="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>
<pre class="code"> OK - 127.0.0.1: rta 2.687ms, lost 0%</pre>
<p>
and the performance data
</p>
<pre class="code"> rta=2.687ms;3000.000;5000.000;0; pl=0%;80;100;;</pre>
<p>
Performance data is designed for automatic processing. The format is specified within the <a href="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" class="urlextern" title="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" rel="nofollow">Developer Guidelines</a> (you&#039;ll find an excerpt <a href="/pnp-0.6/perfdata_format" class="wikilink1" title="pnp-0.6:perfdata_format">here</a>) but should be exemplified here nonetheless:
</p>
<pre class="code"> rta=2.687ms;3000.000;5000.000;0;
| | | | | | |
|----|--|----|---------|-----|-|----- * label
|--|----|---------|-----|-|----- * current value
|----|---------|-----|-|----- 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.
</p>
</div>
<!-- SECTION "System requirements" [27-1698] -->
<h2><a name="required_software" id="required_software">Required Software</a></h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> <acronym title="Practical Extraction and Report Language">Perl</acronym> &gt;= 5.x without additional modules</div>
</li>
<li class="level1"><div class="li"> RRDtool &gt;= 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>
<li class="level1"><div class="li"> <acronym title="Hypertext Preprocessor">PHP</acronym> &gt;= 5.1.6 for the Webfrontend based on <a href="http://www.kohanaphp.com" class="urlextern" title="http://www.kohanaphp.com" rel="nofollow">Kohana</a></div>
</li>
<li class="level1"><div class="li"> Nagios &gt;= 2.x or Icinga </div>
</li>
<li class="level1"><div class="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>
<!-- SECTION "Required Software" [1699-2245] -->
<h2><a name="license" id="license">License</a></h2>
<div class="level2">
<p>
PNP is licensed under <a href="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>
</p>
</div>
<!-- SECTION "License" [2246-2340] -->
<h2><a name="download" id="download">Download</a></h2>
<div class="level2">
<p>
Development of PNP is organized using <a href="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: <a href="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 <a href="https://github.com/lingej/pnp4nagios" class="urlextern" title="https://github.com/lingej/pnp4nagios" rel="nofollow">https://github.com/lingej/pnp4nagios</a>. Clicking on <a href="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>
<!-- SECTION "Download" [2341-2996] -->
<h2><a name="support" id="support">Support</a></h2>
<div class="level2">
<p>
PRIOR to support questions please make sure that you have verified certain things described under <a href="/pnp-0.6/verify" class="wikilink1" title="pnp-0.6:verify">verify your installation</a>.<br/>
<br/>
</p>
<p>
The developers and helpers are present on a separate board at <a href="http://www.nagios-portal.org" class="urlextern" title="http://www.nagios-portal.org" rel="nofollow">http://www.nagios-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>
<a href="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>
<a href="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>
<a href="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>
<!-- SECTION "Support" [2997-4303] -->
<h2><a name="storage" id="storage">Storage</a></h2>
<div class="level2">
<p>
Performance data will be stored in Round Robin Databases using <a href="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>
<!-- SECTION "Storage" [4304-5060] -->
<h2><a name="statistics_and_links_to_sourceforge" id="statistics_and_links_to_sourceforge">Statistics and links to Sourceforge</a></h2>
<div class="level2">
<ul class="rss"><li><div class="li"><em>An error occurred while fetching this feed: </em><a href="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>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/modes" class="wikilink1" title="pnp-0.6:modes">PNP modes</a>
</p>
</div>
<!-- SECTION "Statistics and links to Sourceforge" [5061-] -->

View File

@@ -0,0 +1,73 @@
<h2><a name="distributed_systems" id="distributed_systems">Distributed Systems</a></h2>
<div class="level2">
<p>
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.
</p>
<pre class="code">OK - 127.0.0.1: rta 2.687ms, lost 0% | rta=2.687ms;3000.000;5000.000;0; pl=0%;80;100;; [check_icmp]</pre>
<p>
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
<a href="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.
</p>
<pre class="code">
define command{
command_name submit_check_result
command_line /usr/local/nagios/libexec/eventhandlers/submit_check_result $HOSTNAME$ &#039;$SERVICEDESC$&#039; $SERVICESTATE$ &#039;$SERVICEOUTPUT$&#039;
}
</pre>
<p>
should be changed to
</p>
<pre class="code">
define command{
command_name submit_check_result
command_line /usr/local/nagios/libexec/eventhandlers/submit_check_result $HOSTNAME$ &#039;$SERVICEDESC$&#039; $SERVICESTATE$ &#039;$SERVICEOUTPUT$ | $SERVICEPERFDATA$ [$SERVICECHECKCOMMAND$]&#039;
}
</pre>
</div>
<!-- SECTION "Distributed Systems" [1-1589] -->
<h2><a name="check_multi_plugin" id="check_multi_plugin">check_multi plugin</a></h2>
<div class="level2">
<p>
The plugin <a href="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.
</p>
<p>
<a href="/lib/exe/fetch.php?hash=a9e001&amp;media=http%3A%2F%2Fmy-plugin.de%2Fwiki%2F_media%2Fcheck_multi%2Fperformance%2Fmulti_labels.png" class="media" title="http://my-plugin.de/wiki/_media/check_multi/performance/multi_labels.png"><img src="/lib/exe/fetch.php?hash=a9e001&amp;w=300&amp;media=http%3A%2F%2Fmy-plugin.de%2Fwiki%2F_media%2Fcheck_multi%2Fperformance%2Fmulti_labels.png" class="media" alt="" width="300" /></a>
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/rrdcached" class="wikilink1" title="pnp-0.6:rrdcached">support of rrdcached</a>
</p>
</div>
<!-- SECTION "check_multi plugin" [1590-] -->

View File

@@ -0,0 +1,395 @@
<h1><a name="configuration" id="configuration">Configuration</a></h1>
<div class="level1">
<p>
The configuration of the already mentioned <a href="/pnp-0.6/modes" class="wikilink1" title="pnp-0.6:modes">modes of performance data processing</a> will be described in more detail.
</p>
</div>
<!-- SECTION "Configuration" [1-154] -->
<h2><a name="synchronous_mode" id="synchronous_mode">Synchronous Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/synchronous.png?id=pnp-0.6%3Aconfig" class="media" title="synchronous.png"><img src="/_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”.
</p>
<pre class="code"> process_performance_data=1</pre>
<p>
Data processing has to be disabled in the definition of every host or service whose performance data should NOT be processed.
</p>
<pre class="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>
</p>
<pre class="code">enable_environment_macros=1</pre>
<p>
Additionally the command to process performance data is to be specified in <code>nagios.cfg</code>
</p>
<pre class="code"> service_perfdata_command=process-service-perfdata</pre>
<p>
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.
</p>
<pre class="code"> host_perfdata_command=process-host-perfdata</pre>
<p>
Nagios has to be notified about the referenced commands as well. If you used the <a href="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&#039;t require any arguments apart from specifing the option -d ( DATATYPE ) if you want to process performance data resulting from host checks.
</p>
<pre class="code">
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
</pre>
<p>
<strong>Note</strong> <code>process_perfdata.pl</code> cannot be started under control of ePN ( embedded <acronym title="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>.
</p>
</div>
<!-- SECTION "Synchronous Mode" [155-2611] -->
<h2><a name="bulk_mode" id="bulk_mode">Bulk Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk.png?id=pnp-0.6%3Aconfig" class="media" title="bulk.png"><img src="/_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>
</p>
<pre class="code"> process_performance_data=1</pre>
<p>
Additionally some new directives are required
</p>
<pre class="code">
#
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios 3.0
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
</pre>
<p>
<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>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file</strong></code> path to the temporary file which should contain the performance data.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_template</strong></code> format of the temporary file. Data will be defined using Nagios macros.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_mode</strong></code> option “a” specifies that data is to be appended to the file.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_processing_interval</strong></code> the interval is 15 seconds</div>
</li>
<li class="level1"><div class="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 <a href="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.
</p>
<pre class="code">
define command{
command_name process-service-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata
}
define command{
command_name process-host-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host-perfdata
}
</pre>
<div class="box" style="width: 90%; ">
<b class='xtop'><b class='xb1'></b><b class='xb2'></b><b class='xb3'></b><b class='xb4'></b></b>
<div class='xbox'>
<p class='box_title'><strong>NOTE:</strong></p>
<div class='box_content'>
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>
</div>
<b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b>
</div>
</div>
<!-- SECTION "Bulk Mode" [2612-5775] -->
<h2><a name="bulk_mode_with_npcd" id="bulk_mode_with_npcd">Bulk Mode with NPCD</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk-npcd.png?id=pnp-0.6%3Aconfig" class="media" title="bulk-npcd.png"><img src="/_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>
</p>
<pre class="code"> process_performance_data=1</pre>
<p>
Additionally some new directives are required
</p>
<pre class="code">
#
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios 3.0
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
</pre>
<p>
<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>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file</strong></code> path to the temporary file which should contain the performance data.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_template</strong></code> format of the temporary file. Data will be defined using Nagios macros.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_mode</strong></code> option “a” specifies that data is to be appended to the file.</div>
</li>
<li class="level1"><div class="li"> <code><strong>service_perfdata_file_processing_interval</strong></code> the interval is 15 seconds</div>
</li>
<li class="level1"><div class="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 <a href="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.
</p>
<pre class="code">
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
</pre>
<p>
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 only thing that remains is to start NPCD.
</p>
<pre class="code"> /usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg</pre>
<p>
The option <code>-d</code> starts NPCD as a daemon in the background.
</p>
</div>
<!-- SECTION "Bulk Mode with NPCD" [5776-9339] -->
<h2><a name="bulk_mode_with_npcd_and_npcdmod" id="bulk_mode_with_npcd_and_npcdmod">Bulk Mode with NPCD and npcdmod</a></h2>
<div class="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>
<a href="/_detail/bulk-npcdmod.png?id=pnp-0.6%3Aconfig" class="media" title="bulk-npcdmod.png"><img src="/_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>
<li class="level1"><div class="li"> The perfdata routines can now be used for other addons.</div>
</li>
<li class="level1"><div class="li"> The configuration is easier.</div>
</li>
<li class="level1"><div class="li"> It is the preferred mode of the PNP developers.</div>
</li>
</ul>
<p>
Adjustments in nagios.cfg:
</p>
<pre class="code">
process_performance_data=1
broker_module=/usr/local/pnp4nagios/lib/npcdmod.o config_file=/usr/local/pnp4nagios/etc/npcd.cfg
</pre>
<p>
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>
<pre class="code">
[1277545053] npcdmod: Copyright (c) 2008-2009 Hendrik Baecker (andurin@process-zero.de) - http://www.pnp4nagios.org
[1277545053] npcdmod: /usr/local/pnp4nagios/etc/npcd.cfg initialized
[1277545053] npcdmod: spool_dir = &#039;/usr/local/pnp4nagios/var/spool/&#039;.
[1277545053] npcdmod: perfdata file &#039;/usr/local/pnp4nagios/var/perfdata.dump&#039;.
[1277545053] npcdmod: Ready to run to have some fun!
[1277545053] Event broker module &#039;/usr/local/pnp4nagios/lib/npcdmod.o&#039; initialized successfully.
</pre>
</div>
<!-- SECTION "Bulk Mode with NPCD and npcdmod" [9340-11205] -->
<h2><a name="gearman_mode" id="gearman_mode">Gearman Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/gearman.png?id=pnp-0.6%3Aconfig" class="media" title="gearman.png"><img src="/_media/gearman.png?w=150" class="mediaright" align="right" alt="" width="150" /></a>
</p>
<p>
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 <a href="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&#039;ll find a section on gearman in <code>etc/process_perfdata.cfg</code>:
</p>
<pre class="code">PREFORK = 1
GEARMAN_HOST = localhost:4730
REQUESTS_PER_CHILD = 10000
ENCRYPTION = 1
KEY = should_be_changed
#KEY_FILE = /usr/local/pnp4nagios/etc/secret.key</pre>
<p>
Using <code>PREFORK = &lt;n&gt;</code> you specify the number of child processes.
</p>
<p>
<code>GEARMAN_HOST = &lt;host&gt;:&lt;port&gt;</code> specifies host and port of the server running the gearman daemon providing the data.
</p>
<p>
<code>REQUEST_PER_CHILD = &lt;n&gt;</code> enables you to define the number of requests processed per process.
</p>
<p>
<code>ENCRYPTION = &lt;n&gt;</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 = &lt;key phrase&gt;</code> or &#039;KEYFILE =&lt;key file&gt;<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&#039;&#039;.
</p>
<p>
After starting the daemon process using
</p>
<pre class="code"> /etc/init.d/pnp_gearmon_worker start</pre>
<p>
the performance data will be processed which is provided by the gearmand daemon on the Nagios server.
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/verify" class="wikilink1" title="pnp-0.6:verify">checking the functionality</a>
</p>
</div>
<!-- SECTION "Gearman Mode" [11206-] -->

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,478 @@
<h2><a name="pnp_06x_downloads" id="pnp_06x_downloads">PNP 0.6.x Downloads</a></h2>
<div class="level2">
</div>
<!-- SECTION "PNP 0.6.x Downloads" [1-37] -->
<h3><a name="current_stable_pnp_version" id="current_stable_pnp_version">Current stable PNP Version</a></h3>
<div class="level3">
<p>
Changes can be tracked on <a href="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>
</p>
<p>
The current Version is <a href="https://sourceforge.net/projects/pnp4nagios/files/latest" class="urlextern" title="https://sourceforge.net/projects/pnp4nagios/files/latest" rel="nofollow"> pnp4nagios-0.6.22.tar.gz</a>
</p>
</div>
<!-- SECTION "Current stable PNP Version" [38-326] -->
<h3><a name="latest_devel_version" id="latest_devel_version">Latest Devel Version</a></h3>
<div class="level3">
<p>
<a href="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>
</p>
<p>
This is allways the latest GIT HEAD Version
</p>
<hr />
<p>
Last Update: Wed Jul 30 12:30:45 CEST 2014
</p>
</div>
<!-- SECTION "Latest Devel Version" [327-550] -->
<h2><a name="changelog" id="changelog">ChangeLog</a></h2>
<div class="level2">
<p>
<strong>pnp-0.6.?? ??/??/2013</strong>
</p>
<p>
<strong>pnp-0.6.24 07/30/2013</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: Fixed some more XSS issues</div>
</li>
<li class="level1"><div class="li"> Bugfix: Fixed <acronym title="Hypertext Preprocessor">PHP</acronym> issue while running on <acronym title="Hypertext Preprocessor">PHP</acronym> 5.6 ( Reported by Sven Nierlein )</div>
</li>
</ul>
<p>
<strong>pnp-0.6.22 06/04/2014</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: Fixed livestatus socket parsing ( Pekka Panula )</div>
</li>
<li class="level1"><div class="li"> Bugfix: Update check_mssql_health.php ( Miriam Zenk )</div>
</li>
<li class="level1"><div class="li"> Feature: Add “version=tiny” to got get a stripped down version of graph ( Ricardo Bartels )</div>
</li>
<li class="level1"><div class="li"> feature: Add STDIN Mode to process_perfdata.pl ( Robert Steininger )</div>
</li>
<li class="level1"><div class="li"> Bugfix: XSS issue fixed by Mikael Falkvidd. This issue was detected by Peter &Ouml;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>
<li class="level1"><div class="li"> Feature: Helper functions rrd::alerter and rrd:alerter_gr both supports treshold detection (Martin Schirrmacher)</div>
</li>
<li class="level1"><div class="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>
<li class="level1"><div class="li"> Feature: Support check_mk Multisite Cookie Auth ( Lars Michelsen )</div>
</li>
<li class="level1"><div class="li"> Feature: Allow RRD unknown values ( Simon Meggle )</div>
</li>
<li class="level1"><div class="li"> feature: Interactive delete mode added to check_rrds.pl ( Simon Meggle ) </div>
</li>
<li class="level1"><div class="li"> Bugfix: Allow multiple gearman servers ( Craig Barraclough )</div>
</li>
<li class="level1"><div class="li"> Bugfix: Fixed Graph Search ( Stefan Triep )</div>
</li>
<li class="level1"><div class="li"> Update: jQuery update to 1.8.1 </div>
</li>
<li class="level1"><div class="li"> Update: jQueryUI update to 1.8.23</div>
</li>
</ul>
<p>
<strong>pnp-0.6.19 09/01/2012</strong>
</p>
<ul>
<li class="level1"><div class="li"> Feature: Parameter “width” added to popup controller ( Andreas Doehler ) </div>
</li>
<li class="level1"><div class="li"> Fix: simplify/improve apache rules ( Christoph Anton Mitterer )</div>
</li>
<li class="level1"><div class="li"> Fix: Check for missing <acronym title="Hypertext Preprocessor">PHP</acronym> GD functions </div>
</li>
<li class="level1"><div class="li"> Bugfix: socketDOMAIN changed to AF_INET while using livstatus tcp socket ( Rene Koch )</div>
</li>
</ul>
<p>
<strong>pnp-0.6.18 06/28/2012</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: Fixed STORAGE_TYPE and CUSTOM_TEMPLATE vars used in custom templates</div>
</li>
<li class="level1"><div class="li"> Bugfix: Blank screen on <acronym title="Hypertext Preprocessor">PHP</acronym> 5.4 fixed</div>
</li>
<li class="level1"><div class="li"> Feature: Allow multiple gearman job servers</div>
</li>
<li class="level1"><div class="li"> Feature: New helper function rrd::debug()</div>
</li>
<li class="level1"><div class="li"> Feature: New templates check_jmx4perl_*.php</div>
</li>
</ul>
<p>
<strong>pnp-0.6.17 03/25/2012</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: Fixed rrd_convert.pl while running with --dry-run</div>
</li>
<li class="level1"><div class="li"> Bugfix: logging.c include missing header files ( Lars Vogdt ) </div>
</li>
<li class="level1"><div class="li"> Bugfix: Check if pnp4nagios/etc/rra.cfg is readable</div>
</li>
<li class="level1"><div class="li"> Bugfix: rrd_convert.pl use <acronym title="Extensible Markup Language">XML</acronym> tag TEMPLATE instead of CHECKCOMMAND to selects RRDs ( Sven Velt )</div>
</li>
<li class="level1"><div class="li"> Feature: npcdmod.o increase perfdata buffer and log discarded perfdata ( Birger Schmidt )</div>
</li>
<li class="level1"><div class="li"> Feature: rrd_modify.pl to change number of data sources of an RRD file</div>
</li>
<li class="level1"><div class="li"> Feature: New template check_apachestatus_auto.php</div>
</li>
<li class="level1"><div class="li"> Feature: Implement etc/config.d to place config snippets ( Lars Michelsen )</div>
</li>
</ul>
<p>
<strong>pnp-0.6.16 11/21/2011</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: Fixed single quoted check_multi labels (Reported by Matthias Flacke)</div>
</li>
<li class="level1"><div class="li"> Bugfix: Append missing slash to perfdata_spool_dir ( Reported by Juergen-Michael Radtke ) </div>
</li>
<li class="level1"><div class="li"> Bugfix: Fixed jQuery-ui multisite theme</div>
</li>
<li class="level1"><div class="li"> Feature: <acronym title="Portable Document Format">PDF</acronym> margins are now adjustable via config.php ( Thomas Witzenrath )</div>
</li>
<li class="level1"><div class="li"> Feature: Support for <acronym title="Portable Document Format">PDF</acronym> size &#039;letter&#039; added ( Robert Becht )</div>
</li>
</ul>
<p>
<strong>pnp-0.6.15 09/15/2011</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: Fixed Overview link (reported by Stefan Triep)</div>
</li>
<li class="level1"><div class="li"> Bugfix: Fixed zoom popup (reported by Rudolf Labuschagne)</div>
</li>
<li class="level1"><div class="li"> Bugfix: Fixed double urlencode() (reported by Mathias Kettner)</div>
</li>
<li class="level1"><div class="li"> Feature: “Clear basket” button added (suggested by Stefan Triep) </div>
</li>
<li class="level1"><div class="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>
<li class="level1"><div class="li"> Feature: Webinterface for mobile devices based on jQuery Mobile <br/>
( <a href="http://jquerymobile.com/" class="urlextern" title="http://jquerymobile.com/" rel="nofollow">http://jquerymobile.com/</a> )</div>
</li>
<li class="level1"><div class="li"> Feature: Zoom based on jQuery plugin imgAreaSelect <br/>
( <a href="http://odyniec.net/projects/imgareaselect/" class="urlextern" title="http://odyniec.net/projects/imgareaselect/" rel="nofollow">http://odyniec.net/projects/imgareaselect/</a> )</div>
</li>
<li class="level1"><div class="li"> Feature: New template check_mssql_health.php</div>
</li>
<li class="level1"><div class="li"> Bugfix: Fixed popups to work under nginx ( Joram Agten )</div>
</li>
<li class="level1"><div class="li"> Bugfix: Helper rrd::vdef() fixed </div>
</li>
<li class="level1"><div class="li"> Update: jQuery update to 1.6.2</div>
</li>
<li class="level1"><div class="li"> Update: jQuery-ui update to 1.8.14</div>
</li>
</ul>
<p>
<strong>pnp-0.6.13 05/19/2011</strong>
</p>
<ul>
<li class="level1"><div class="li"> Feature: New option --ignore-hosts added to check_pnp_rrds.pl ( by Jochen Bern )</div>
</li>
<li class="level1"><div class="li"> Feature: New options zgraph_width and zgraph_height in config.php ( Mike Liebsch )</div>
</li>
<li class="level1"><div class="li"> Bugfix: rrd_convert.pl: parse_xml_filename() regex fix</div>
</li>
<li class="level1"><div class="li"> Info: Version used by OMD-0.48 <a href="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>
<li class="level1"><div class="li"> Feature: mod_gearman support added</div>
</li>
<li class="level1"><div class="li"> Feature: rrd_convert.pl is now able to convert all RRDs from RRD_STORAGE_TYPE=SINGLE to RRD_STORAGE_TYPE=MULTIPLE</div>
</li>
<li class="level1"><div class="li"> Feature: New template check_gearman.php</div>
</li>
<li class="level1"><div class="li"> Feature: Install process_perfdata.cfg and npcd.cfg by default</div>
</li>
<li class="level1"><div class="li"> Bugfix: rrd_convert.pl is now able to parse xml dumps created by rrdtool 1.4.x </div>
</li>
<li class="level1"><div class="li"> Bugfix: process_perfdata.pl default timeout value set to 15 seconds</div>
</li>
</ul>
<p>
<strong>pnp-0.6.11 01/15/2011</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: urldecoding fixed </div>
</li>
<li class="level1"><div class="li"> Bugfix: Zoom in/out is working again ( Reported by Thorben Soehl )</div>
</li>
<li class="level1"><div class="li"> Featue: npcd.cfg - New option perfdata_file_processing_interval used by npcdmod</div>
</li>
<li class="level1"><div class="li"> Info: Version used by OMD-0.46 <a href="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>
<li class="level1"><div class="li"> Feature: Add RRDTool Option --only-graph if graph height is below 32px to create thumbnails </div>
</li>
<li class="level1"><div class="li"> Feature: RRDTool Option --width and --height is now allowed in templates</div>
</li>
<li class="level1"><div class="li"> Feature: RRDTool DS Type for UOM of “c” changed from COUNTER to DERIVE </div>
</li>
<li class="level1"><div class="li"> Feature: Pass query string from special controller to image controller ( Matthew Garrett ) </div>
</li>
<li class="level1"><div class="li"> Feature: Authorisation against <a href="http://mathias-kettner.de/checkmk_livestatus.html" class="urlextern" title="http://mathias-kettner.de/checkmk_livestatus.html" rel="nofollow">mk_livestatus</a> <acronym title="Application Programming Interface">API</acronym> added</div>
</li>
<li class="level1"><div class="li"> Feature: Sample nginx webserver config added ( by evax@users.sourceforge.net )</div>
</li>
<li class="level1"><div class="li"> Feature: Kohana backport to support <acronym title="Hypertext Preprocessor">PHP</acronym> 5.1.6 ( Kudos to Andreas Ericsson )</div>
</li>
<li class="level1"><div class="li"> Bugfix: Sort list of special templates</div>
</li>
<li class="level1"><div class="li"> Bugfix: Urlencode hostname and service description ( Reported by Yannick ) </div>
</li>
<li class="level1"><div class="li"> Bugfix: corrected warning/critical thresholds in ticker/alerter functions</div>
</li>
</ul>
<p>
<strong>pnp-0.6.7 09/27/2010</strong>
</p>
<ul>
<li class="level1"><div class="li"> Bugfix: Page config parser fix (Beau Gunderson) </div>
</li>
<li class="level1"><div class="li"> Bugfix: Zoom window size fixed (Report by Rudolf Labuschagne) </div>
</li>
<li class="level1"><div class="li"> Bugfix: Fixed undefined offset while using &#039;ds_name&#039; in templates (Reported by Vladimir Bilik)</div>
</li>
<li class="level1"><div class="li"> Bugfix: Npcdmod respects process_perf_data option used in hosts and services definitions ( Reported by Wolfgang Barth )</div>
</li>
<li class="level1"><div class="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>
<li class="level1"><div class="li"> Bugfix: Fixed max amount of graphs per template </div>
</li>
<li class="level1"><div class="li"> Bugfix: Autodetect PNP base <acronym title="Uniform Resource Locator">URL</acronym></div>
</li>
<li class="level1"><div class="li"> Bugfix: Too short npcdmod perfdata_template to take perfdata + overhead, increased +1024byte</div>
</li>
<li class="level1"><div class="li"> Bugfix: Ignore files in var/perfdata and check for empty directories</div>
</li>
<li class="level1"><div class="li"> Bugfix: Reducing memory usage while parsing page config (Laurent Freval)</div>
</li>
</ul>
<p>
<strong>pnp-0.6.5 07/09/2010</strong>
</p>
<ul>
<li class="level1"><div class="li"> Feature: Special Templates are back <a href="/pnp-0.6/tpl_special" class="wikilink1" title="pnp-0.6:tpl_special">tpl_special</a></div>
</li>
<li class="level1"><div class="li"> Feature: New rrdtool helper functions makes template design easier <a href="/pnp-0.6/tpl_helper" class="wikilink1" title="pnp-0.6:tpl_helper">tpl_helper</a></div>
</li>
<li class="level1"><div class="li"> Feature: config.php → &#039;recursive_template_search&#039; is enabled by default</div>
</li>
<li class="level1"><div class="li"> Feature: config.php → &#039;template_dirs&#039; 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>
<li class="level1"><div class="li"> Update: jQuery Update to 1.4.2</div>
</li>
<li class="level1"><div class="li"> Update: jQuery-ui Update to 1.8</div>
</li>
<li class="level1"><div class="li"> Feature: New configure Option --with-base-url</div>
</li>
<li class="level1"><div class="li"> Template: New template check_ntp_time.php (Mathias Kettner)</div>
</li>
<li class="level1"><div class="li"> Feature: New i18n files for fr_FR (Yannig Parre)</div>
</li>
<li class="level1"><div class="li"> Feature: New jQuery Theme &#039;multisite&#039;</div>
</li>
</ul>
<p>
<strong>pnp-0.6.3 03/16/2010</strong>
</p>
<ul>
<li class="level1"><div class="li"> Feature: New helper script libexec/rrd_convert.pl → <a href="/pnp-0.6/rrd_convert" class="wikilink1" title="pnp-0.6:rrd_convert">rrd_convert</a></div>
</li>
<li class="level1"><div class="li"> Bugfix: Ignore old <acronym title="Extensible Markup Language">XML</acronym> files while building the service list</div>
</li>
<li class="level1"><div class="li"> Template: New template check_hpasm.php</div>
</li>
<li class="level1"><div class="li"> Bugfix: Installer now checks for json_decode()</div>
</li>
<li class="level1"><div class="li"> Workaround: Allow “trailing unfilled semicolons”. Workaround for nsclient++</div>
</li>
<li class="level1"><div class="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>
<li class="level1"><div class="li"> Feature: <acronym title="Extensible Markup Language">XML</acronym>_WRITE_DELAY option added to process_perfdata.cfg as suggested by Mathias Kettner</div>
</li>
<li class="level1"><div class="li"> Feature: New template integer.php </div>
</li>
<li class="level1"><div class="li"> Update: FPDI update to 1.3.1</div>
</li>
<li class="level1"><div class="li"> Feature: PNP will now work with <a href="http://http://www.lighttpd.net" class="urlextern" title="http://http://www.lighttpd.net" rel="nofollow">lighttpd</a> and php-cgi</div>
</li>
<li class="level1"><div class="li"> Template: check_mk-ps.perf.php added ( by Mathias Kettner )</div>
</li>
<li class="level1"><div class="li"> Feature: PNP will now work without mod_rewrite → <a href="/pnp-0.6/webfe" class="wikilink1" title="pnp-0.6:webfe">webfe</a> </div>
</li>
<li class="level1"><div class="li"> Bugfix: Wrong pdf link used on site &#039;pages&#039; and &#039;basket&#039;</div>
</li>
<li class="level1"><div class="li"> Bugfix: Incorrect group permissions on spool directory</div>
</li>
</ul>
<p>
<strong>pnp-0.6.1 11/22/2009</strong>
</p>
<ul>
<li class="level1"><div class="li"> Feature: RRD heartbeat per check_command → <a href="/pnp-0.6/tpl_custom" class="wikilink1" title="pnp-0.6:tpl_custom">tpl_custom</a> </div>
</li>
<li class="level1"><div class="li"> Feature: New config.php option pdf_graph_opt </div>
</li>
<li class="level1"><div class="li"> Feature: Recognize the &#039;background_pdf&#039; option in page definitions → <a href="/pnp-0.6/pages" class="wikilink1" title="pnp-0.6:pages">pages</a></div>
</li>
<li class="level1"><div class="li"> Feature: Recognize the &#039;source&#039; option in page definitions → <a href="/pnp-0.6/pages" class="wikilink1" title="pnp-0.6:pages">pages</a></div>
</li>
<li class="level1"><div class="li"> Feature: Array $TIMERANGE now available for templates → <a href="/pnp-0.6/timeranges" class="wikilink1" title="pnp-0.6:timeranges">timeranges</a></div>
</li>
<li class="level1"><div class="li"> Bugfix: ./configure --sysconfdir no longer ignored</div>
</li>
<li class="level1"><div class="li"> Feature: Store internal runtime statistics on a per minute base </div>
</li>
<li class="level1"><div class="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>
<li class="level1"><div class="li"> Webfrontend based on <a href="http://www.kohanaphp.com" class="urlextern" title="http://www.kohanaphp.com" rel="nofollow">Kohana</a></div>
</li>
<li class="level1"><div class="li"> Webfrontend based on <a href="http://jqueryui.com/themeroller/" class="urlextern" title="http://jqueryui.com/themeroller/" rel="nofollow">jQuery Themes</a></div>
</li>
<li class="level1"><div class="li"> Javascript-functions using <a href="http://jquery.com/" class="urlextern" title="http://jquery.com/" rel="nofollow">jQuery</a> plugins </div>
</li>
<li class="level1"><div class="li"> process_perfdata.pl will be able to use one RRD database per datasource</div>
</li>
<li class="level1"><div class="li"> improved installer. Specification of directory layouts using --with-layout</div>
</li>
<li class="level1"><div class="li"> RRDtool errors are now displayed as images. no more missing images</div>
</li>
<li class="level1"><div class="li"> PNP templates cannot overwrite internal variables anymore</div>
</li>
<li class="level1"><div class="li"> PNP templates of version 0.4.x can still be used</div>
</li>
<li class="level1"><div class="li"> <acronym title="Portable Document Format">PDF</acronym> functions recoded</div>
</li>
<li class="level1"><div class="li"> Template default.php optimized</div>
</li>
<li class="level1"><div class="li"> Export from RRD databases into <acronym title="Extensible Markup Language">XML</acronym>, CSV and JSON format using the RRDtool “xport” function</div>
</li>
<li class="level1"><div class="li"> Page functions recoded</div>
</li>
<li class="level1"><div class="li"> Error pages links to online <acronym title="Frequently Asked Questions">FAQ</acronym></div>
</li>
<li class="level1"><div class="li"> Mouseover Popup in Nagios frontend via jQuery.clueTip plugin</div>
</li>
<li class="level1"><div class="li"> Full support of rrdcached</div>
</li>
</ul>
</div>
<!-- SECTION "ChangeLog" [551-] -->

View File

@@ -0,0 +1,213 @@
<h1><a name="installation" id="installation">Installation</a></h1>
<div class="level1">
<p>
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>
<!-- SECTION "Installation" [1-322] -->
<h2><a name="make_and_more" id="make_and_more">Make and more</a></h2>
<div class="level2">
<p>
The installation of PNP is controlled by <a href="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>
<pre class="code">
tar -xvzf pnp4nagios-HEAD.tar.gz
cd pnp4nagios
</pre>
<p>
./configure is to be called from the directory pnp4nagios.
</p>
<pre class="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
</p>
<pre class="code">
./configure --with-nagios-user=icinga --with-nagios-group=icinga
</pre>
<p>
Some lines run across the screen. The output at the end is important.
</p>
<pre class="code">
*** Configuration summary for pnp4nagios-0.6.2 23-12-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/pnp4nagios/share
Config Dir: /usr/local/pnp4nagios/etc
Location of rrdtool binary: /usr/bin/rrdtool Version 1.2.12
RRDs Perl Modules: FOUND (Version 1.2012)
RRD Files stored in: /usr/local/pnp4nagios/var/perfdata
process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options: ------------------------- -------------------
HTML URL: http://localhost/pnp4nagios/
Apache Config File: /etc/apache2/conf.d/pnp4nagios.conf
Review the options above for accuracy. If they look okay,
type &#039;make all&#039; to compile.</pre>
<p>
The paths shown should be checked. If the displayed values aren&#039;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:
</p>
<pre class="code"> ./configure --with-rrdtool=/usr/local/rrdtool-1.2.xx/bin/rrdtool</pre>
<pre class="code"> ./configure --help </pre>
<p>
shows the supported options.<br/>
<br/>
</p>
<p>
Invoking
</p>
<pre class="code"> make all</pre>
<p>
compiles the components like NPCD which are written in C
</p>
<pre class="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 <acronym title="HyperText Markup Language">HTML</acronym> files you can copy a sample Apache configuration file to your web-server config directory
</p>
<pre class="code"> make install-webconf</pre>
<p>
You can call
</p>
<pre class="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>
<pre class="code"> make install-init</pre>
<p>
All these steps are combined in
</p>
<pre class="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 &#039;/etc/apache2/conf.d/pnp4nagios.conf&#039; has to be edited to change the path to AuthUserFile (the path may differ between distributions):
</p>
<pre class="code"># AuthUserFile /usr/local/nagios/etc/htpasswd.users
AuthUserFile /usr/local/icinga/etc/htpasswd.users</pre>
<p>
<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>
<!-- SECTION "Make and more" [323-3702] -->
<h2><a name="update" id="update">Update</a></h2>
<div class="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.
</p>
</div>
<!-- SECTION "Update" [3703-4327] -->
<h2><a name="the_components" id="the_components">The components</a></h2>
<div class="level2">
<p>
After installation the components of PNP were copied to the appropriate places in the file system. These are
</p>
<p>
the <acronym title="Hypertext Preprocessor">PHP</acronym>-Files for the web-frontend below
</p>
<pre class="code"> /usr/local/pnp4nagios/share</pre>
<p>
the data collector process_perfdata.pl in
</p>
<pre class="code"> /usr/local/pnp4nagios/libexec</pre>
<p>
sample config files with the suffix <code>-sample</code> in
</p>
<pre class="code"> /usr/local/pnpnagios/etc</pre>
<p>
the config file config.php for the web frontend in
</p>
<pre class="code"> /usr/local/pnp4nagios/etc</pre>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/config" class="wikilink1" title="pnp-0.6:config">configuration</a>
</p>
</div>
<!-- SECTION "The components" [4328-] -->

View File

@@ -0,0 +1,89 @@
<h1><a name="mobile_ui" id="mobile_ui">Mobile UI</a></h1>
<div class="level1">
<p>
Starting with PNP4Nagios 0.6.14 a web interface for mobile devices is integrated into PNP4Nagios.
</p>
<p>
The design was realised using <a href="http://jquerymobile.com/" class="urlextern" title="http://jquerymobile.com/" rel="nofollow">jQuery Mobile</a> and hence is compatible to current mobile browsers. The list of the <a href="http://jquerymobile.com/gbs/" class="urlextern" title="http://jquerymobile.com/gbs/" rel="nofollow">supported devices</a> shows a graded browser support chart.
</p>
</div>
<!-- SECTION "Mobile UI" [1-356] -->
<h1><a name="landing_page" id="landing_page">Landing Page</a></h1>
<div class="level1">
<p>
The web interface was designed to intercept the calls to the classical interface and to redirect them to the appropriate mobile page. This way links to PNP graphs inside Nagios mails don&#039;t have to be changed and point to the correct page depending on the device type..
</p>
<table class="inline">
<tr class="row0">
<th class="col0"> Classic </th><th class="col1"> Mobile </th>
</tr>
<tr class="row1">
<td class="col0 leftalign"> /pnp4nagios/graph </td><td class="col1"> /pnp4nagios/mobile </td>
</tr>
<tr class="row2">
<td class="col0 leftalign"> /pnp4nagios/graph?host=localhost </td><td class="col1"> /pnp4nagios/mobile/host/localhost </td>
</tr>
<tr class="row3">
<td class="col0"> /pnp4nagios/graph?host=localhost&amp;srv=ping </td><td class="col1"> /pnp4nagios/mobile/graph/localhost/ping </td>
</tr>
</table>
</div>
<!-- SECTION "Landing Page" [357-913] -->
<h1><a name="browser_recognition" id="browser_recognition">Browser recognition</a></h1>
<div class="level1">
<p>
Browsers are recognised as mobile browsers by analysing the “user agent” string.
The recognition can be influenced by changing <code>pnp4nagios/etc/<a href="/pnp-0.6/webfe_cfg" class="wikilink1" title="pnp-0.6:webfe_cfg">config_local.php</a></code>.
</p>
<pre class="code">
$conf[&#039;mobile_devices&#039;] = &#039;iPhone|iPod|iPad|android&#039;;
</pre>
<p>
The option &#039;mobile_devices&#039; contains a regular expression which is compared with the “user agent” string of the browser.
</p>
<p>
The “user agent” string of a browser is logged in the web server access log. An entry for an iOS device looks similar to the following.
</p>
<pre class="code">
&quot;Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7&quot;
</pre>
</div>
<!-- SECTION "Browser recognition" [914-1620] -->
<h1><a name="screenshots" id="screenshots">Screenshots</a></h1>
<div class="level1">
<p>
Screenshot taken with an iPhone and iOS 4.2
</p>
<table class="inline">
<tr class="row0">
<td class="col0"> <a href="/_detail/mobile-home.png?id=pnp-0.6%3Amobile" class="media" title="mobile-home.png"><img src="/_media/mobile-home.png?w=150" class="media" title=" Home Screen" alt=" Home Screen" width="150" /></a> </td><td class="col1"> Homescreen </td><td class="col2"> <a href="/_detail/mobile-loading.png?id=pnp-0.6%3Amobile" class="media" title="mobile-loading.png"><img src="/_media/mobile-loading.png?w=150" class="media" title=" Loading..." alt=" Loading..." width="150" /></a> </td><td class="col3"> Loading … </td>
</tr>
<tr class="row1">
<td class="col0"> <a href="/_detail/mobile-hostlist.png?id=pnp-0.6%3Amobile" class="media" title="mobile-hostlist.png"><img src="/_media/mobile-hostlist.png?w=150" class="media" title=" Hosts Liste " alt=" Hosts Liste " width="150" /></a> </td><td class="col1"> List of all hosts </td><td class="col2"> <a href="/_detail/mobile-servicelist.png?id=pnp-0.6%3Amobile" class="media" title="mobile-servicelist.png"><img src="/_media/mobile-servicelist.png?w=150" class="media" title=" Liste aller services" alt=" Liste aller services" width="150" /></a> </td><td class="col3"> List of all services of a host</td>
</tr>
<tr class="row2">
<td class="col0"> <a href="/_detail/mobile-graphs.png?id=pnp-0.6%3Amobile" class="media" title="mobile-graphs.png"><img src="/_media/mobile-graphs.png?w=150" class="media" title=" Graphen" alt=" Graphen" width="150" /></a> </td><td class="col1"> Graph of a service </td><td class="col2"> </td><td class="col3"> </td>
</tr>
</table>
</div>
<!-- SECTION "Screenshots" [1621-] -->

View File

@@ -0,0 +1,145 @@
<h1><a name="the_art_of_collecting_data" id="the_art_of_collecting_data">The art of collecting data</a></h1>
<div class="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 <acronym title="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>
<!-- SECTION "The art of collecting data" [1-703] -->
<h1><a name="the_modes_in_comparison" id="the_modes_in_comparison">The modes in comparison</a></h1>
<div class="level1">
</div>
<!-- SECTION "The modes in comparison" [704-741] -->
<h2><a name="synchronous_mode" id="synchronous_mode">Synchronous Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/synchronous.png?id=pnp-0.6%3Amodes" class="media" title="synchronous.png"><img src="/_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.
</p>
</div>
<!-- SECTION "Synchronous Mode" [742-1073] -->
<h2><a name="bulk_mode" id="bulk_mode">Bulk Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk.png?id=pnp-0.6%3Amodes" class="media" title="bulk.png"><img src="/_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.
</p>
<p>
snippet of var/perfdata.log:
</p>
<pre class="code">
2007-10-18 12:05:01 [21138] 71 Lines processed
2007-10-18 12:05:01 [21138] .../spool/service-perfdata-1192701894-PID-21138 deleted
2007-10-18 12:05:01 [21138] PNP exiting (runtime 0.060969s) ...
</pre>
<p>
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>
<!-- SECTION "Bulk Mode" [1074-2083] -->
<h2><a name="bulk_mode_with_npcd" id="bulk_mode_with_npcd">Bulk Mode with NPCD</a></h2>
<div class="level2">
<p>
<a href="/_detail/bulk-npcd.png?id=pnp-0.6%3Amodes" class="media" title="bulk-npcd.png"><img src="/_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>
<!-- SECTION "Bulk Mode with NPCD" [2084-2832] -->
<h2><a name="bulk_mode_with_npcdmod" id="bulk_mode_with_npcdmod">Bulk Mode with npcdmod</a></h2>
<div class="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>
<a href="/_detail/bulk-npcdmod.png?id=pnp-0.6%3Amodes" class="media" title="bulk-npcdmod.png"><img src="/_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.
</p>
</div>
<!-- SECTION "Bulk Mode with npcdmod" [2833-3364] -->
<h2><a name="gearman_mode" id="gearman_mode">Gearman Mode</a></h2>
<div class="level2">
<p>
<a href="/_detail/gearman.png?id=pnp-0.6%3Amodes" class="media" title="gearman.png"><img src="/_media/gearman.png?w=150" class="medialeft" align="left" alt="" width="150" /></a>
</p>
<p>
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 <a href="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>
</div>
<!-- SECTION "Gearman Mode" [3365-3742] -->
<h2><a name="the_decision" id="the_decision">The decision</a></h2>
<div class="level2">
<p>
Which mode you choose will depend on the size of your Nagios installation. You will find theses terms throughout the documentation.
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/install" class="wikilink1" title="pnp-0.6:install">installation</a>
</p>
</div>
<!-- SECTION "The decision" [3743-] -->

View File

@@ -0,0 +1,61 @@
<h2><a name="new_in_pnp_06x" id="new_in_pnp_06x">New in PNP 0.6.x</a></h2>
<div class="level2">
<p>
<a href="/_detail/pnp-0.6/gallery/pnp-preview-05-08-2009.png?id=pnp-0.6%3Anew-features" class="media" title="pnp-0.6:gallery:pnp-preview-05-08-2009.png"><img src="/_media/pnp-0.6/gallery/pnp-preview-05-08-2009.png?w=200" class="mediaright" align="right" title="PNP 0.6.x Preview " alt="PNP 0.6.x Preview " width="200" /></a>
</p>
<p>
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 <a href="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>
<li class="level1"><div class="li"> Webfrontend based on <a href="http://www.kohanaphp.com" class="urlextern" title="http://www.kohanaphp.com" rel="nofollow">Kohana</a></div>
</li>
<li class="level1"><div class="li"> Webfrontend based on <a href="http://jqueryui.com/themeroller/" class="urlextern" title="http://jqueryui.com/themeroller/" rel="nofollow">jQuery Themes</a></div>
</li>
<li class="level1"><div class="li"> Javascript-functions using <a href="http://jquery.com/" class="urlextern" title="http://jquery.com/" rel="nofollow">jQuery</a> plugins </div>
</li>
<li class="level1"><div class="li"> process_perfdata.pl will be able to use one RRD database per datasource</div>
</li>
<li class="level1"><div class="li"> improved installer. Specification of directory layouts using --with-layout</div>
</li>
<li class="level1"><div class="li"> RRDtool errors are now displayed as images. no more missing images</div>
</li>
<li class="level1"><div class="li"> PNP templates cannot overwrite internal variables anymore</div>
</li>
<li class="level1"><div class="li"> PNP templates of version 0.4.x can still be used</div>
</li>
<li class="level1"><div class="li"> <acronym title="Portable Document Format">PDF</acronym> functions recoded</div>
</li>
<li class="level1"><div class="li"> Template default.php optimized</div>
</li>
<li class="level1"><div class="li"> Export from RRD databases into <acronym title="Extensible Markup Language">XML</acronym>, CSV and JSON format using the RRDtool “xport” function</div>
</li>
<li class="level1"><div class="li"> Page functions recoded</div>
</li>
<li class="level1"><div class="li"> Error pages links to online <a href="http://docs.pnp4nagios.org/faq" class="urlextern" title="http://docs.pnp4nagios.org/faq" rel="nofollow">FAQ</a></div>
</li>
<li class="level1"><div class="li"> Mouseover Popup in Nagios frontend via jQuery.clueTip plugin</div>
</li>
<li class="level1"><div class="li"> Full support of rrdcached</div>
</li>
</ul>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/about#system_requirements" class="wikilink1" title="pnp-0.6:about">system requirements</a>
</p>
</div>

View File

@@ -0,0 +1,323 @@
<h1><a name="npcd" id="npcd">NPCD</a></h1>
<div class="level1">
<p>
NPCD (Nagios-Perfdata-C-Daemon) was written to provide an asynchronous mode to handle performance data with <code>nagios</code>.
</p>
</div>
<!-- SECTION "NPCD" [1-141] -->
<h2><a name="introduction" id="introduction">Introduction</a></h2>
<div class="level2">
<p>
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 <a href="/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>&lt;host|service&gt;_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>
<!-- SECTION "Introduction" [142-1119] -->
<h2><a name="how_it_works" id="how_it_works">How it works</a></h2>
<div class="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&#039;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 &#039;normal&#039; bulk mode NPCD should execute <code>process_perfdata.pl</code> in <a href="/pnp-0.6/modes#bulk_mode" class="wikilink1" title="pnp-0.6:modes">Bulk Mode</a>.
</p>
</div>
<!-- SECTION "How it works" [1120-1877] -->
<h2><a name="advantages_disadvantages" id="advantages_disadvantages">Advantages / Disadvantages</a></h2>
<div class="level2">
<p>
<strong>Pro:</strong>
</p>
<ul>
<li class="level1"><div class="li"> Performance improvements for Nagios</div>
<ul>
<li class="level2"><div class="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>
<li class="level1"><div class="li"> no lost data</div>
<ul>
<li class="level2"><div class="li"> as long as <code>Nagios</code> writes perfdata files to the spool dir your data won&#039;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>
<li class="level1"><div class="li"> no real time processing of performance data</div>
<ul>
<li class="level2"><div class="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>
<li class="level2"><div class="li"> another delay exists within NPCD which waits for up to 10 seconds after each directory scanning</div>
</li>
</ul>
</li>
</ul>
</div>
<!-- SECTION "Advantages / Disadvantages" [1878-2677] -->
<h1><a name="npcd_config" id="npcd_config">NPCD Config</a></h1>
<div class="level1">
<p>
You have to control NPCD with its own configuration file like the rolled out <code>npcd.cfg-sample</code> file.
</p>
<p>
Just rename it to <code>npcd.cfg</code> to start NPCD like this:
</p>
<pre class="code _bash">/usr/local/pnp4nagios/bin/npcd -f /usr/local/pnp4nagios/etc/npcd.cfg</pre>
<p>
or
</p>
<pre class="code _bash">/usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg</pre>
<p>
to run in Daemon Mode (background).
</p>
<p>
<strong>Hint:</strong>
If you decide to not rename the config file, it might be overwritten by a future update of PNP.
</p>
</div>
<!-- SECTION "NPCD Config" [2678-3190] -->
<h2><a name="npcdcfg-sample" id="npcdcfg-sample">npcd.cfg-sample</a></h2>
<div class="level2">
<p>
These are the essential configuration directives for NPCD:
</p>
<pre class="code"># Privilege Options
user = nagios
group = nagios
# Logging Options
log_type = syslog
log_file = /usr/local/pnp4nagios/var/npcd.log
max_logfile_size = 10485760
log_level=0
# Processing Options
perfdata_spool_dir = /usr/local/pnp4nagios/var/spool/
perfdata_file_run_cmd = /usr/local/pnp4nagios/libexec/process_perfdata.pl
perfdata_file_run_cmd_args = -b
# Thread Options
npcd_max_threads=5
# greedy options
use_load_threshold = 0
load_threshold = 10.0
# Process Options
pid_file=/var/run/npcd.pid
</pre>
</div>
<!-- SECTION "npcd.cfg-sample" [3191-3794] -->
<h2><a name="the_directives" id="the_directives">The directives</a></h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> <strong>Privilege Options</strong></div>
<ul>
<li class="level2"><div class="li"> user &lt;username&gt; </div>
<ul>
<li class="level3"><div class="li"> NPCD tries to drop &#039;root&#039; privileges to switch to this user.</div>
</li>
<li class="level3"><div class="li"> <strong>default:</strong> nagios</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> group &lt;groupname&gt;</div>
<ul>
<li class="level3"><div class="li"> NPCD tries to drop &#039;root&#039; privileges to switch to this group.</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> nagios</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Logging Options</strong></div>
<ul>
<li class="level2"><div class="li"> log_type &lt;syslog&gt; or &lt;file&gt; </div>
<ul>
<li class="level3"><div class="li"> Log type that is uses by NPCD</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> syslog</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> log_file &lt;/path/to/filename&gt; </div>
<ul>
<li class="level3"><div class="li"> if <code>log_type = file</code> this will be the logfile used</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /usr/local/pnp4nagios/var/npcd.log</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> max_logfile_size &lt;bytes&gt; </div>
<ul>
<li class="level3"><div class="li"> NPCD will rotate the logfile if the filesize of the current log is above this limit</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 10485760 = 10 MByte</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> log_level &lt;integer&gt;</div>
<ul>
<li class="level3"><div class="li"> how much to log, possible values:</div>
<ul>
<li class="level4"><div class="li"> 0 = No Log - except errors</div>
</li>
<li class="level4"><div class="li"> 1 = small Log - some more output</div>
</li>
<li class="level4"><div class="li"> 2 = more Log (actual ALL log messages)</div>
</li>
<li class="level4"><div class="li"> -1 = DEBUG Mode - ALL Logs and slower processing for debugging purposes</div>
</li>
</ul>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 0</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Processing Options</strong></div>
<ul>
<li class="level2"><div class="li"> perfdata_spool_dir &lt;/path/to/spool/dir/&gt;</div>
<ul>
<li class="level3"><div class="li"> The directory where the perfdata file should be found</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /usr/local/pnp4nagios/var/spool/</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> perfdata_file_run_cmd &lt;/path/to/bin/filename&gt;</div>
<ul>
<li class="level3"><div class="li"> This is the script/binary that NPCD will execute</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /usr/local/pnp4nagios/libexec/process_perfdata.pl</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> perfdata_file_run_cmd_args &lt;option&gt; </div>
<ul>
<li class="level3"><div class="li"> The argument added to the perfdata_file_run_cmd</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> ”-b”</div>
</li>
<li class="level3"><div class="li"> <img src="/lib/images/smileys/icon_exclaim.gif" class="middle" alt=":!:" /> The command line will be created like this: <pre class="code">&lt;perfdata_file_run_cmd&gt; &lt;perfdata_file_run_cmd_args&gt; &lt;filename_from_perfdata_spool_dir&gt;</pre>
</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Thread Options</strong></div>
<ul>
<li class="level2"><div class="li"> npcd_max_threads &lt;integer value&gt;</div>
<ul>
<li class="level3"><div class="li"> Defines how many parallel threads should be started</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 5</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Greedy Options</strong></div>
<ul>
<li class="level2"><div class="li"> use_load_threshold &lt;0 or 1&gt;</div>
<ul>
<li class="level3"><div class="li"> defines if NPCD should _not_ start new threads if your system load is too high</div>
<ul>
<li class="level4"><div class="li"> 0 = disable</div>
</li>
<li class="level4"><div class="li"> 1 = enable</div>
</li>
</ul>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 0</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> load_threshold &lt;float value&gt;</div>
<ul>
<li class="level3"><div class="li"> if <code>use_load_threshold</code> is set to 1 this load limit must not be exceeded</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> 10.0</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Process Options</strong></div>
<ul>
<li class="level2"><div class="li"> pid_file &lt;/path/to/pid.file&gt;</div>
<ul>
<li class="level3"><div class="li"> the path to the PID File</div>
</li>
<li class="level3"><div class="li"> <strong>Default:</strong> /var/run/npcd.pid</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/wrapper" class="wikilink1" title="pnp-0.6:wrapper">wrapper script</a>
</p>
</div>
<!-- SECTION "The directives" [3795-] -->

View File

@@ -0,0 +1,91 @@
<h1><a name="pages" id="pages">Pages</a></h1>
<div class="level1">
<p>
“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[&#039;page_dir&#039;]” 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>
<pre class="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>
<pre class="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>
<pre class="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>
<pre class="code">define graph {
host_name ^Tape
service_desc Traffic
}</pre>
<p>
all hosts whose names are ending with “00”:
</p>
<pre class="code">define graph {
host_name 00$
service_desc Load
}</pre>
<p>
all services of localhost whose names contain “a” or “o”, respectively:
</p>
<pre class="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>
<pre class="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>
<pre class="code">define graph {
host_name host1,host2,host3
service_desc PING
source 1
}</pre>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/xport" class="wikilink1" title="pnp-0.6:xport"> data export</a>
</p>
</div>

View File

@@ -0,0 +1,61 @@
<p>
2.6. Performance data
</p>
<p>
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:
</p>
<p>
&#039;label&#039;=value[UOM];[warn];[crit];[min];[max]
</p>
<p>
Notes:
</p>
<ol>
<li class="level1"><div class="li"> space separated list of label/value pairs</div>
</li>
<li class="level1"><div class="li"> <em>label</em> can contain any characters</div>
</li>
<li class="level1"><div class="li"> the single quotes for the label are optional. Required if spaces, = or &#039; are in the label</div>
</li>
<li class="level1"><div class="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>
<li class="level1"><div class="li"> to specify a quote character, use two single quotes</div>
</li>
<li class="level1"><div class="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>
<li class="level1"><div class="li"> min and max are not required if UOM=%</div>
</li>
<li class="level1"><div class="li"> value, min and max in class [-0-9.]. Must all be the same UOM</div>
</li>
<li class="level1"><div class="li"> warn and crit are in the range format (see Section 2.5). Must be the same UOM</div>
</li>
<li class="level1"><div class="li"> UOM (unit of measurement) is one of:</div>
<ul>
<li class="level3"><div class="li"> no unit specified - assume a number (int or float) of things (eg, users, processes, load averages)</div>
</li>
<li class="level3"><div class="li"> s - seconds (also us, ms)</div>
</li>
<li class="level3"><div class="li"> % - percentage</div>
</li>
<li class="level3"><div class="li"> B - bytes (also KB, <acronym title="Megabyte">MB</acronym>, TB, <acronym title="Gigabyte">GB</acronym>?)</div>
</li>
<li class="level3"><div class="li"> c - a continous counter (such as bytes transmitted on an interface)</div>
</li>
</ul>
</li>
</ol>
<p>
It is up to third party programs to convert the Nagios plugins performance data into graphs.
</p>
<p>
Origin: <a href="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" class="urlextern" title="http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201" rel="nofollow">http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201</a>
</p>

View File

@@ -0,0 +1,88 @@
<h1><a name="rrd_storage_type_multiple" id="rrd_storage_type_multiple">RRD_STORAGE_TYPE = MULTIPLE</a></h1>
<div class="level1">
<p>
<strong>available starting with PNP 0.6.3</strong>
</p>
<p>
Since PNP version 0.6 it is possible to store performance data into multiple RRD databases instead of a single RRD database.
</p>
<p>
After creation of an RRD file you cannot alter the number of data sources. This may lead to problems if Nagios plugins change the number of data sources dynamically.
</p>
<p>
An example might be <code>check_disk</code> if you monitor all available file systems using one service. If a file system is added the RRD database cannot be updated anymore because the internal would be changed.
</p>
<p>
Per default PNP uses the option <code>RRD_STORAGE_TYPE = SINGLE</code> which is defined in <code>process_perfdata.pl</code> and might be changed using the config file <code>process_perfdata.cfg</code>.
This setting should <strong>not</strong> be changed globally because PNP will start creating new RRD files immediately after changing to MULTIPLE. Old data will get lost!
</p>
<p>
Additionally it is not advisable to activate <code>RRD_STORAGE_TYPE = MULTIPLE</code> globally in regard to performance. The number of RRD databases and the disk I/O will increase significantly. That means that you should carefully select which Nagios check commands should be altered.
</p>
<p>
The section <a href="/pnp-0.6/tpl_custom" class="wikilink1" title="pnp-0.6:tpl_custom">Custom Templates</a> contains information about how the settings should be altered.
</p>
</div>
<!-- SECTION "RRD_STORAGE_TYPE = MULTIPLE" [1-1305] -->
<h2><a name="a_converter" id="a_converter">A converter</a></h2>
<div class="level2">
<p>
The script <code>libexec/rrd_convert.pl</code> will be used to switch <code>RRD_STORAGE_TYPE</code> to <code>MULTIPLE</code> and to migrate the RRD databases.
</p>
<p>
Significant as always with PNP is the Nagios check command.
</p>
<pre class="code">rrd_convert.pl --check_command=&lt;nagios_check_command&gt; | --list_commands [ --dry-run ] [ --tmp_dir=&lt;temp-directory ]
[ --no_structure_check ]</pre>
<p>
You have to specify at least one of ”--check_command” or ”--list_commands”, respectively.
Using the open <code>--check-command=</code> you tell the script which check command should be searched for.
</p>
<p>
<code>rrd_convert.pl</code> will now browse all PNP <acronym title="Extensible Markup Language">XML</acronym> files for this command and output some statistics.
</p>
<p>
After confirmation from the user the conversion of the appropriate RRD databases will start displaying the progress. Pressing &lt;ENTER&gt; as an answer will terminate the script so please enter a letter.
</p>
<p>
If you are unsure then use <code>--list_commands</code> to get a list of the check commands used in the <acronym title="Extensible Markup Language">XML</acronym> files.
</p>
<p>
The option <code>--dry-run</code> will convert the RRD databases but they will be stored in /tmp/rrd_convert in separate folders per host instead. This way you&#039;ll get a feeling about the runtime and the amount of data.
</p>
<p>
If you want to change the temporary directory you can use <code>--tmp_dir=&lt;alternative temp dir&gt;</code>.
</p>
<p>
Sometimes the number of datasources in the RRD files doesn&#039;t match the number in the <acronym title="Extensible Markup Language">XML</acronym> files. This might happen if a plugin suddenly returns more datasources than usual (like check_disk as mentioned above). Using the option <code>--no_structure_check</code> these RRD files will be converted as well.
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/npcd" class="wikilink1" title="pnp-0.6:npcd">NPCD details</a>
</p>
</div>
<!-- SECTION "A converter" [1306-] -->

View File

@@ -0,0 +1,154 @@
<h1><a name="rrdtool_cache_daemon" id="rrdtool_cache_daemon">RRDtool Cache Daemon</a></h1>
<div class="level1">
<p>
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 ( <a href="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&#039;d like to thank Florian octo Forster, Kevin Brintnall and Tobi Oetiker. The development of this daemon has been coordinated exemplary on the <a href="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>
<!-- SECTION "RRDtool Cache Daemon" [1-885] -->
<h2><a name="mode_of_operation" id="mode_of_operation">Mode of operation</a></h2>
<div class="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.
</p>
</div>
<!-- SECTION "Mode of operation" [886-1184] -->
<h3><a name="rrdcached" id="rrdcached">rrdcached</a></h3>
<div class="level3">
<p>
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>
<pre class="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>
<pre class="code">-P FLUSH,PENDING</pre>
<p>
Option -s allows to change the group ownership of the unix socket
</p>
<pre class="code">-s nagios</pre>
<p>
Option -m sets the permissions of the unix socket in the usual octal format
</p>
<pre class="code">-m 0660</pre>
<p>
Option -w specifies the interval (in seconds) the data will be written to disk.
</p>
<pre class="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>
<pre class="code">-z 1800</pre>
<p>
Option -p defines a PID file
</p>
<pre class="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>
<pre class="code">-j /var/cache/rrdcached</pre>
<p>
These options may result in a call of rrdcached with the following parameters
</p>
<pre class="code"> rrdcached -w 1800 -z 1800 -p /tmp/rrdcached.pid -j /tmp -s nagios -m 0660 -l unix:/tmp/rrdcached.sock</pre>
</div>
<!-- SECTION "rrdcached" [1185-2580] -->
<h3><a name="rrdtool" id="rrdtool">rrdtool</a></h3>
<div class="level3">
<p>
RRDtool itself will be informed about the daemon using the option --daemon=&lt;socket&gt;.
</p>
<pre class="code"> rrdtool --daemon=unix:/tmp/rrdcached.sock update ...</pre>
<p>
Of course this has to correspond with the options of rrdcached!
</p>
</div>
<!-- SECTION "rrdtool" [2581-2807] -->
<h2><a name="integration_into_pnp" id="integration_into_pnp">Integration into PNP</a></h2>
<div class="level2">
<p>
Because two components of PNP have to prepared for the use of rrdcached there are changes in two config files.
</p>
<p>
1. Adjustment of process_perfdata.cfg for the data collector process_perfdata.pl
</p>
<pre class="code">
# EXPERIMENTAL rrdcached Support
# Use only with rrdtool svn revision 1511+
#
RRD_DAEMON_OPTS = unix:/var/run/rrdcached.sock
</pre>
<p>
2. Adjustment of config_local.php (or config.php) for the web interface
</p>
<pre class="code">
#
# EXPERIMENTAL rrdcached Support
# Use only with rrdtool svn revision 1511+
#
# $conf[&#039;RRD_DAEMON_OPTS&#039;] = &#039;unix:/tmp/rrdcached.sock&#039;;
$conf[&#039;RRD_DAEMON_OPTS&#039;] = &#039;unix:/var/run/rrdcached.sock&#039;;
</pre>
<p>
The sample files contain the relevant options.
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/rrd_convert" class="wikilink1" title="pnp-0.6:rrd_convert">migrating RRD files</a>
</p>
</div>
<!-- SECTION "Integration into PNP" [2808-] -->

View File

@@ -0,0 +1,194 @@
<h1><a name="documentation" id="documentation">Documentation</a></h1>
<div class="level1">
<div class="box red centered" style="width: 99%; ">
<b class='xtop'><b class='xb1'></b><b class='xb2'></b><b class='xb3'></b><b class='xb4'></b></b>
<div class='xbox'>
<div class='box_content'>PNP4Nagios Broker Module npcdmod.o is not compatible with Nagios Core 4.x</div>
</div>
<b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b>
</div>
<p>
<a href="/_detail/pnp-0.6/gallery/pnp-preview-05-08-2009.png?id=pnp-0.6%3Astart" class="media" title="pnp-0.6:gallery:pnp-preview-05-08-2009.png"><img src="/_media/pnp-0.6/gallery/pnp-preview-05-08-2009.png?w=215" class="mediaright" align="right" title="Theme &quot;smoothness&quot;" alt="Theme &quot;smoothness&quot;" width="215" /></a>
</p>
<p>
PNP is an addon to Nagios which analyzes performance data provided by plugins and stores them automatically into RRD-databases (Round Robin Databases, see <a href="http://www.rrdtool.org" class="urlextern" title="http://www.rrdtool.org" rel="nofollow">RRD Tool</a>).
</p>
<p>
During development of PNP we set value on easy installation and little maintenance while running it. An administrator should do other things than configure graphing tools.
</p>
<p>
To achieve this task we focused on using standards. PNP only processes performance data built according to the <a href="http://nagiosplug.sourceforge.net/developer-guidelines.html" class="urlextern" title="http://nagiosplug.sourceforge.net/developer-guidelines.html" rel="nofollow">Developer Guidelines</a> for nagios plugins. With this limitation we want to honour the work of <a href="http://nagiosplugins.org" class="urlextern" title="http://nagiosplugins.org" rel="nofollow">Nagios Plugin Developers</a> who stick to the guidelines.
</p>
<p>
For all of those who are still curious the following documentation is made which should help to ease the access to PNP.
</p>
<p>
<a href="/pnp-0.6/doc_complete" class="wikilink1" title="pnp-0.6:doc_complete">complete documentation on &quot;one&quot; page</a>
</p>
</div>
<!-- SECTION "Documentation" [1-1099] -->
<h2><a name="documentation1" id="documentation1">Documentation</a></h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> <strong>About PNP</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/new-features" class="wikilink1" title="pnp-0.6:new-features">New features</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/about#system_requirements" class="wikilink1" title="pnp-0.6:about">System requirements</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/about#license" class="wikilink1" title="pnp-0.6:about">License</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/about#download" class="wikilink1" title="pnp-0.6:about">Download</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/about#support" class="wikilink1" title="pnp-0.6:about">Support</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/about#storage" class="wikilink1" title="pnp-0.6:about">Storage</a></div>
</li>
</ul>
</li>
</ul>
<ul>
<li class="level1"><div class="li"> <strong>Release Notes</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/dwnld" class="wikilink1" title="pnp-0.6:dwnld">Download</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/dwnld#changelog" class="wikilink1" title="pnp-0.6:dwnld">Changelog</a></div>
</li>
</ul>
</li>
</ul>
<ul>
<li class="level1"><div class="li"> <strong>Upgrade</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/upgrade" class="wikilink1" title="pnp-0.6:upgrade">Upgrade from 0.4.x to 0.6.x</a></div>
</li>
</ul>
</li>
</ul>
<ul>
<li class="level1"><div class="li"> <strong>Which mode is the right one ?</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/modes" class="wikilink1" title="pnp-0.6:modes">Synchronous mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/modes#bulk_mode" class="wikilink1" title="pnp-0.6:modes">Bulk mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/modes#bulk_mode_with_npcd" class="wikilink1" title="pnp-0.6:modes">Bulk mode with NPCD</a> </div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/modes#bulk_mode_with_npcd_and_npcdmod" class="wikilink1" title="pnp-0.6:modes">Bulk Mode with NPCD and npcdmod</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/modes#gearman_mode" class="wikilink1" title="pnp-0.6:modes">Gearman mode</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Installation</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/install" class="wikilink1" title="pnp-0.6:install">Make and more</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/install#update" class="wikilink1" title="pnp-0.6:install">Update</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/install#the_components" class="wikilink1" title="pnp-0.6:install">The components</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Configuration</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/config" class="wikilink1" title="pnp-0.6:config">Synchronous mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/config#bulk_mode" class="wikilink1" title="pnp-0.6:config">Bulk mode</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/config#bulk_mode_with_npcd" class="wikilink1" title="pnp-0.6:config">Bulk mode with NPCD</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/config#bulk_mode_with_npcd_and_npcdmod" class="wikilink1" title="pnp-0.6:config">Bulk Mode with NPCD and npcdmod</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/config#gearman_mode" class="wikilink1" title="pnp-0.6:config">Gearman mode</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>The first test / troubleshooting</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/verify" class="wikilink1" title="pnp-0.6:verify">checking the functionality</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/verify_pnp_config" class="wikilink1" title="pnp-0.6:verify_pnp_config">verify_pnp_config helper script</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Web Frontend</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/webfe" class="wikilink1" title="pnp-0.6:webfe">Nagios and PNP</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/webfe" class="wikilink1" title="pnp-0.6:webfe">Action Url</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/webfe_cfg" class="wikilink1" title="pnp-0.6:webfe_cfg">Config Options</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/timeranges" class="wikilink1" title="pnp-0.6:timeranges">Timeranges</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/pages" class="wikilink1" title="pnp-0.6:pages">Pages</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/xport" class="wikilink1" title="pnp-0.6:xport">Data export</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>PNP Templates</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/tpl" class="wikilink1" title="pnp-0.6:tpl">What are templates ?</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/tpl" class="wikilink1" title="pnp-0.6:tpl">Which template is used when?</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/tpl" class="wikilink1" title="pnp-0.6:tpl">Creating own templates</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/tpl_custom" class="wikilink1" title="pnp-0.6:tpl_custom">Custom templates</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/tpl_special" class="wikilink1" title="pnp-0.6:tpl_special">Special templates (new in 0.6.5)</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/tpl_helper" class="wikilink1" title="pnp-0.6:tpl_helper">Helper functions (new in 0.6.5)</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/tpl_helper_pnp" class="wikilink1" title="pnp-0.6:tpl_helper_pnp">Helper functions, part II (new in 0.6.10)</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Advanced Features</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/advanced" class="wikilink1" title="pnp-0.6:advanced">PNP in distributed environments</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/advanced" class="wikilink1" title="pnp-0.6:advanced">check_multi support</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/rrdcached" class="wikilink1" title="pnp-0.6:rrdcached">rrdcached support</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/rrd_convert" class="wikilink1" title="pnp-0.6:rrd_convert">migrating RRD files for use with RRD_STORAGE_TYPE = MULTIPLE</a> </div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>NPCD</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/npcd" class="wikilink1" title="pnp-0.6:npcd">NPCD Details</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Appendix</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/wrapper" class="wikilink1" title="pnp-0.6:wrapper">wrapper script</a></div>
</li>
<li class="level2"><div class="li"> <a href="/pnp-0.6/perfdata_format" class="wikilink1" title="pnp-0.6:perfdata_format">performance data format</a></div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> <strong>Helpers (unsupported)</strong></div>
<ul>
<li class="level2"><div class="li"> <a href="/pnp-0.6/ndo2pnp" class="wikilink1" title="pnp-0.6:ndo2pnp">NDO to PNP</a></div>
</li>
</ul>
</li>
</ul>
</div>
<!-- SECTION "Documentation" [1100-] -->

View File

@@ -0,0 +1,87 @@
<h1><a name="timeranges" id="timeranges">Timeranges</a></h1>
<div class="level1">
<p>
In the overview PNP shows five timeranges which can be defined in config.php.
</p>
<p>
Additionally you can influence the timeranges via the <acronym title="Uniform Resource Locator">URL</acronym>. This can be useful to automatically create <acronym title="Portable Document Format">PDF</acronym> documents. The ranges can be defined using the options “start” and “end”.
</p>
<p>
Example:
</p>
<pre class="code"> pnp4nagios/graph?host=&lt;hostname&gt;&amp;srv=&lt;servicedesc&gt;&amp;start=-1week</pre>
<p>
The graph will start one week prior to the current date and time. It will end at the current timestamp.
</p>
<table class="inline">
<tr class="row0">
<th class="col0"> start </th><th class="col1"> end </th><th class="col2"> view </th><th class="col3"> result </th>
</tr>
<tr class="row1">
<td class="col0 leftalign"> </td><td class="col1 leftalign"> </td><td class="col2 leftalign"> </td><td class="col3">all views ending at current timestamp </td>
</tr>
<tr class="row2">
<td class="col0 centeralign"> x </td><td class="col1 leftalign"> </td><td class="col2 leftalign"> </td><td class="col3">all views starting at defined date </td>
</tr>
<tr class="row3">
<td class="col0 leftalign"> </td><td class="col1 centeralign"> x </td><td class="col2 leftalign"> </td><td class="col3">all views ending at defined date </td>
</tr>
<tr class="row4">
<td class="col0 centeralign"> x </td><td class="col1 centeralign"> x </td><td class="col2 leftalign"> </td><td class="col3">one view between the two dates </td>
</tr>
<tr class="row5">
<td class="col0 leftalign"> </td><td class="col1 leftalign"> </td><td class="col2 centeralign"> x </td><td class="col3">one view ending at current timestamp </td>
</tr>
<tr class="row6">
<td class="col0 centeralign"> x </td><td class="col1 leftalign"> </td><td class="col2 centeralign"> x </td><td class="col3">one view starting at defined date </td>
</tr>
<tr class="row7">
<td class="col0 leftalign"> </td><td class="col1 centeralign"> x </td><td class="col2 centeralign"> x </td><td class="col3">one view ending at defined date </td>
</tr>
</table>
<p>
Examples of different specifications
</p>
<table class="inline">
<tr class="row0">
<th class="col0 centeralign"> format </th><th class="col1"> description </th>
</tr>
<tr class="row1">
<td class="col0 leftalign"> 2009W04 </td><td class="col1"> 4. week of 2009 </td>
</tr>
<tr class="row2">
<td class="col0 leftalign"> 1.5.2009 </td><td class="col1"> May, 1st 2009 </td>
</tr>
<tr class="row3">
<td class="col0 leftalign"> -1 day </td><td class="col1"> one day back </td>
</tr>
<tr class="row4">
<td class="col0 leftalign"> -3 weeks </td><td class="col1"> 3 weeks back </td>
</tr>
<tr class="row5">
<td class="col0 leftalign"> -1 year </td><td class="col1 leftalign"> one year back </td>
</tr>
<tr class="row6">
<td class="col0"> yesterday </td><td class="col1"> yesterday </td>
</tr>
</table>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/pages" class="wikilink1" title="pnp-0.6:pages">pages</a>
</p>
</div>

View File

@@ -0,0 +1,240 @@
<h1><a name="what_are_templates" id="what_are_templates">What are templates?</a></h1>
<div class="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>
<!-- SECTION "What are templates?" [1-297] -->
<h2><a name="what_template_will_be_used_when" id="what_template_will_be_used_when">What template will be used when?</a></h2>
<div class="level2">
<p>
Templates are stored at two places in the file system.
</p>
<ul>
<li class="level1"><div class="li"> share/templates.dist - for templates included in the PNP package</div>
</li>
<li class="level1"><div class="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 <acronym title="Extensible Markup Language">XML</acronym> file <code>perfdata/localhost/http.xml</code> and read its contents. The <acronym title="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 <acronym title="Extensible Markup Language">XML</acronym> tag <code>&lt;TEMPLATE&gt;</code> identifies which PNP template will be used for this graph.
</p>
<p>
<code><strong>/localhost/http.xml</strong></code>
</p>
<pre class="code xml"><span class="sc3"><span class="re1">&lt;NAGIOS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;TEMPLATE<span class="re2">&gt;</span></span></span>check_http<span class="sc3"><span class="re1">&lt;/TEMPLATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DS<span class="re2">&gt;</span></span></span>1<span class="sc3"><span class="re1">&lt;/DS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAME<span class="re2">&gt;</span></span></span>time<span class="sc3"><span class="re1">&lt;/NAME<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;UNIT<span class="re2">&gt;</span></span></span>s<span class="sc3"><span class="re1">&lt;/UNIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;ACT<span class="re2">&gt;</span></span></span>0.006721<span class="sc3"><span class="re1">&lt;/ACT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;WARN<span class="re2">&gt;</span></span></span>1.000000<span class="sc3"><span class="re1">&lt;/WARN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;CRIT<span class="re2">&gt;</span></span></span>2.000000<span class="sc3"><span class="re1">&lt;/CRIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MIN<span class="re2">&gt;</span></span></span>0.000000<span class="sc3"><span class="re1">&lt;/MIN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MAX<span class="re2">&gt;</span></span><span class="re1">&lt;/MAX<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;TEMPLATE<span class="re2">&gt;</span></span></span>check_http<span class="sc3"><span class="re1">&lt;/TEMPLATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DS<span class="re2">&gt;</span></span></span>2<span class="sc3"><span class="re1">&lt;/DS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAME<span class="re2">&gt;</span></span></span>size<span class="sc3"><span class="re1">&lt;/NAME<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;UNIT<span class="re2">&gt;</span></span></span>B<span class="sc3"><span class="re1">&lt;/UNIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;ACT<span class="re2">&gt;</span></span></span>263<span class="sc3"><span class="re1">&lt;/ACT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;WARN<span class="re2">&gt;</span></span><span class="re1">&lt;/WARN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;CRIT<span class="re2">&gt;</span></span><span class="re1">&lt;/CRIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MIN<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/MIN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MAX<span class="re2">&gt;</span></span><span class="re1">&lt;/MAX<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/DATASOURCE<span class="re2">&gt;</span></span></span>
...
<span class="sc3"><span class="re1">&lt;/NAGIOS<span class="re2">&gt;</span></span></span></pre>
<p>
PNP will append <code>.php</code> to the string and therefore look for a template with the name <code>check_http.php</code> in the following sequence:
</p>
<ol>
<li class="level1"><div class="li"> templates/check_http.php</div>
</li>
<li class="level1"><div class="li"> templates.dist/check_http.php</div>
</li>
<li class="level1"><div class="li"> templates/default.php</div>
</li>
<li class="level1"><div class="li"> templates.dist/default.php</div>
</li>
</ol>
<p>
The template default.php takes an exceptional position as it is used every time no other applicable template is found.
</p>
</div>
<!-- SECTION "What template will be used when?" [298-1879] -->
<h2><a name="creating_own_templates" id="creating_own_templates">Creating own templates</a></h2>
<div class="level2">
<p>
PNP templates are <acronym title="Hypertext Preprocessor">PHP</acronym> files which are included during execution of PNP using the <acronym title="Hypertext Preprocessor">PHP</acronym> function include(). This means that every <acronym title="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>
<li class="level1"><div class="li"> templates must contain valid <acronym title="Hypertext Preprocessor">PHP</acronym> code.</div>
</li>
<li class="level1"><div class="li"> templates must not create any output.</div>
</li>
<li class="level1"><div class="li"> the two arrays $opt[] and $def[] have to be filled</div>
</li>
</ol>
<p>
These two arrays are used to call <code>&#039;rrdtool graph</code>&#039; so every option is possible that RRDtool supports. All options of RRDtool are described very thoroughly on the <a href="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 <acronym title="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.
</p>
<pre class="code php"><span class="kw2">&lt;?php</span>
<span class="co2">#
</span><span class="re0">$opt</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;--title <span class="es1">\&quot;</span>Response Time For <span class="es4">$hostname</span> / <span class="es4">$servicedesc</span><span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="co2">#
</span><span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;DEF:var1=<span class="es4">$RRDFILE[1]</span>:<span class="es4">$DS[1]</span>:AVERAGE &quot;</span> <span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;AREA:var1#00FF00:<span class="es1">\&quot;</span>Response Times <span class="es1">\&quot;</span> &quot;</span> <span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;LINE1:var1#000000 &quot;</span> <span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;GPRINT:var1:LAST:<span class="es1">\&quot;</span>%3.4lg <span class="es6">%s</span><span class="es4">$UNIT[1]</span> LAST <span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;GPRINT:var1:MAX:<span class="es1">\&quot;</span>%3.4lg <span class="es6">%s</span><span class="es4">$UNIT[1]</span> MAX <span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">.=</span> <span class="st0">&quot;GPRINT:var1:AVERAGE:<span class="es1">\&quot;</span>%3.4lg <span class="es6">%s</span><span class="es4">$UNIT[1]</span> AVERAGE <span class="es1">\&quot;</span> &quot;</span><span class="sy0">;</span>
<span class="sy1">?&gt;</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 <a href="http://en.wikipedia.org/wiki/printf" class="interwiki iw_wp" title="http://en.wikipedia.org/wiki/printf">printf</a> syntax.
</p>
</div>
<!-- SECTION "Creating own templates" [1880-4617] -->
<h2><a name="available_variables" id="available_variables">Available variables</a></h2>
<div class="level2">
<p>
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 <acronym title="Extensible Markup Language">XML</acronym> file associated to the appropriate service.
</p>
<p>
In the first part of the <acronym title="Extensible Markup Language">XML</acronym> file the performance data is stored in separate components.
</p>
<pre class="code xml"><span class="sc3"><span class="re1">&lt;NAGIOS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DATASOURCE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;TEMPLATE<span class="re2">&gt;</span></span></span>check_http<span class="sc3"><span class="re1">&lt;/TEMPLATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;DS<span class="re2">&gt;</span></span></span>1<span class="sc3"><span class="re1">&lt;/DS<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAME<span class="re2">&gt;</span></span></span>time<span class="sc3"><span class="re1">&lt;/NAME<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;UNIT<span class="re2">&gt;</span></span></span>s<span class="sc3"><span class="re1">&lt;/UNIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;ACT<span class="re2">&gt;</span></span></span>0.006721<span class="sc3"><span class="re1">&lt;/ACT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;WARN<span class="re2">&gt;</span></span></span>1.000000<span class="sc3"><span class="re1">&lt;/WARN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;CRIT<span class="re2">&gt;</span></span></span>2.000000<span class="sc3"><span class="re1">&lt;/CRIT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MIN<span class="re2">&gt;</span></span></span>0.000000<span class="sc3"><span class="re1">&lt;/MIN<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;MAX<span class="re2">&gt;</span></span><span class="re1">&lt;/MAX<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/DATASOURCE<span class="re2">&gt;</span></span></span>
....
<span class="sc3"><span class="re1">&lt;/NAGIOS<span class="re2">&gt;</span></span></span></pre>
<p>
The field &lt;DS&gt; 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 <acronym title="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.
</p>
<pre class="code xml"><span class="sc3"><span class="re1">&lt;NAGIOS<span class="re2">&gt;</span></span></span>
...
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICENOTIFICATIONID<span class="re2">&gt;</span></span></span>8418<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICENOTIFICATIONID<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICENOTIFICATIONNUMBER<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICENOTIFICATIONNUMBER<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEOUTPUT<span class="re2">&gt;</span></span></span>HTTP OK HTTP/1.1 200 OK - 10087 bytes in 0.125 seconds<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEOUTPUT<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPERCENTCHANGE<span class="re2">&gt;</span></span></span>0.00<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEPERCENTCHANGE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPERFDATA<span class="re2">&gt;</span></span></span>time=0.124811s;;;0.000000 size=10087B;;;0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEPERFDATA<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPERFDATAFILE<span class="re2">&gt;</span></span><span class="re1">&lt;/NAGIOS_SERVICEPERFDATAFILE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICEPROBLEMID<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICEPROBLEMID<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICESTATE<span class="re2">&gt;</span></span></span>OK<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICESTATE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICESTATEID<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICESTATEID<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SERVICESTATETYPE<span class="re2">&gt;</span></span></span>HARD<span class="sc3"><span class="re1">&lt;/NAGIOS_SERVICESTATETYPE<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;NAGIOS_SHORTDATETIME<span class="re2">&gt;</span></span></span>27-12-2007 13:51:23<span class="sc3"><span class="re1">&lt;/NAGIOS_SHORTDATETIME<span class="re2">&gt;</span></span></span>
...
<span class="sc3"><span class="re1">&lt;/NAGIOS<span class="re2">&gt;</span></span></span></pre>
<p>
The various <acronym title="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>&lt;NAGIOS_SERVICEOUTPUT&gt;</code> is available as the variable <code>$NAGIOS_SERVICEOUTPUT</code>.
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/tpl_custom" class="wikilink1" title="pnp-0.6:tpl_custom">custom templates</a>
</p>
</div>
<!-- SECTION "Available variables" [4618-] -->

View File

@@ -0,0 +1,323 @@
<h1><a name="custom_templates" id="custom_templates">Custom Templates</a></h1>
<div class="level1">
<p>
As already described under ”<a href="/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 (&lt;check_command&gt;;.cfg) in the etc/check_commands directory and read its contents (if available).
The following options can be defined in it:
</p>
</div>
<!-- SECTION "Custom Templates" [1-477] -->
<h2><a name="custom_template" id="custom_template">CUSTOM_TEMPLATE</a></h2>
<div class="level2">
<p>
Outgoing from the following example of a Nagios command-definition:
</p>
<pre class="code">
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a &quot;$ARG2$&quot;
}
</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>
<pre class="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.
</p>
</div>
<!-- SECTION "CUSTOM_TEMPLATE" [478-1657] -->
<h2><a name="datatype" id="datatype">DATATYPE</a></h2>
<div class="level2">
<p>
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.
</p>
<p>
To set all datasources to COUNTER
</p>
<pre class="code">DATATYPE = COUNTER</pre>
<p>
Setting datasources to different types
</p>
<pre class="code">DATATYPE = GAUGE,GAUGE,COUNTER,COUNTER</pre>
<p>
More datatypes are explained in the RRDTool documentation found at <a href="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>
<!-- SECTION "DATATYPE" [1658-2296] -->
<h2><a name="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>
<div class="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 <a href="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>
<pre class="code">USE_MAX_ON_CREATE = 1</pre>
<p>
Account for the minimum value taken from the performance data
</p>
<pre class="code">USE_MIN_ON_CREATE = 1</pre>
<p>
This option has effect only during creation of the RRD database.
</p>
</div>
<!-- SECTION "USE_MIN_ON_CREATE and USE_MAX_ON_CREATE" [2297-2858] -->
<h2><a name="rrd_storage_type" id="rrd_storage_type">RRD_STORAGE_TYPE</a></h2>
<div class="level2">
<pre class="code">RRD_STORAGE_TYPE = SINGLE</pre>
<p>
The option RRD_STORAGE_TYPE defines the kind of data storage.
</p>
<p>
Possible values are MULTIPLE and SINGLE, respectively.
</p>
<p>
SINGLE: A RRD database per service
</p>
<p>
MULTIPLE: One or more RRD databases per service. Each datasource will be stored in a separate RRD database.
</p>
<p>
<strong>ATTENTION:</strong> The data will not be migrated automatically!
You will find a conversion script <a href="/pnp-0.6/rrd_convert" class="wikilink1" title="pnp-0.6:rrd_convert">here</a>.
</p>
<p>
This option has effect only during creation of the RRD database.
</p>
</div>
<!-- SECTION "RRD_STORAGE_TYPE" [2859-3374] -->
<h2><a name="rrd_heartbeat" id="rrd_heartbeat">RRD_HEARTBEAT</a></h2>
<div class="level2">
<p>
<strong>Starting with PNP 0.6.1</strong>
</p>
<pre class="code">RRD_HEARTBEAT = 305</pre>
<p>
After &lt;RRD_HEARTBEAT&gt; seconds RRDtool expects new data.
</p>
<p>
More information at <a href="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>
<!-- SECTION "RRD_HEARTBEAT" [3375-3660] -->
<h2><a name="hints_on_template_names" id="hints_on_template_names">Hints on Template Names</a></h2>
<div class="level2">
<p>
In most situations, one can easily get desired template names, by using suitable command object definitions.
</p>
<p>
Consider the followng example:
</p>
<pre class="code">
define command {
command_name check_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$
}
</pre>
<p>
with commands like:
</p>
<pre class="code">
check_command check_by_ssh!/usr/lib/nagios/plugins/check_load -w 4,4,4 -c 5,5,5
</pre>
<p>
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:
</p>
<pre class="code">
define command {
command_name check_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$ $ARG2$
}
</pre>
<p>
with commands like:
</p>
<pre class="code">
check_command check_by_ssh!/usr/lib/nagios/plugins/check_load!-w 4,4,4 -c 5,5,5
</pre>
<p>
(notice the additional “!”)
</p>
<p>
This even works, when $ARG2$ is let empty.
</p>
<p>
Of course one would still need to set “CUSTOM_TEMPLATE = 1”.
</p>
<p>
<strong>Solution 2: Hide the remote executor inside the command object definition</strong>
</p>
<p>
Another way is to “hide” the remote excutor in the respective command object definitions.
</p>
<p>
Instead of defining:
</p>
<pre class="code">
define command {
command_name check_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$ $ARG2$
}
</pre>
<p>
one would define the following for <strong>every</strong> command to be remotely executed:
</p>
<pre class="code">
define command {
command_name check_load_by_ssh
command_line /usr/bin/ssh $HOSTADDRESS$ /usr/lib/nagios/plugins/check_load $ARG1$
}
</pre>
<p>
with commands like:
</p>
<pre class="code">
check_load_by_ssh!-w 4,4,4 -c 5,5,5
</pre>
<p>
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>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/advanced" class="wikilink1" title="pnp-0.6:advanced">PNP in distributed environments</a>
</p>
</div>
<!-- SECTION "Hints on Template Names" [3661-] -->

View File

@@ -0,0 +1,247 @@
<h1><a name="template_helper_functions" id="template_helper_functions">Template Helper Functions</a></h1>
<div class="level1">
<p>
Helper functions are meant to simplify the creation of templates and trap errors
</p>
</div>
<!-- SECTION "Template Helper Functions" [1-123] -->
<h2><a name="rrddef" id="rrddef">rrd::def</a></h2>
<div class="level2">
<p>
string <strong>rrd::def</strong> ( $vname, $rrdfile, $ds, [ $cf=&#039;AVERAGE&#039; ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">def</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="re0">$RRDFILE</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$DS</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st_h">'MAX'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html</a>
</p>
</div>
<!-- SECTION "rrd::def" [124-342] -->
<h2><a name="rrdcdef" id="rrdcdef">rrd::cdef</a></h2>
<div class="level2">
<p>
string <strong>rrd::cdef</strong> ( $vname, $rpn, )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cdef</span><span class="br0">&#40;</span><span class="st_h">'var1_bits'</span><span class="sy0">,</span> <span class="st_h">'var1,8,*'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html</a>
</p>
</div>
<!-- SECTION "rrd::cdef" [343-527] -->
<h2><a name="rrdvdef" id="rrdvdef">rrd::vdef</a></h2>
<div class="level2">
<p>
string <strong>rrd::vdef</strong> ( $vname, $rpn, )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">vdef</span><span class="br0">&#40;</span><span class="st_h">'var1_avg'</span><span class="sy0">,</span> <span class="st_h">'var1,AVERAGE'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html</a>
</p>
</div>
<!-- SECTION "rrd::vdef" [528-715] -->
<h2><a name="rrdline_1-3" id="rrdline_1-3">rrd::line[1-3]</a></h2>
<div class="level2">
<p>
string <strong>rrd::line[1-3]</strong> ( $vname, $color, [ $text ], [ $stack ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line1</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="co2">#ff00ff );</span></pre>
<p>
Draws a simple line one pixel wide without label
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line3</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'#ff00ff'</span><span class="sy0">,</span> <span class="st_h">'Load'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Draws a line three pixels wide with label “Load”
</p>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html</a>
</p>
</div>
<!-- SECTION "rrd::line[1-3]" [716-1098] -->
<h2><a name="rrdarea" id="rrdarea">rrd::area</a></h2>
<div class="level2">
<p>
string <strong>rrd::area</strong> ( $vname, $color, [ $text ], [ $stack ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">area</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'#ff00ff'</span><span class="sy0">,</span> <span class="st_h">'Load'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Draws an area with label “Load”
</p>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html</a>
</p>
</div>
<!-- SECTION "rrd::area" [1099-1344] -->
<h2><a name="rrdgprint" id="rrdgprint">rrd::gprint</a></h2>
<div class="level2">
<p>
string <strong>rrd::gprint</strong> ( $vname, $cf, [ $text ] )
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'MAX'</span><span class="sy0">,</span> <span class="st_h">'%4.2lf %s Max'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st_h">'MIN'</span><span class="sy0">,</span> <span class="st_h">'MAX'</span><span class="sy0">,</span> <span class="st_h">'AVERAGE'</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="st_h">'%4.2lf %s'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
If $cf is an array the legend will be formatted automatically
</p>
<p>
<a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" class="urlextern" title="http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html" rel="nofollow">http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html</a>
</p>
</div>
<!-- SECTION "rrd::gprint" [1345-1712] -->
<h2><a name="rrdcolor" id="rrdcolor">rrd::color</a></h2>
<div class="level2">
<p>
string <strong>rrd::color</strong> ( $num [, $num])
</p>
<p>
Returns a color from the <acronym title="HyperText Markup Language">HTML</acronym> color table. The second (optional) argument allows to specify an alpha value used to set the transparency of the selected color.
</p>
<p>
Starting with PNP 0.6.18 the function accepts a third argument which refers to colour scheme definitions in <code>config.php</code> (or <code>config_local.php</code> which is update safe). There you can find the array $scheme[], e.g.
</p>
<pre class="code">$scheme[&#039;Reds&#039;] = array (...)</pre>
<p>
Within the template you define
</p>
<pre class="code">$schema = $this-&gt;config-&gt;scheme[&#039;Reds&#039;];
...
rrd::color ($key, &#039;&#039;, $schema);</pre>
<p>
This way you select the value taken from $scheme[&#039;Reds&#039;][$key]. If $key is not within the array or you misspelled the name (<strong>case sensitive</strong>) then the default colour palette is used.
</p>
</div>
<!-- SECTION "rrd::color" [1713-2500] -->
<h2><a name="rrdgradient" id="rrdgradient">rrd::gradient</a></h2>
<div class="level2">
<p>
string <strong>rrd::gradient</strong> ( $vname, [$start_color], [$end_color], [$label], [$steps], [$lower] )
</p>
<p>
Creates a color gradient from $start_color to $end_color
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gradient</span><span class="br0">&#40;</span><span class="st_h">'var1'</span><span class="sy0">,</span> <span class="st_h">'#ff0000'</span><span class="sy0">,</span> <span class="st_h">'#ffff00'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/gradient" class="wikilink1" title="templates:gradient">Example</a>
</p>
</div>
<!-- SECTION "rrd::gradient" [2501-2788] -->
<h2><a name="rrdcut" id="rrdcut">rrd::cut</a></h2>
<div class="level2">
<p>
string <strong>rrd::cut</strong> ( $text, $length )
</p>
<pre class="code php"><span class="re0">$label</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cut</span><span class="br0">&#40;</span><span class="re0">$LABEL</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> 18<span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Cuts a text to a given length $length or fills it up to $length if needed.<br/>
This function is helpful if legend needs to be justified but length of label is unknown.
</p>
</div>
<!-- SECTION "rrd::cut" [2789-3073] -->
<h2><a name="rrdticker" id="rrdticker">rrd::ticker</a></h2>
<div class="level2">
<p>
string <strong>rrd::ticker</strong> ( $vname, $warning, $critical, [$fraction], [$opacity], [$color_OK], [$color_WARN], [$color_CRIT] )
</p>
<p>
Creates a colorized bar at the top of the chart which shows different colors depending on states OK, WARNING &amp; CRITICAL
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">ticker</span><span class="br0">&#40;</span> <span class="st0">&quot;var1&quot;</span><span class="sy0">,</span> <span class="re0">$WARN</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$CRIT</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/ticker" class="wikilink1" title="templates:ticker">Example</a>
</p>
</div>
<!-- SECTION "rrd::ticker" [3074-3444] -->
<h2><a name="rrdalerter" id="rrdalerter">rrd::alerter</a></h2>
<div class="level2">
<p>
string <strong>rrd::alerter</strong> ( $vname, $label, $warning, $critical, [$opacity], [$unit], [$color_OK], [$color_WARN], [$color_CRIT], [$line_col] )
</p>
<p>
Creates colorized areas, which show different colors depending on states OK, WARNING &amp; CRITICAL
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">alerter</span><span class="br0">&#40;</span> <span class="st0">&quot;var1&quot;</span><span class="sy0">,</span> <span class="re0">$LABEL</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$WARN</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$CRIT</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st0">&quot;FF&quot;</span><span class="sy0">,</span> <span class="re0">$UNIT</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/alerter" class="wikilink1" title="templates:alerter">Example</a>
</p>
</div>
<!-- SECTION "rrd::alerter" [3445-3839] -->
<h2><a name="rrdalerter_gr" id="rrdalerter_gr">rrd::alerter_gr</a></h2>
<div class="level2">
<p>
string <strong>rrd::alerter_gr</strong> ( $vname, $label, $warning, $critical, [$opacity], [$unit], [$color_OK], [$color_WARN], [$color_CRIT], [$line_col], [$start_color] )
</p>
<p>
Creates colorized gradients, which show different colors depending on states OK, WARNING &amp; CRITICAL
</p>
<pre class="code php"><span class="re0">$def</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">alerter_gr</span><span class="br0">&#40;</span> <span class="st0">&quot;var1&quot;</span><span class="sy0">,</span> <span class="re0">$LABEL</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$WARN</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$CRIT</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st0">&quot;FF&quot;</span><span class="sy0">,</span> <span class="re0">$UNIT</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
<a href="/templates/alerter_gr" class="wikilink1" title="templates:alerter_gr">Example</a>
</p>
</div>
<!-- SECTION "rrd::alerter_gr" [3840-] -->

View File

@@ -0,0 +1,90 @@
<h1><a name="pnp_helper_functions" id="pnp_helper_functions">PNP Helper Functions</a></h1>
<div class="level1">
<p>
PNP Helper functions are meant to simplify the creation of templates. In contrast to the rrd helper functions they don&#039;t call existing RRDtool functions.
</p>
</div>
<!-- SECTION "PNP Helper Functions" [1-191] -->
<h2><a name="pnpadjust_unit" id="pnpadjust_unit">pnp::adjust_unit</a></h2>
<div class="level2">
<p>
(string,number,string,number) <strong>pnp::adjust_unit</strong> ( $value, $base=1000, $format=&#039;%.3lf&#039; )
</p>
<p>
The purpose of this function is to “normalize” large numbers. Modern hard disks have reached sizes of several <acronym title="Gigabyte">GB</acronym> or TB and looking at numbers like 1521073648234 you begin to count the digits so it would be more convienient to translate the value. The same applies to network traffic.
</p>
<p>
The function takes up to three parameters and returns an array with four elements in any case.
</p>
<ul>
<li class="level1"><div class="li"> The first parameter to be passed is the number (including an “UOM”, if applicable)</div>
</li>
<li class="level1"><div class="li"> The second parameter is optional and defaults to “1000” (e.g. traffic), but might be “1024” (e.g. disk size) as well</div>
</li>
<li class="level1"><div class="li"> The third parameter is optional, defaults to &#039;%.3lf&#039;, and specifies the format of the value to be returned</div>
</li>
</ul>
<pre class="code php"><span class="re0">$size</span> <span class="sy0">=</span> pnp<span class="sy0">::</span><span class="me2">adjust_unit</span><span class="br0">&#40;</span><span class="nu0">1521073648234</span><span class="sy0">,</span><span class="nu0">1024</span><span class="sy0">,</span><span class="st_h">'%7.3lf'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Please note that “$size” is an array consisting of four fields:
</p>
<pre class="code"> $size[0] := &quot; 1.383 T&quot;</pre>
<p>
contains the formatted value including the unit
</p>
<pre class="code"> $size[1] := &quot;1.383&quot;</pre>
<p>
contains the formatted number
</p>
<pre class="code"> $size[2] := &quot;T&quot;</pre>
<p>
contains the unit
</p>
<pre class="code"> $size[3] := &quot;1099511627776&quot;</pre>
<p>
contains the divisor
</p>
<p>
Assuming check_disk returns “<acronym title="Megabyte">MB</acronym>” as UOM you can append that as well
</p>
<pre class="code php"><span class="re0">$disk</span> <span class="sy0">=</span> pnp<span class="sy0">::</span><span class="me2">adjust_unit</span><span class="br0">&#40;</span><span class="st0">&quot;1524MB&quot;</span><span class="sy0">,</span><span class="nu0">1024</span><span class="sy0">,</span><span class="st_h">'%7.3lf'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
will result in
$disk[0] := “1.448 <acronym title="Gigabyte">GB</acronym>
</p>
<p>
<a href="/_detail/templates/check_disk_1.png?id=pnp-0.6%3Atpl_helper_pnp" class="media" title="templates:check_disk_1.png"><img src="/_media/templates/check_disk_1.png" class="media" alt="" /></a><br/>
“old” check_disk template with %s directive<br/>
</p>
<p>
<a href="/_detail/templates/check_disk_2.png?id=pnp-0.6%3Atpl_helper_pnp" class="media" title="templates:check_disk_2.png"><img src="/_media/templates/check_disk_2.png" class="media" alt="" /></a><br/>
“new” check_disk template with pnp::adjust_unit
</p>
</div>
<!-- SECTION "pnp::adjust_unit" [192-] -->

View File

@@ -0,0 +1,187 @@
<h1><a name="special_templates" id="special_templates">Special templates</a></h1>
<div class="level1">
<p>
“special templates” (starting with PNP 0.6.5) are used to combine data from arbitrary hosts and services and thus are not connected directly to a host or service.
</p>
<p>
Often it is desired to show data from several services in one graph. Every time the <a href="/pnp-0.6/pages" class="wikilink1" title="pnp-0.6:pages">&quot;pages&quot;</a> will not be sufficient the special templates may come into play.
</p>
</div>
<!-- SECTION "Special templates" [1-365] -->
<h2><a name="basics" id="basics">Basics</a></h2>
<div class="level2">
<p>
“Special templates” will be searched in <code>pnp4nagios/share/templates.special</code> and must have the extension <code>.php</code>.
</p>
<p>
They are called via the controller “special” using
</p>
<pre class="code">http://&lt;your-nagios-server&gt;/pnp4nagios/special?tpl=&lt;template&gt;</pre>
<p>
<code>&lt;template&gt;</code> is to be replaced with the particular template without the extension .php.
</p>
<p>
An appropriate link will be shown in the PNP interface if at least one “special template” was found.
</p>
</div>
<!-- SECTION "Basics" [366-815] -->
<h2><a name="example" id="example">Example</a></h2>
<div class="level2">
<p>
The task is to show the response times of all web servers with hostnames websrv, websrv02, and websrv03 in one graph. The data is provided by the service “<acronym title="Hyper Text Transfer Protocol">HTTP</acronym>”.
</p>
<p>
Step 1: create a template “websrv_response_times.php” in the folder <code>pnp4nagios/share/templates.special</code>
</p>
<p>
“Special templates” always start with the definition of a title and a comment.
</p>
<pre class="code php"><span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'TITLE'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times&quot;</span><span class="sy0">;</span>
<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'COMMENT'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times for all Cluster Nodes&quot;</span><span class="sy0">;</span></pre>
<p>
Step 2: create a list of all hosts/services which come into question. PNP provides a function <code>tplGetServices()</code> to accomplish this task.
</p>
<p>
tplGetServices() expects two parameters.
</p>
<p>
Parameter 1 is a regular expression for the host(s), parameter 2 a regular expression for the service(s).
</p>
<pre class="code php"><span class="re0">$services</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetServices</span><span class="br0">&#40;</span><span class="st0">&quot;websrv&quot;</span><span class="sy0">,</span><span class="st0">&quot;HTTP&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
$services now is an array with all services found.
</p>
<p>
To ease template development and to give an insight on the data structures you can force Kohana to stop processing using an exception.
</p>
<p>
To show the data of $services you just need the following line:
</p>
<pre class="code php">throw <span class="kw2">new</span> Kohana_exception<span class="br0">&#40;</span><a href="http://www.php.net/print_r"><span class="kw3">print_r</span></a><span class="br0">&#40;</span><span class="re0">$services</span><span class="sy0">,</span><span class="kw4">TRUE</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
<p>
Output of pnp4nagios/special?tpl=websrv_response_times
</p>
<pre class="code">
Array (
[0] =&gt; Array (
[host] =&gt; websrv01
[service] =&gt; HTTP
)
[1] =&gt; Array (
[host] =&gt; websrv02
[service] =&gt; HTTP
)
[2] =&gt; Array (
[host] =&gt; websrv03
[service] =&gt; HTTP
)
)
</pre>
<p>
The variable $services contains an array with all services found, in this case three hosts with the service “<acronym title="Hyper Text Transfer Protocol">HTTP</acronym>”.
</p>
<p>
Step 3: Iterating the array $services and creating the graph definitions
</p>
<pre class="code php"><span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$services</span> <span class="kw1">as</span> <span class="re0">$key</span><span class="sy0">=&gt;</span><span class="re0">$val</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
<span class="re0">$data</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetData</span><span class="br0">&#40;</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'host'</span><span class="br0">&#93;</span><span class="sy0">,</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'service'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$hostname</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cut</span><span class="br0">&#40;</span><span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'MACRO'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'HOSTNAME'</span><span class="br0">&#93;</span><span class="sy0">,</span> 15<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">def</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span> <span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'RRDFILE'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line1</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> rrd<span class="sy0">::</span><span class="me2">color</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="re0">$hostname</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&quot;MAX&quot;</span><span class="sy0">,</span> <span class="st0">&quot;AVERAGE&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre>
<p>
Inside the loop the function <code>tplGetData</code> is used to read the particular <acronym title="Extensible Markup Language">XML</acronym> file. The data is returned as an array called $data.
</p>
<p>
In this example some other little PNP helpers are used recognisable by the extension <code>rrd::</code>.
</p>
<p>
The function <a href="/pnp-0.6/tpl_helper#rrdcut" class="wikilink1" title="pnp-0.6:tpl_helper">rrd::cut()</a> cuts a string to a specific length or fills up to this length. This might be helpful to align the legend.
</p>
<p>
The function <a href="/pnp-0.6/tpl_helper#rrdgprint" class="wikilink1" title="pnp-0.6:tpl_helper">rrd::gprint()</a> creates the legend below the graph.
</p>
<p>
The function <a href="/pnp-0.6/tpl_helper#rrdcolor" class="wikilink1" title="pnp-0.6:tpl_helper">rrd::color()</a> returns a colour from a predefined list of colours.
</p>
<p>
You will find more information on the PNP helpers <a href="/pnp-0.6/tpl_helper" class="wikilink1" title="pnp-0.6:tpl_helper">here</a>.
</p>
<pre class="code php"><span class="kw2">&lt;?php</span>
<span class="co2">#
</span><span class="co2"># Special Template websrv_response_times.php
</span><span class="co2">#
</span><span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'TITLE'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times&quot;</span><span class="sy0">;</span>
<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">MACRO</span><span class="br0">&#91;</span><span class="st_h">'COMMENT'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;HTTP Response Times for all Cluster Nodes&quot;</span><span class="sy0">;</span>
<span class="co2">#
</span><span class="co2"># Get a List of Services by regex
</span><span class="co2"># Option 1 = 'Host Regex'
</span><span class="co2"># Option 2 = 'Service Regex'
</span><span class="co2">#
</span><span class="re0">$services</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetServices</span><span class="br0">&#40;</span><span class="st0">&quot;websrv&quot;</span><span class="sy0">,</span><span class="st0">&quot;HTTP&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co2">#throw new Kohana_exception(print_r($services,TRUE));
</span><span class="co2">#
</span><span class="co2"># The Datasource Name for Graph 0
</span><span class="re0">$ds_name</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;Response Times&quot;</span><span class="sy0">;</span>
<span class="re0">$opt</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;--title <span class="es1">\&quot;</span>Response Times<span class="es1">\&quot;</span>&quot;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;&quot;</span><span class="sy0">;</span>
<span class="co2">#
</span><span class="co2"># Iterate through the list of hosts
</span><span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$services</span> <span class="kw1">as</span> <span class="re0">$key</span><span class="sy0">=&gt;</span><span class="re0">$val</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
<span class="co2">#
</span> <span class="co2"># get the data for a given Host/Service
</span> <span class="re0">$data</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">tplGetData</span><span class="br0">&#40;</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'host'</span><span class="br0">&#93;</span><span class="sy0">,</span><span class="re0">$val</span><span class="br0">&#91;</span><span class="st_h">'service'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co2">#
</span> <span class="co2"># Throw an exception to debug the content of $a
</span> <span class="co2"># Just to get Infos about the Array Structure
</span> <span class="co2">#
</span> <span class="co2">#throw new Kohana_exception(print_r($a,TRUE));
</span> <span class="re0">$hostname</span> <span class="sy0">=</span> rrd<span class="sy0">::</span><span class="me2">cut</span><span class="br0">&#40;</span><span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'MACRO'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'HOSTNAME'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">def</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span> <span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'RRDFILE'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'DS'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">line1</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> rrd<span class="sy0">::</span><span class="me2">color</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="re0">$hostname</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$def</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.=</span> rrd<span class="sy0">::</span><span class="me2">gprint</span><span class="br0">&#40;</span><span class="st0">&quot;var<span class="es4">$key</span>&quot;</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&quot;MAX&quot;</span><span class="sy0">,</span> <span class="st0">&quot;AVERAGE&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="sy1">?&gt;</span></pre>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a>
</p>
</div>
<!-- SECTION "Example" [816-] -->

View File

@@ -0,0 +1,220 @@
<h1><a name="upgrade_to_version_06x" id="upgrade_to_version_06x">Upgrade to version 0.6.x</a></h1>
<div class="level1">
<p>
The web-frontend has been completely rewritten and is now based on the <acronym title="Hypertext Preprocessor">PHP</acronym> MVC framework <a href="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&#039;t be able to use them either way.
</p>
</div>
<!-- SECTION "Upgrade to version 0.6.x" [1-1020] -->
<h2><a name="comparison_of_the_structure" id="comparison_of_the_structure">Comparison of the structure</a></h2>
<div class="level2">
<p>
Summary of a PNP 0.4.14 installation
</p>
<pre class="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
RRDs Perl Modules: FOUND (Version 1.3001)
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
</pre>
<p>
Summary of a PNP 0.6.0 installation
</p>
<pre class="code">
./configure
...
*** Configuration summary for pnp4nagios-0.6.0 07-30-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/pnp4nagios/share
Config Dir: /usr/local/pnp4nagios/etc
Location of rrdtool binary: /usr/bin/rrdtool Version 1.3.1
RRDs Perl Modules: FOUND (Version 1.3001)
RRD Files stored in: /usr/local/pnp4nagios/var/perfdata
process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options: ------------------------- -------------------
HTML URL: http://localhost/pnp4nagios/
Apache Config File: /etc/apache2/conf.d/pnp4nagios.conf
</pre>
<p>
Looking at these lines result in the parameters to be changed and the upgrade strategy.
</p>
</div>
<!-- SECTION "Comparison of the structure" [1021-2922] -->
<h2><a name="adjustments" id="adjustments">Adjustments</a></h2>
<div class="level2">
<p>
The templates of the action_url definitions have changed. Instead of ”/nagios/pnp” the <acronym title="Uniform Resource Locator">URL</acronym> should be ”/pnp4nagios” and instead of “index.php” now “graph” will be used.
</p>
<pre class="code">define host {
name host-pnp
register 0
action_url /pnp4nagios/graph?host=$HOSTNAME$
}
define service {
name srv-pnp
register 0
action_url /pnp4nagios/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
}</pre>
<p>
The definitions for the preview popup function are similar
</p>
<pre class="code">define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=_HOST_&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/index.php/popup?host=$HOSTNAME$&amp;srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/popup?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
register 0
}</pre>
<p>
<strong>Attention</strong>: It is <em>not</em> an error that the strings in front and after “class” contain only one quote.
</p>
<p>
Other than described in the 0.4.x documentation these templates can be used for Nagios 2.x and 3.x.
</p>
<p>
The variables in the files in the templates folder have to be initialised before first use. Example
</p>
<pre class="code">$lower = &quot;&quot;</pre>
<p>
Earlier you were able to append to variables which weren&#039;t initialised before first use. Example:
</p>
<pre class="code">foreach ($DS as $i) {
$def[1] .= &quot;DEF:var$i=$rrdfile:$DS[$i]:AVERAGE &quot; ;</pre>
<p>
Now you have to change that to
</p>
<pre class="code">
$def[1] = &quot;&quot;;
foreach ($DS as $i) {
$def[1] .= &quot;DEF:var$i=$rrdfile:$DS[$i]:AVERAGE &quot; ;</pre>
<p>
<br/>
Constants in template files don&#039;t work anymore, so that they have to be converted to variables.
</p>
<pre class="code">define(&quot;_WARNRULE&quot;, &#039;#FFFF00&#039;);</pre>
<p>
may be changed to
</p>
<pre class="code"> $WARNRULE = &#039;#FFFF00&#039;;</pre>
<p>
Please keep in mind that all occurrences have to be changed <img src="/lib/images/smileys/icon_wink.gif" class="middle" alt=";-)" />.
</p>
</div>
<!-- SECTION "Adjustments" [2923-4716] -->
<h2><a name="upgrade_scenario_using_npcd" id="upgrade_scenario_using_npcd">Upgrade scenario using NPCD</a></h2>
<div class="level2">
<ol>
<li class="level1"><div class="li"> planning the new setup</div>
</li>
<li class="level1"><div class="li"> perform test installation and acquaint oneself with the new system</div>
</li>
<li class="level1"><div class="li"> create backup of the old installation</div>
</li>
<li class="level1"><div class="li"> install PNP 0.6.x at <code>/usr/local/pnp4nagios</code></div>
</li>
<li class="level1"><div class="li"> make install-config</div>
</li>
<li class="level1"><div class="li"> make install-webconf</div>
</li>
<li class="level1"><div class="li"> reload Apache</div>
</li>
<li class="level1"><div class="li"> test Apache-config </div>
<ol>
<li class="level2"><div class="li"> call of <code>/pnp4nagios</code> has to report an empty perfdata directory</div>
</li>
</ol>
</li>
<li class="level1"><div class="li"> create <code>/usr/local/pnp4nagios/etc/npcd.cfg</code> from <code>npcd.cfg-sample</code></div>
<ol>
<li class="level2"><div class="li"> check paths and adapt changes from 0.4.x if necessary</div>
</li>
</ol>
</li>
<li class="level1"><div class="li"> adjust all paths in nagios.cfg to the new PNP installation </div>
</li>
<li class="level1"><div class="li"> adjust all paths in the command definitions</div>
</li>
<li class="level1"><div class="li"> stop npcd using <code>/etc/init.d/npcd stop</code></div>
</li>
<li class="level1"><div class="li"> <code>make install-init</code> installs the new init script for npcd</div>
</li>
<li class="level1"><div class="li"> <code>/etc/init.d/nagios stop</code></div>
</li>
<li class="level1"><div class="li"> copy <code>/usr/local/nagios/share/perfdata</code> to <code>/usr/local/pnp4nagios/var/perfdata</code>. Attention: check the permissions</div>
</li>
<li class="level1"><div class="li"> <code>/etc/init.d/npcd start</code></div>
</li>
<li class="level1"><div class="li"> <code>/etc/init.d/nagios start</code></div>
</li>
</ol>
</div>
<!-- SECTION "Upgrade scenario using NPCD" [4717-] -->

View File

@@ -0,0 +1,115 @@
<h1><a name="checking_the_installation" id="checking_the_installation">Checking the installation</a></h1>
<div class="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 <a href="http://%3Cserver name%3E/pnp4nagios/" class="urlextern" title="http://&lt;server name&gt;/pnp4nagios/" rel="nofollow">http://&lt;server name&gt;/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 “<acronym title="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 <acronym title="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.
</p>
</div>
<!-- SECTION "Checking the installation" [1-1380] -->
<h2><a name="debug_logfile" id="debug_logfile">Debug Logfile</a></h2>
<div class="level2">
<p>
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 <a href="/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 <a href="/pnp-0.6/verify_pnp_config" class="wikilink1" title="pnp-0.6:verify_pnp_config">verify_pnp_config</a> script so please provide them <img src="/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>
<!-- SECTION "Debug Logfile" [1381-2383] -->
<h2><a name="something_went_wrong" id="something_went_wrong">Something went wrong</a></h2>
<div class="level2">
<p>
Some basic settings should be checked
</p>
<p>
1. Have any RRD and <acronym title="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 <acronym title="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 <acronym title="Extensible Markup Language">XML</acronym> file. There are two tags called &lt;RC&gt; and &lt;TXT&gt;. &lt;RC&gt; shows the return code of the RRDtool update and &lt;TXT&gt; a textual description. <br/>
Sometimes you have to specify additional options so that performance data is produced. In some cases a <a href="/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/>
<a href="/_detail/srv_info.png?id=pnp-0.6%3Averify" class="media" title="srv_info.png"><img src="/_media/srv_info.png?w=350" class="media" title="status information" alt="status information" width="350" /></a>
</p>
<p>
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 <a href="/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 <acronym title="American Standard Code for Information Interchange">ASCII</acronym> set. Try to set <acronym title="Extensible Markup Language">XML</acronym>_ENC in <code>process_perfdata.cfg</code> to <code><acronym title="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&#039;ll find some details <a href="/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 <a href="/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/&lt;perfdata_filename&gt;-PID-&lt;process_perfdata_pid&gt;). If process_perdata.pl is not able to write to the destination directory (/usr/local/pnp4nagios/share/perfdata/&lt;host&gt;), 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>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/verify_pnp_config" class="wikilink1" title="pnp-0.6:verify_pnp_config">verify_pnp_config.pl</a>
</p>
</div>
<!-- SECTION "Something went wrong" [2384-] -->

View File

@@ -0,0 +1,132 @@
<h1><a name="verify_pnp_config" id="verify_pnp_config">verify_pnp_config</a></h1>
<div class="level1">
<p>
In case of problems there is a script called <code>verify_pnp_config.pl</code> located on <a href="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.
</p>
</div>
<!-- SECTION "verify_pnp_config" [1-292] -->
<h2><a name="download" id="download">Download</a></h2>
<div class="level2">
<pre class="code">
wget http://verify.pnp4nagios.org/verify_pnp_config
</pre>
</div>
<!-- SECTION "Download" [293-383] -->
<h2><a name="test" id="test">Test</a></h2>
<div class="level2">
<p>
The verify script is located on <a href="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>
<li class="level1"><div class="li"> <code>--mode</code> One of the modes described on <a href="/pnp-0.6/modes" class="wikilink1" title="pnp-0.6:modes">modes</a></div>
</li>
<li class="level1"><div class="li"> <code>--config</code> Location of nagios.cfg or icinga.cfg</div>
</li>
<li class="level1"><div class="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.
</p>
<p>
The following is a sample run
</p>
<pre class="code">
lenny:~# perl verify_pnp_config --mode npcdmod --config=/usr/local/nagios/etc/nagios.cfg --pnpcfg=/usr/local/pnp4nagios/etc
[INFO] ========== Starting Environment Checks ============
[INFO] My version is: verify_pnp_config-0.6.14-R.31
[INFO] Reading /usr/local/nagios/etc/nagios.cfg
[OK ] Running product is &#039;nagios&#039;
[OK ] object_cache_file is defined
[OK ] object_cache_file=/usr/local/nagios/var/objects.cache
[INFO] Reading /usr/local/nagios/var/objects.cache
[OK ] resource_file is defined
[OK ] resource_file=/usr/local/nagios/etc/resource.cfg
[INFO] Reading /usr/local/nagios/etc/resource.cfg
[INFO] Reading /usr/local/pnp4nagios/etc/process_perfdata.cfg
[INFO] Reading /usr/local/pnp4nagios/etc/pnp4nagios_release
[OK ] Found PNP4Nagios version &quot;0.6.14&quot;
[OK ] Effective User is &#039;nagios&#039;
[OK ] User nagios exists with ID &#039;1000&#039;
[OK ] Effective group is &#039;nagios&#039;
[OK ] Group nagios exists with ID &#039;1000&#039;
[INFO] ========== Checking npcdmod Mode Config ============
[OK ] process_performance_data is 1 compared with &#039;/1/&#039;
[OK ] event_broker_options is defined
[OK ] event_broker_options=-1
[OK ] event_broker_option bits 2 and 3 enabled (12)
[OK ] broker_module is defined
[OK ] broker_module=/usr/local/pnp4nagios/lib/npcdmod.o config_file=/usr/local/pnp4nagios/etc/npcd.cfg
[OK ] npcdmod.o config file is /usr/local/pnp4nagios/etc/npcd.cfg
[OK ] /usr/local/pnp4nagios/etc/npcd.cfg used by npcdmod.o is readable
[OK ] npcd daemon is running
[OK ] /usr/local/pnp4nagios/etc/npcd.cfg is used by npcd and readable
[OK ] npcd and npcdmod.o are using the same config file (/usr/local/pnp4nagios/etc/npcd.cfg)
[INFO] Nagios config looks good so far
[INFO] ========== Checking config values ============
[INFO] Reading /usr/local/pnp4nagios/etc/npcd.cfg
[OK ] Script /usr/local/pnp4nagios/libexec/process_perfdata.pl is executable
[INFO] ========== Starting global checks ============
[OK ] status_file is defined
[OK ] status_file=/dev/shm/status.dat
[INFO] Reading /dev/shm/status.dat
[INFO] ==== Starting rrdtool checks ====
[OK ] RRDTOOL is defined
[OK ] RRDTOOL=/usr/bin/rrdtool
[OK ] /usr/bin/rrdtool is executable
[OK ] RRDtool 1.3.1 Copyright 1997-2008 by Tobias Oetiker &lt;tobi@oetiker.ch&gt;
[OK ] USE_RRDs is defined
[OK ] USE_RRDs=1
[OK ] Perl RRDs modules are loadable
[INFO] ==== Starting directory checks ====
[OK ] RRDPATH is defined
[OK ] RRDPATH=/usr/local/pnp4nagios/var/perfdata
[OK ] Perfdata directory &#039;/usr/local/pnp4nagios/var/perfdata&#039; exists
[WARN] 62 hosts/services are not providing performance data
[WARN] &#039;process_perf_data 1&#039; is set for 43 hosts/services which are not providing performance data!
[WARN] &#039;process_perf_data 0&#039; is set for 27 of your hosts/services
[OK ] &#039;process_perf_data 1&#039; is set for 243 of your hosts/services
[INFO] ==== System sizing ====
[OK ] 269 hosts/service objects defined
[INFO] ==== Check statistics ====
[WARN] Warning: 3, Critical: 0
[WARN] Checks finished...
</pre>
</div>
<!-- SECTION "Test" [384-3776] -->
<h2><a name="performance_data" id="performance_data">Performance data</a></h2>
<div class="level2">
<p>
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).
</p>
</div>
<!-- SECTION "Performance data" [3777-] -->

View File

@@ -0,0 +1,149 @@
<h1><a name="nagios_web_frontend" id="nagios_web_frontend">Nagios web frontend</a></h1>
<div class="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.
</p>
</div>
<!-- SECTION "Nagios web frontend" [1-285] -->
<h2><a name="nagios_2x" id="nagios_2x">Nagios 2.x</a></h2>
<div class="level2">
<p>
With Nagios 2.x the integration of external URLs into the nagios web interface is made using Extended Info Objects for <a href="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.
</p>
<pre class="code">
define serviceextinfo {
host_name localhost
service_description load
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
}
</pre>
<p>
You have to specify an additional Extended Info Definition for every service.
</p>
</div>
<!-- SECTION "Nagios 2.x" [286-887] -->
<h2><a name="nagios_3x" id="nagios_3x">Nagios 3.x</a></h2>
<div class="level2">
<p>
Since nagios 3.0 the action_url-directive has be moved to the <a href="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 <a href="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 <a href="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 <a href="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 <a href="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:
</p>
<pre class="code">
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
register 0
}
</pre>
<p>
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>
<pre class="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>
<pre class="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>
<!-- SECTION "Nagios 3.x" [888-3214] -->
<h2><a name="popups" id="popups">Popups</a></h2>
<div class="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 <a href="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>
<li class="level1"><div class="li"> PNP is installed and running</div>
</li>
<li class="level1"><div class="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 <acronym title="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>
<li class="level1"><div class="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>
</li>
</ul>
<p>
Definition:
</p>
<pre class="code">
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=_HOST_&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/index.php/popup?host=$HOSTNAME$&amp;srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$&#039; class=&#039;tips&#039; rel=&#039;/pnp4nagios/index.php/popup?host=$HOSTNAME$&amp;srv=$SERVICEDESC$
register 0
}
</pre>
<p>
After a restart of Nagios (after modifying the definitions) the result might look like this:<br/>
<a href="/_detail/popup.png?id=pnp-0.6%3Awebfe" class="media" title="popup.png"><img src="/_media/popup.png?w=200" class="media" alt="" width="200" /></a>
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/webfe_cfg" class="wikilink1" title="pnp-0.6:webfe_cfg">config options</a>
</p>
</div>
<!-- SECTION "Popups" [3215-] -->

View File

@@ -0,0 +1,136 @@
<h1><a name="pnp_web_frontend" id="pnp_web_frontend">PNP Web Frontend</a></h1>
<div class="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.
</p>
</div>
<!-- SECTION "PNP Web Frontend" [1-385] -->
<h2><a name="etcconfigphp" id="etcconfigphp">etc/config.php</a></h2>
<div class="level2">
<p>
Following the most important parameters:
</p>
<p>
The path to the RRDtool binary. Will be detected by <code>./configure</code>
</p>
<pre class="code"> $conf[&#039;rrdtool&#039;] = &quot;/usr/bin/rrdtool&quot;;</pre>
<p>
Height and width of the RRD graphs
</p>
<pre class="code"> $conf[&#039;graph_width&#039;] = &quot;500&quot;;
$conf[&#039;graph_height&#039;] = &quot;100&quot;;</pre>
<p>
Screen sizes may vary, pages sizes won&#039;t. The following two directives enable you to specify different sizes for the creation of PDFs. If they aren&#039;t specified the values of the graph sizes are taken.
</p>
<pre class="code"> $conf[&#039;pdf_width&#039;] = &quot;675&quot;;
$conf[&#039;pdf_height&#039;] = &quot;100&quot;;</pre>
<p>
Additional options passed with every call of RRDTool, for example <code>--slope-mode</code> to smooth the graphs
</p>
<pre class="code"> $conf[&#039;graph_opt&#039;] = &quot;&quot;;</pre>
<p>
The path to the RRD and <acronym title="Extensible Markup Language">XML</acronym> files created by <code>process_perfdata.pl</code>
</p>
<pre class="code"> $conf[&#039;rrdbase&#039;] = &quot;/usr/local/pnp4nagios/var/perfdata/&quot;;</pre>
<p>
The path to the config file for the <a href="/pnp-0.6/pages" class="wikilink1" title="pnp-0.6:pages">pages</a>.
</p>
<pre class="code"> $conf[&#039;page_dir&#039;] = &quot;/usr/local/pnp4nagios/etc/pages/&quot;;</pre>
<hr />
<p>
PNP pages will be refreshed every n seconds
</p>
<pre class="code"> $conf[&#039;refresh&#039;] = &quot;90&quot;;</pre>
<hr />
<p>
Max. age of RRD files in seconds. After reaching this value links to the graphs will be marked as inactive
</p>
<pre class="code"> $conf[&#039;max_age&#039;] = 60*60*6;</pre>
<hr />
<p>
Base <acronym title="Uniform Resource Locator">URL</acronym> to the Nagios CGIs
</p>
<pre class="code"> $conf[&#039;nagios_base&#039;] = &quot;/nagios/cgi-bin&quot;;</pre>
<hr />
<p>
List of users who are allowed to view links to the services of the current host
</p>
<pre class="code"> $conf[&#039;allowed_for_service_links&#039;] = &quot;EVERYONE&quot;;</pre>
<hr />
<p>
List of users who can view/access the host search field
</p>
<pre class="code"> $conf[&#039;allowed_for_host_search&#039;] = &quot;EVERYONE&quot;;</pre>
<hr />
<p>
If PNP is called with a host only ( index.php?host=&lt;myserver&gt; ), the defined user is shown an overview of all services related to this host
</p>
<pre class="code"> $conf[&#039;allowed_for_host_overview&#039;] = &quot;EVERYONE&quot;;</pre>
<hr />
<p>
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
</p>
<pre class="code">
$views[] = array(&#039;title&#039; =&gt; &#039;One Hour&#039;, &#039;start&#039; =&gt; (60*60) );
$views[] = array(&#039;title&#039; =&gt; &#039;4 Hours&#039;, &#039;start&#039; =&gt; (60*60*4) );
$views[] = array(&#039;title&#039; =&gt; &#039;25 Hours&#039;, &#039;start&#039; =&gt; (60*60*25) );
$views[] = array(&#039;title&#039; =&gt; &#039;One Week&#039;, &#039;start&#039; =&gt; (60*60*25*7) );
$views[] = array(&#039;title&#039; =&gt; &#039;One Month&#039;, &#039;start&#039; =&gt; (60*60*24*32) );
$views[] = array(&#039;title&#039; =&gt; &#039;One Year&#039;, &#039;start&#039; =&gt; (60*60*24*380) );
</pre>
<p>
You can add more views ($views[5], …) but please keep in mind that under normal circumstances ALL views you defined are shown.
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/timeranges" class="wikilink1" title="pnp-0.6:timeranges">timeranges</a>
</p>
</div>
<!-- SECTION "etc/config.php" [386-] -->

View File

@@ -0,0 +1,30 @@
<p>
check_procs is an example for a plugin which doesn&#039;t deliver performance data:
</p>
<pre class="code">./check_procs -a ndo2db -w 1: -c 0:
PROCS OK: 2 processes with args &#039;ndo2db&#039;</pre>
<p>
This can be changed with the following wrapper script
</p>
<p>
<strong>check_procs.sh</strong>
</p>
<pre class="code">#!/bin/bash
LINE=`/usr/local/nagios/libexec/check_procs $*`
RC=$?
COUNT=`echo $LINE | awk &#039;{print $3}&#039;`
PROCS=`expr $COUNT - 1`
LINE=`echo $LINE | sed &quot;s/: $COUNT /: $PROCS /&quot;`
echo $LINE \| procs=$PROCS
exit $RC</pre>
<p>
Now you&#039;ll get the number together with the required label
</p>
<pre class="code">./check_procs.sh -a ndo2db -w 1: -c 0:
PROCS OK: 2 processes with args &#039;ndo2db&#039;| procs=2</pre>

View File

@@ -0,0 +1,44 @@
<h1><a name="data_export" id="data_export">Data export</a></h1>
<div class="level1">
<p>
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 <acronym title="Uniform Resource Locator">URL</acronym>
</p>
<pre class="code">/pnp4nagios/xport/&lt;format&gt;?host=&lt;hostname&gt;&amp;srv=&lt;servicedesc&gt;</pre>
<p>
whereas &lt;format&gt; has to be replaced with the desired format.
</p>
<p>
You can also use <code>wget</code> to generate images and place them in periodic reports. One example may be:
</p>
<pre class="code">wget -O image.png &#039;http://&lt;user&gt;:&lt;pass&gt;@&lt;nagios-server&gt;/pnp4nagios/image?host=&lt;hostname&gt;&amp;srv=&lt;service&gt;&amp;view=2&amp;source=0&#039;</pre>
<p>
<code>view=&lt;n&gt;</code> limits the graph to the timeperiod specified in config.php <br/>
<code>source=&lt;n&gt;</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 <a href="/pnp-0.6/timeranges" class="wikilink1" title="pnp-0.6:timeranges">&quot;time ranges&quot;</a>.
</p>
<p>
<a href="/pnp-0.6/start" class="wikilink1" title="pnp-0.6:start">back to contents</a> | <a href="/pnp-0.6/tpl" class="wikilink1" title="pnp-0.6:tpl">templates</a>
</p>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B