Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| — | computer:ipcop:nrpe_kompilieren [2017/12/23 12:25] (aktuell) – angelegt christian | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ======Vorwort und Voraussetzungen====== | ||
| + | < | ||
| + | Mithilfe von NRPE kann ein Host über ein Nagios/ | ||
| + | |||
| + | Benötigt wird: | ||
| + | * IPCop-Entwicklungssystem, | ||
| + | * Quellcode der NRPE-Plugins bzw. Monitoring-Plugins: | ||
| + | * Quellcode von **nrpe**: [[http:// | ||
| + | |||
| + | ======Monitoring-Plugins====== | ||
| + | Die Monitoring-Plugins werden heruntergeladen und auf dem Entwicklungssystem entpackt. Anschließend wird die Übersetzung wie folgt vorgenommen: | ||
| + | < | ||
| + | # ./configure --prefix=/ | ||
| + | # make | ||
| + | # make install | ||
| + | # rm -rf / | ||
| + | </ | ||
| + | |||
| + | ======NRPE====== | ||
| + | Zur Übersetzung von NRPE wird der Quellcode von der Projektseite bezogen und ebenfalls auf dem Entwicklungssystem entpackt. Anschließend erfolgt in bereits bekannter Manier das gleiche Übersetzungsprocedere: | ||
| + | < | ||
| + | # ./configure --prefix=/ | ||
| + | # make nrpe | ||
| + | </ | ||
| + | |||
| + | Anschließend muss der ``nagios`` Systembenutzer erstellt werden, bevor der Dienst installiert werden kann: | ||
| + | < | ||
| + | # useradd -d /dev/null -M -r -s /bin/false nagios | ||
| + | # make install-daemon | ||
| + | </ | ||
| + | |||
| + | Darüber hinaus ist es ratsam eine Beispielkonfiguration in der Datei ``/ | ||
| + | < | ||
| + | #IPCop NRPE example config | ||
| + | log_facility=daemon | ||
| + | pid_file=/ | ||
| + | nrpe_user=nagios | ||
| + | nrpe_group=nagios | ||
| + | |||
| + | #nrpe port - feel free to change port to enhance security | ||
| + | server_port=5666 | ||
| + | |||
| + | #specify server address to listen to | ||
| + | # | ||
| + | |||
| + | #specify hosts which are allowed to talk to us | ||
| + | allowed_hosts=127.0.0.1 | ||
| + | |||
| + | #set to 1 if you want to pass args (which IS a security risk!) | ||
| + | dont_blame_nrpe=0 | ||
| + | |||
| + | #debug and timeouts | ||
| + | debug=0 | ||
| + | command_timeout=60 | ||
| + | connection_timeout=300 | ||
| + | |||
| + | #some plugins | ||
| + | command[check_users]=/ | ||
| + | command[check_load]=/ | ||
| + | command[check_hda1]=/ | ||
| + | command[check_zombie_procs]=/ | ||
| + | command[check_total_procs]=/ | ||
| + | </ | ||
| + | |||
| + | ======Tarball erstellen====== | ||
| + | Für das spätere Archiv wird ein Ordner angelegt, in welchem die später unterhalb **/ | ||
| + | < | ||
| + | # mkdir nrpe-ipcop-VERSION | ||
| + | # cd nrpe-ipcop-VERSION | ||
| + | # mkdir -p build/ | ||
| + | # cp / | ||
| + | # cp / | ||
| + | # cp --preserve=all -r /opt/lib/* build/ | ||
| + | # cd build/ | ||
| + | # tar cvfz ../ | ||
| + | </ | ||
| + | |||
| + | ======Installer====== | ||
| + | Herzstück des Addons ist ein Installationsskript, | ||
| + | Mithilfe der Funktionen **addtofiletail** und **removefromfile** werden diese Eintragungen entsprechend maskiert, damit das Addons auch wieder sauber deinstalliert werden kann. | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | # ipcop addon binary installer Ver 0.9b for IPCop 2.0 | ||
| + | |||
| + | CMD=" | ||
| + | |||
| + | # clear screen | ||
| + | / | ||
| + | |||
| + | # check | ||
| + | if [ ! -e / | ||
| + | echo " | ||
| + | exit 1 | ||
| + | fi | ||
| + | |||
| + | . / | ||
| + | ismachine i486 | ||
| + | |||
| + | if [ ${?} -ne 0 ]; then | ||
| + | echo "This Addon is for i486 architecture only" | ||
| + | exit 1 | ||
| + | fi | ||
| + | |||
| + | # error handling | ||
| + | err() | ||
| + | { | ||
| + | echo " " | ||
| + | echo "Error : $1 " | ||
| + | echo " " | ||
| + | echo " | ||
| + | echo " " | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " " | ||
| + | exit;exit; | ||
| + | } | ||
| + | |||
| + | # installation | ||
| + | ai() | ||
| + | { | ||
| + | #create user | ||
| + | / | ||
| + | #extract tarball and copy configuration | ||
| + | tar xfz nrpe.tar.gz -C / | ||
| + | #copy configuration and rc-stuff | ||
| + | cp nrpe.cfg / | ||
| + | cp rc.nrpe /etc/rc.d | ||
| + | addtofiletail nrpe local.add / | ||
| + | echo "nrpe 5666/ | ||
| + | } | ||
| + | |||
| + | # deinstallation | ||
| + | au() | ||
| + | { | ||
| + | #kill nrpe and delete user/files | ||
| + | / | ||
| + | rm -rf / | ||
| + | rm / | ||
| + | / | ||
| + | removefromfile nrpe / | ||
| + | grep -v "nrpe 5666/ | ||
| + | mv tmp / | ||
| + | } | ||
| + | |||
| + | |||
| + | case $CMD in | ||
| + | | ||
| + | echo " " | ||
| + | echo " | ||
| + | ai | ||
| + | echo " | ||
| + | echo " " | ||
| + | echo "NOTE: dont forget to check / | ||
| + | echo " | ||
| + | echo " ";; | ||
| + | |||
| + | -u|u|uninstall) | ||
| + | echo " " | ||
| + | echo " | ||
| + | au | ||
| + | echo " | ||
| + | echo " " | ||
| + | echo "NOTE: dont forget to delete nrpe firewall rule" | ||
| + | echo " ";; | ||
| + | *) | ||
| + | err " | ||
| + | esac | ||
| + | sync | ||
| + | #end of file | ||
| + | </ | ||
| + | |||
| + | ======Packen und Aufräumen====== | ||
| + | Letztendlich kann der Addon-Ordner (//mit Ausnahme des **build**-Ordners// | ||
| + | |||
| + | < | ||
| + | # tar cfz nrpe-ipcop-VERSION.tar.gz nrpe-ipcop-VERSION/ | ||
| + | # md5sum nrpe-ipcop-VERSION.tar.gz > nrpe-ipcop-VERSION.tar.gz.md5sum | ||
| + | </ | ||
| + | |||
| + | Auf dem Entwicklungssystem können die Daten unterhalb /opt entfernt werden: | ||
| + | < | ||
| + | # rm -rf /opt | ||
| + | </ | ||