Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung Nächste Überarbeitung Beide Seiten der Revision | ||
monitoringunipager [2018/01/10 13:34] dh3wr |
monitoringunipager [2018/09/16 23:50] df2et [Generelle Einstellungen für NRPE] |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Monitoring of Unipager Transmitters with Nagios on the unipager itself ====== | + | ====== Monitoring of Unipager Transmitters on the Unipager itself ====== |
- | Ein entsprechendes Plugin für die Websocket-Schnittstelle kann unter [[https://github.com/rwth-afu/UniPagerNagios|https://github.com/rwth-afu/UniPagerNagios]] heruntergeladen werden. | + | ===== Overview ===== |
- | Zur Installation mit | + | There are three variantes of Nagios plugins available. |
+ | * Solution with JSON Status output of Unipager directly (since Version 1.0.0) | ||
+ | * Websocket based with C++ programm | ||
+ | * Websocket based with Python programm | ||
+ | |||
+ | If you have already Unipager V 1.0.0 or newer installed, the JSON output solution is highly recommended due to performance issues. | ||
+ | |||
+ | ===== Up-to-date Solution with JOSN Output ===== | ||
+ | This approach uses the same ''check_http_json'' Nagios plugin as [[monitoringnagios|here]]. For further information on installation refere to this site. No ''nagios-nrpe-server'' is needed (although it makes sense to use it for temperature monitoring, disk space, etc.) | ||
+ | |||
+ | Add to your ''commands.cfg'' the following lines: | ||
+ | <file> | ||
+ | # 'check_unipager_connected' command definition | ||
+ | define command{ | ||
+ | command_name check_unipager_connected | ||
+ | command_line /usr/lib/nagios/plugins/check_http_json -H '$HOSTNAME$' -P $ARG1$ -p status -Q "connected,True" | ||
+ | } | ||
+ | |||
+ | # 'check_unipager_queue' command definition | ||
+ | define command{ | ||
+ | command_name check_unipager_queue | ||
+ | command_line /usr/lib/nagios/plugins/check_http_json -H '$HOSTNAME$' -P $ARG1$ -p status -w queue,$ARG2$ -c queue,$ARG3$ | ||
+ | } | ||
+ | </file> | ||
+ | |||
+ | * ARG1: Port of the HTTP Server of Unipager, default is ''8073'' | ||
+ | * ARG2: Number of POCSAG transmissions in queue to be exceeded for status ''warning'' | ||
+ | * ARG3: Number of POCSAG transmission in queue to be exceeded for status ''critical'' | ||
+ | |||
+ | Create a service description for the new commands: | ||
+ | <file> | ||
+ | # Define a service to check if unipager is connected to a Node | ||
+ | define service{ | ||
+ | use generic-service-rwthafu | ||
+ | host_name c9000.db0sda.ampr.org | ||
+ | service_description UniPager Connection to DAPNET Core | ||
+ | check_command check_unipager_connected!8073 | ||
+ | } | ||
+ | |||
+ | # Define a service to check if unipager queue is too full | ||
+ | define service{ | ||
+ | use generic-service-rwthafu | ||
+ | host_name c9000.db0sda.ampr.org | ||
+ | service_description UniPager Queue | ||
+ | check_command check_unipager_queue!8073!100!150 | ||
+ | } | ||
+ | </file> | ||
+ | |||
+ | The result should be like this: | ||
+ | {{ ::monitoring:nagios_json_connection_and_queue.png?direct&800 |}} | ||
+ | |||
+ | ===== Websocket Solution ===== | ||
+ | {{:icons:warning.png?direct |}}{{ :icons:warning.png?direct|}}The websocket methods are superseeded by the JSON method. Please use the new one. The following documentation is for historical reasons only. | ||
+ | |||
+ | Ein entsprechendes Plugin für die Websocket-Schnittstelle kann unter [[https://github.com/rwth-afu/UniPagerNagios|https://github.com/rwth-afu/UniPagerNagios]] heruntergeladen werden. Es gibt 2 Varianten: | ||
+ | * C++ Version (Viele Abhängigkeiten) | ||
+ | * Pyhton2 Version (Einfache Installation) | ||
+ | |||
+ | Dazu muss der Nagios NRPE-Server installiert werden. | ||
+ | <code>sudo apt-get install nagios-nrpe-server</code> | ||
+ | |||
+ | Zur Installation des Check-Plugins zunächst das Repository herunterladen: | ||
+ | <code>git clone https://github.com/rwth-afu/UniPagerNagios.git</code>. | ||
+ | |||
+ | ==== C++-Version ==== | ||
+ | Mit | ||
<code> | <code> | ||
+ | sudo apt-get install libssl-dev libboost-dev libjson-spirit-dev libboost-system-dev libboost-coroutine-dev libboost-context-dev libboost-thread-dev libboost-program-options-dev | ||
+ | cd UniPagerNagios/cplusplus | ||
make | make | ||
</code> | </code> | ||
Zeile 10: | Zeile 77: | ||
sudo cp ./build/unipagernagios /usr/lib/nagios/plugins/check_unipager | sudo cp ./build/unipagernagios /usr/lib/nagios/plugins/check_unipager | ||
</code> | </code> | ||
- | ins Zielverzeichnis kopieren. Dann noch dem Benutzer root zuweisen | + | ins Zielverzeichnis kopieren. Dann noch dem Benutzer root zuweisen, sowie ausführbar machen |
- | <code>sudo chmod root:root /usr/lib/nagios/plugins/check_unipager</code> | + | <code> |
+ | sudo chown root:root /usr/lib/nagios/plugins/check_unipager | ||
+ | sudo chmod 755 /usr/lib/nagios/plugins/check_unipager | ||
+ | </code> | ||
- | In der Datei ///etc/nagios3/command.cfg// fügt man ein | + | ==== Pyhton2-Version ==== |
- | <file> | + | There is in the same Git-repository a pyhton2 version to do the same. You can find the code in ''python/check_unipager'' . The setup is almost the same as for the C++ version. As this method is overseeded by the JSON approach, there is no further documentation here for the moment. |
- | # 'check_rustpager' command definition | + | |
- | define command{ | + | |
- | command_name check_unipager | + | |
- | command_line /usr/lib/nagios/plugins/check_unipager -H '$HOSTNAME$' --port $ARG1$ | + | |
- | } | + | |
- | </file> | + | |
- | Dann erstellt man eine Datei in ///etc/nagios3/conf.d// mit z.B. dem Hostnamen //c9000.db0sda.ampr.org.cfg// und dem Inhalt | + | ==== Generelle Einstellungen für NRPE ==== |
+ | Die Datei ''/etc/nagios/nrpe.cfg'' entsprechen anpassen, insbesondere: | ||
+ | <code>allowed_hosts=127.0.0.1,44.225.x.y</code> | ||
+ | |||
+ | Die Datei ''/etc/nagios/nrpe.d/check_unipager.cfg'' erstellen mit Inhalt | ||
+ | <code>sudo nano /etc/nagios/nrpe.d/check_unipager.cfg</code> | ||
+ | <file>command[check_unipager]=/usr/lib/nagios/plugins/check_unipager -H localhost</file> | ||
+ | |||
+ | ACHTUNG: Nur bei Zugriff von ''localhost'' aus braucht man ab der Version 0.7.1 von [[unipager|UniPager]] kein Passwort. | ||
+ | |||
+ | Dann den nagios-nrpe-server neu starten: | ||
+ | <code>service nagios-nrpe-server restart</code> | ||
+ | |||
+ | Auf dem Haupt-Nagios-Server kann man dann mit den NRPE-Plugin den Status abfragen. Dazu erstellt man eine Datei in ''/etc/nagios3/conf.d'' mit z.B. dem Hostnamen''c9000.db0sda.ampr.org.cfg'' und dem Inhalt | ||
<file> | <file> | ||
define host{ | define host{ | ||
Zeile 38: | Zeile 115: | ||
host_name c9000.db0sda.ampr.org | host_name c9000.db0sda.ampr.org | ||
service_description UniPager Connection to DAPNET Core | service_description UniPager Connection to DAPNET Core | ||
- | check_command check_unipager!8055 | + | check_command check_nrpe_1arg!check_unipager |
} | } | ||
</file> | </file> | ||
+ | |||
+ | |||
Die hostgroup, host_name, alias und IP müssen natürlich angepasst werden. Einmal nagios neustarten und schon wird der Status überwacht. | Die hostgroup, host_name, alias und IP müssen natürlich angepasst werden. Einmal nagios neustarten und schon wird der Status überwacht. |