Nagios-plugin
Tämä sivu on listaus erilaisista Nagios Plugineista joita voi asentaa Nagiokseen tai icingaan. Lisäessä Nagiokseen tai Icingaan plugini muista konfiguroida se sinne. Katso enemmän Nagioksen ja Icinga2 ohjeista.
check_memory
check_memory plugin ei ole oletuksena nagios-plugineissa mutta tällä kätevällä pluginilla tarkistetaan muistin tilaa.
apt-get install libnagios-plugin-perl
Lataa ja konfiguroidaan plugin
cd /usr/lib/nagios/plugins/ wget https://raw.githubusercontent.com/dermoth/misc-code/master/nagios/plugins/check_memory chmod 775 check_memory
Jos haluat nähdä used memory eli käytössä olevan muistin lisää tämä check_memory tiedostoon vastaavan "free":n alle:
$np->add_perfdata( label => "used", value => $used, uom => 'b', threshold => $np->threshold, );
Korjaa Ubuntu 16.04 bugi muuttamalla riviltä 106 alkaen:
warn("Output from $FREECMD:\n") if ($verbose > 1); my ($used, $free, $available_col); while (<RESULT>) { warn(" $_") if ($verbose > 1); if (m/available$/) { $available_col = 1; next; } if (defined($available_col)) { if (m#(\d+)(?:\s+\d+){3}\s+(\d+)$#) { ($used, $free) = ($1, $2); last } } else { if (m#^\-/\+\ buffers/cache:\s*(\d+)\s+(\d+)#) { ($used, $free) = ($1, $2); last } } }
Tämän jälkeen lisää Icingaan /etc/icinga2/conf.d/commands.conf tiedostoon
object CheckCommand "check_memory" { import "plugin-check-command" command = [ PluginDir + "/check_memory" ] //constants.conf -> const PluginDir arguments = { "-w" = "$memory_warn$" "-c" = "$memory_crit$" "-u" = "$memory_unit$" } }
Käynnistä icinga2 uudelleen
check_diskstat
Pluginilla tulostetaan tiedot levyn käytöstä
Esimerkki Output:
summary: 0 io/s, read 0 sectors (0kB/s), write 1256 sectors (6kB/s), queue size 0 in 90 seconds
Lataa plugini ja siirrä Nagios plugin hakemistoon
wget https://raw.github.com/mclarkson/check_diskstat/master/check_diskstat.sh chmod +x check_diskstat.sh mv check_diskstat.sh /usr/lib/nagios/plugins/check_diskstat
Korjaa check_diskstat pluginista performance data jotta icinga2 osaa lukea oikein
Riviltä: 331/340
echo "${OUTPUT}summary: $TPS io/s, read $SECTORS_READ sectors (${KBYTES_READ_PER_SEC}kB/s), write $SECTORS_WRITE sectors (${KBYTES_WRITTEN_PER_SEC}kB/s), queue size $AQUSZ in $TIME seconds | tps=${TPS};;; read=${BYTES_READ_PER_SEC};$write=${BYTES_WRITTEN_PER_SEC};;; avgrq-sz=${ARQSZ};;; avgqu-sz=${AQUSZ};$WARN_QSZ;$CRIT_QSZ; await=${AWAIT}ms;;;"
Testaa ./check_diskstat -d sda -W 10 -C 20
Lisää Icingaan
object CheckCommand "check_diskstat" { import "plugin-check-command" command = [ PluginDir + "/check_diskstat" ] //constants.conf -> const PluginDir arguments = { "-d" = "$diskstat_name$" "-W" = "$diskstat_warn$" "-C" = "$diskstat_crit$" } }
ja muuttujat hosteihin
vars.diskstat_name = "sda" vars.diskstat_warn = "10" vars.diskstat_crit = "20"
check_openvpn
OpenVPN palvelimella tulee olla management portti auki. Lisää tämä alla oleva sinun VPN palvelin konfiguraatioon
management 127.0.0.1 5000
Lataa täältä: https://exchange.nagios.org/directory/Plugins/Security/VPN-Software/check_openvpn_pl/details
Asennus
aptitude install libnet-telnet-perl
Kopioi check_openvpn.pl /usr/lib/nagios/plugins/check_openvpn ja anna nagios/icinga käyttäjälle suoritusoikeudet.
Muuta check_openvpn tiedostosta
use lib "/usr/nagios/libexec"; -> use lib "/usr/lib/nagios/plugins" ;
Lisää Icingaan commands.conf tiedostoon
object CheckCommand "check_openvpn" { import "plugin-check-command" command = [ PluginDir + "/check_openvpn" ] //constants.conf -> const PluginDir arguments = { "-H" = "$openvpn_hostname$" //OpenVPN Server IP or Hostname "-p" = "$openvpn_port$" //OpenVPN Management Port "-P" = "$openvpn_password$" //Password for the management interface of the openvpn server. "-t" = "$openvpn_timeout$" //Timeout for the connection attempt. Optional, default 10 seconds. "-i" = "$openvpn_ip$" //Prints the IP address of the remote client instead of the common name. "-n" = "$openvpn_numeric$" //Prints the number of clients connected to the openvpn server. "-C" = "$openvpn_commonname$" //The common name, as it is specified in the client certificate, who is wanted to check. "-r" = "$openvpn_remoteip$" //The client remote ip address who is wanted to check. "-c" = "$openvpn_crit$" //Exits with CRITICAL status if the client specified by the common name or the remote ip address is not connected "-w" = "$openvpn_warn$" //Exits with WARNING status if the client specified by the common name or the remote ip address is not connected } }
Käynnistä icinga2 uudelleen
Proxmox pluginit
Asenna dependerit
aptitude install it libjson-perl libwww-perl libio-socket-ssl-perl libswitch-perl libdata-dump-perl libtest-trap-perl
Asenna CPANin avulla Proxmox-perl plugin
cpan install Net::Proxmox::VE
Lataa ja asenna plugin
cd /tmp/ wget -O pve-monitor.tar.gz https://github.com/dpiquet/pve-monitor/archive/Stable-1.07.tar.gz tar zxvf pve-monitor.tar.gz cp pve-monitor.pl /usr/lib/nagios/plugins/