Ero sivun ”Nagios-plugin” versioiden välillä
Rivi 76: | Rivi 76: | ||
Kopioi check_openvpn.pl /usr/lib/nagios/plugins/check_openvpn ja anna nagios/icinga käyttäjälle suoritusoikeudet. | 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 | Lisää Icingaan commands.conf tiedostoon | ||
Rivi 87: | Rivi 91: | ||
"-p" = "$openvpn_port$" //OpenVPN Management Port | "-p" = "$openvpn_port$" //OpenVPN Management Port | ||
"-P" = "$openvpn_password$" //Password for the management interface of the openvpn server. | "-P" = "$openvpn_password$" //Password for the management interface of the openvpn server. | ||
− | "-t" = "$openvpn_timeout$ //Timeout for the connection attempt. Optional, default 10 seconds. | + | "-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. | + | "-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. | "-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. | "-C" = "$openvpn_commonname$" //The common name, as it is specified in the client certificate, who is wanted to check. | ||
Rivi 99: | Rivi 103: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | Käynnistä icinga2 uudelleen | ||
[[Luokka:Linux|Nagios-plugin]] | [[Luokka:Linux|Nagios-plugin]] |
Versio 11. kesäkuuta 2016 kello 15.51
Tämä sivu on listaus erilaisista Nagios Plugineista joita voi asentaa Nagiokseen Icingaan (icinga2). Lisäessä Nagiokseen tai Icingaan plugini muista konfiguroida se sinne. Katso enemmän ohjeita Nagioksen ja Icinga2 ohjeesta.
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
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 = { } }
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
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
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