Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung Nächste Überarbeitung Beide Seiten der Revision | ||
monitoringunipager [2018/01/10 13:33] dh3wr angelegt |
monitoringunipager [2018/02/26 22:44] dh3wr |
||
---|---|---|---|
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 ===== | ||
+ | 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 transmission to be exceeded for status ''warning'' | ||
+ | * ARG3: Number of POCSAG transmission to be exceeded for status ''critical'' | ||
+ | |||
+ | FIXME weiter aufräumen!!! | ||
+ | |||
+ | 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 54: | ||
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> | + | FIXME |
- | # '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 ===== |
+ | 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{ | ||
- | use generic-host-rwthafu ; Name of host template to use | + | use generic-host ; Name of host template to use |
host_name c9000.db0sda.ampr.org | host_name c9000.db0sda.ampr.org | ||
alias c9000.db0sda | alias c9000.db0sda | ||
Zeile 35: | Zeile 89: | ||
# Define a service to check if rustpager is connected to a Core | # Define a service to check if rustpager is connected to a Core | ||
define service{ | define service{ | ||
- | use generic-service-rwthafu | + | use generic-service |
- | 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. |