diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5236e1e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..22f929a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libexec"] + path = libexec + url = https://github.com/naparuba/check-linux-by-ssh.git diff --git a/libexec b/libexec new file mode 160000 index 0000000..46e049b --- /dev/null +++ b/libexec @@ -0,0 +1 @@ +Subproject commit 46e049bef83e747e03f28d835bd64b81312262bc diff --git a/pack/commands.cfg b/pack/commands.cfg index 7b162e1..8b214f5 100644 --- a/pack/commands.cfg +++ b/pack/commands.cfg @@ -4,19 +4,95 @@ # # ----------------------------------------------------------------- -# + define command { command_name check_ssh_connexion - command_line $PLUGINSDIR$/check_ssh_connexion.py -H $HOSTADDRESS$ + command_line $PLUGINSDIR$/check_ssh_connexion.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" +} + + + +define command { + command_name check_ssh_linux_memory + command_line $PLUGINSDIR$/check_memory_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" -w "$_HOSTMEMORY_WARN$" -c "$_HOSTMEMORY_CRIT$" -m -s +} + + + +define command { + command_name check_ssh_linux_cpu_stats + command_line $PLUGINSDIR$/check_cpu_stats_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" +} + + +define command { + command_name check_ssh_linux_disks + command_line $PLUGINSDIR$/check_disks_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" -U $_HOSTSTORAGE_UNIT$ -w $_HOSTSTORAGE_WARN$ -c $_HOSTSTORAGE_CRIT$ -m '$_HOSTSTORAGE_MOUNTS$' +} + + + +define command { + command_name check_ssh_linux_disks_stats + command_line $PLUGINSDIR$/check_disks_stats_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" +} + +define command { + command_name check_ssh_linux_kernel_stats + command_line $PLUGINSDIR$/check_kernel_stats_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" +} + + +define command { + command_name check_ssh_linux_load_average + command_line $PLUGINSDIR$/check_load_average_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" -w "$_HOSTLOAD_WARN$" -c "$_HOSTLOAD_CRIT$" +} + + + +define command { + command_name check_ssh_linux_processes + command_line $PLUGINSDIR$/check_processes_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" -C "$ARG1$" +} + + + +define command { + command_name check_ssh_linux_tcp_states + command_line $PLUGINSDIR$/check_tcp_states_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" } define command { - command_name check_linux_disks_ssh - command_line $PLUGINSDIR$/check_disks_by_ssh.py -H $HOSTADDRESS$ -w $_HOSTSTORAGE_SSH_WARN$ -c $_HOSTSTORAGE_SSH_CRIT$ -U $_HOSTSTORAGE_SSH_UNIT$ + command_name check_ssh_linux_net_stats + command_line $PLUGINSDIR$/check_net_stats_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" } define command { - command_name check_linux_memory_ssh - command_line $PLUGINSDIR$/check_memory_by_ssh.py -H $HOSTADDRESS$ -w $_HOSTMEMORY_SSH_WARN$ -c $_HOSTMEMORY_SSH_CRIT$ + command_name check_ssh_ro_filesystem + command_line $PLUGINSDIR$/check_ro_filesystem_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" } + + +define command { + command_name check_ssh_linux_uptime + command_line $PLUGINSDIR$/check_uptime_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" +} + + +define command { + command_name check_ssh_linux_ntp_sync + command_line $PLUGINSDIR$/check_ntp_sync_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" -w 40 -c 60 +} + +define command { + command_name check_ssh_linux_ntp_sync_chrony + command_line $PLUGINSDIR$/check_ntp_sync_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" -C -w "$_HOSTDELAY_WARNING$,$_HOSTOFFSET_WARNING$" -c "$_HOSTDELAY_CRITICAL$,$_HOSTOFFSET_CRITICAL$" +} + + +define command { + command_name check_ssh_linux_nfs_stats + command_line $PLUGINSDIR$/check_nfs_stats_by_ssh.py -H $HOSTADDRESS$ -u $_HOSTSSH_USER$ -i $_HOSTSSH_KEY$ -P "$_HOSTSSH_KEY_PASSPHRASE$" +} + diff --git a/pack/services/connexion.cfg b/pack/services/connexion.cfg new file mode 100644 index 0000000..78bdc26 --- /dev/null +++ b/pack/services/connexion.cfg @@ -0,0 +1,9 @@ +# This is a check based on the load average look by ssh +define service{ + service_description SSH Connexion + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_connexion + +} diff --git a/pack/services/cpu.cfg b/pack/services/cpu.cfg deleted file mode 100644 index 8c3c978..0000000 --- a/pack/services/cpu.cfg +++ /dev/null @@ -1,11 +0,0 @@ -#define service{ -# service_description Cpu -# use linux-service -# register 0 -# host_name linux -# check_command check_linux_cpu - -# _DETAILLEDESC Permet de detecter une utilisation anormalement elevee des CPU -# _IMPACT Ralentissement des applications hebergees par le systeme -# _FIXACTIONS Audit de performance a effectuer si cela devient une situation recurrente -#} diff --git a/pack/services/cpu_stats.cfg b/pack/services/cpu_stats.cfg new file mode 100644 index 0000000..c98038c --- /dev/null +++ b/pack/services/cpu_stats.cfg @@ -0,0 +1,10 @@ +# This is a check based on the load average look by ssh +define service{ + service_description CPU Stats + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_cpu_stats + + aggregation system/perfs +} diff --git a/pack/services/disks.cfg b/pack/services/disks.cfg index 6714646..ae8186b 100644 --- a/pack/services/disks.cfg +++ b/pack/services/disks.cfg @@ -1,8 +1,9 @@ +# This is a check based on the disks look by ssh define service{ - service_description Disks - use linux-ssh-service - register 0 - host_name linux-ssh - check_command check_linux_disks_ssh + service_description Disks + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_disks } diff --git a/pack/services/disks_stats.cfg b/pack/services/disks_stats.cfg new file mode 100644 index 0000000..989eb01 --- /dev/null +++ b/pack/services/disks_stats.cfg @@ -0,0 +1,10 @@ +# This is a check based on the disks stats look by ssh +define service{ + service_description Disks Stats + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_disks_stats + + aggregation system/perfs +} diff --git a/pack/services/kernel_stats.cfg b/pack/services/kernel_stats.cfg new file mode 100644 index 0000000..ed6def4 --- /dev/null +++ b/pack/services/kernel_stats.cfg @@ -0,0 +1,10 @@ +# This is a check based on the disks stats look by ssh +define service{ + service_description Kernel Stats + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_kernel_stats + + aggregation system/perfs +} diff --git a/pack/services/load.cfg b/pack/services/load.cfg deleted file mode 100644 index 716bcc9..0000000 --- a/pack/services/load.cfg +++ /dev/null @@ -1,11 +0,0 @@ -#define service{ -# service_description Load -# use linux-service -# register 0 -# host_name linux -# check_command check_linux_load - -# _DETAILLEDESC Permet de detecter une utilisation anormalement elevee des CPU -# _IMPACT Ralentissement des applications hebergees par le systeme -# _FIXACTIONS Audit de performance a effectuer si cela devient une situation recurrente -#} diff --git a/pack/services/load_average.cfg b/pack/services/load_average.cfg new file mode 100644 index 0000000..8d3dd2a --- /dev/null +++ b/pack/services/load_average.cfg @@ -0,0 +1,10 @@ +# This is a check based on the load average look by ssh +define service{ + service_description Load Average + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_load_average + + aggregation system/perfs +} diff --git a/pack/services/logFiles.cfg b/pack/services/logFiles.cfg deleted file mode 100644 index 7b5ad35..0000000 --- a/pack/services/logFiles.cfg +++ /dev/null @@ -1,12 +0,0 @@ -#define service{ -# host_name linux -# use linux-service -# is_volatile 1 -# service_description Log_File_Health -# check_command check_linux_logfiles -# register 0 - -# _DETAILLEDESC Stockent les evenements systemes dans des fichiers. Cet indicateur detecte les erreurs dans ces fichiers. Tous les evenements sont centralises sur la sonde via syslog. -# _IMPACT Moyen/Critique : Depends de l'erreur detectee. Cela indique un dysfonctionnement du systeme ou d'un programme de qui tourne sur celui-ci. -# _FIXACTIONS Dépend de l'erreur dectectee -#} diff --git a/pack/services/memory.cfg b/pack/services/memory.cfg index 7cdd1ae..d826657 100644 --- a/pack/services/memory.cfg +++ b/pack/services/memory.cfg @@ -1,11 +1,9 @@ +# This is a check based on the memory look by ssh define service{ service_description Memory use linux-ssh-service register 0 host_name linux-ssh - check_command check_linux_memory_ssh + check_command check_ssh_linux_memory - _DETAILLEDESC Espace disque reserve pour heberge les pages memoire devenues inutilisees, il est donc plus avantageux de basculer ces pages sur disque plutôt qu’en memoire RAM qui heberge de donnees vives. - _IMPACT Moyen: Trop d’espace de pagination occupe signifie que le systeme n’a pas assez de la memoire vive pour faire fonctionner ses applications. Un important ralentissement se fera sentir dans ce cas - _FIXACTIONS Audit de performance si l’evenement survient dans une utilisation normale du systeme. Rajout de RAM sur le serveur en dernier recours. } diff --git a/pack/services/net_stats.cfg b/pack/services/net_stats.cfg new file mode 100644 index 0000000..fa5a155 --- /dev/null +++ b/pack/services/net_stats.cfg @@ -0,0 +1,10 @@ +# This is a check based on the load average look by ssh +define service{ + service_description NET Stats + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_net_stats + + aggregation system/perfs +} diff --git a/pack/services/network_usage.cfg b/pack/services/network_usage.cfg deleted file mode 100644 index e73b90b..0000000 --- a/pack/services/network_usage.cfg +++ /dev/null @@ -1,11 +0,0 @@ -#define service{ -# service_description NetworkUsage -# use linux-service -# register 0 -# host_name linux -# check_command check_linux_network_usage - -# _DETAILLEDESC Surveillance de l’utilisation et la qualité par la vérification des paquets en erreurs et défaussés, du lien ethernet. -# _IMPACT Moyen: Ralentissement à prévoir sur l’application. -# _FIXACTIONS Le probleme est-il nouveau? quel changement il y a t'il eu avant que l'erreur ne survienne ? Audit -#} diff --git a/pack/services/nfs_stats.cfg b/pack/services/nfs_stats.cfg new file mode 100644 index 0000000..11b6b5e --- /dev/null +++ b/pack/services/nfs_stats.cfg @@ -0,0 +1,10 @@ +# This is a check based on the nfs look by ssh +define service{ + service_description NFS Stats + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_nfs_stats + + aggregation system/nfs +} diff --git a/pack/services/ntp_sync.cfg b/pack/services/ntp_sync.cfg new file mode 100644 index 0000000..50de694 --- /dev/null +++ b/pack/services/ntp_sync.cfg @@ -0,0 +1,9 @@ +# This is a check based on the ntp look by ssh +define service{ + service_description NtpSync + use linux-ssh-service + register 0 + host_name linux-ssh&!chrony + check_command check_ssh_linux_ntp_sync + +} diff --git a/pack/services/ntp_sync_chrony.cfg b/pack/services/ntp_sync_chrony.cfg new file mode 100644 index 0000000..919c4af --- /dev/null +++ b/pack/services/ntp_sync_chrony.cfg @@ -0,0 +1,8 @@ +# This is a check based on the ntp look by ssh +define service{ + service_description NtpSync + use linux-ssh-service + register 0 + host_name linux-ssh&chrony + check_command check_ssh_linux_ntp_sync_chrony +} diff --git a/pack/services/ro_fs.cfg b/pack/services/ro_fs.cfg new file mode 100644 index 0000000..d2e048f --- /dev/null +++ b/pack/services/ro_fs.cfg @@ -0,0 +1,9 @@ +# This is a check based on the disks stats look by ssh +define service{ + service_description Read-only Filesystems + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_ro_filesystem + +} diff --git a/pack/services/tcp_states.cfg b/pack/services/tcp_states.cfg new file mode 100644 index 0000000..313aea8 --- /dev/null +++ b/pack/services/tcp_states.cfg @@ -0,0 +1,9 @@ +# This is a check based on the load average look by ssh +define service{ + service_description TCP States + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_tcp_states + +} diff --git a/pack/services/time.cfg b/pack/services/time.cfg deleted file mode 100644 index d24b66e..0000000 --- a/pack/services/time.cfg +++ /dev/null @@ -1,12 +0,0 @@ -#define service{ -# service_description TimeSync -# use linux-service -# register 0 -# host_name linux -# check_command check_linux_time - - -# _DETAILLEDESC Controle regulierement l'horloge des sytemes pour eviter toutes derives de temp. La sonde doit etre elle aussi synchronisee sur le serveur de temps de l'entreprise, ou a defaut sur l'un des systemes de production. -# _IMPACT Moyen. Enregistrements dans la base Oracle avec de mauvaises heures. Plages horaire de contrôles qui derivent et donc alertes dans de mauvais creneaux horaire. -# _FIXACTIONS Reglage des horloges en mode pas-à-pas pour les systemes de production ou d’un seul coup pour la sonde. Regarder du cote du service ntp -#} diff --git a/pack/services/uptime.cfg b/pack/services/uptime.cfg new file mode 100644 index 0000000..365b6be --- /dev/null +++ b/pack/services/uptime.cfg @@ -0,0 +1,9 @@ +# This is a check based on the uptime look by ssh +define service{ + service_description Reboot + use linux-ssh-service + register 0 + host_name linux-ssh + check_command check_ssh_linux_uptime + +} diff --git a/pack/templates.cfg b/pack/templates.cfg index 95ab5b8..322298c 100644 --- a/pack/templates.cfg +++ b/pack/templates.cfg @@ -1,30 +1,50 @@ # The LINUX template. define host{ name linux-ssh - use generic-host check_command check_ssh_connexion register 0 + _SSH_KEY ~/.ssh/id_rsa + _SSH_KEY_PASSPHRASE + _SSH_USER shinken - _STORAGE_SSH_WARN 90 - _STORAGE_SSH_CRIT 95 - _STORAGE_SSH_UNIT GB - _MEMORY_SSH_WARN 90 - _MEMORY_SSH_CRIT 95 + _LOAD_WARN 1,1,1 + _LOAD_CRIT 2,2,2 + _STORAGE_WARN 90 + _STORAGE_CRIT 95 + _STORAGE_UNIT GB + _STORAGE_MOUNTS / + _CPU_WARN 80 + _CPU_CRIT 90 + _MEMORY_WARN 80 + _MEMORY_CRIT 90 + _NET_WARN 90,90,0,0,0,0 + _NET_CRIT 0,0,0,0,0,0 + + custom_views +linux_ssh,linux_ssh_memory,linux_ssh_processes + + # Not yet implemented -# _LOAD_WARN 2,2,2 -# _LOAD_CRIT 3,3,3 # _CPU_WARN 80 # _CPU_CRIT 90 # _NTP_WARN 0.128 # _NTP_CRIT 1 # _NET_IFACES eth\d+|em\d+ -# _NET_WARN 90,90,0,0,0,0 -# _NET_CRIT 0,0,0,0,0,0 # _CHKLOG_CONF $PLUGINSDIR$/logFiles_linux.conf } +# The LINUX template. +define host{ + name chrony + register 0 + + _DELAY_WARNING 0.100 + _DELAY_CRITICAL 0.150 + _OFFSET_WARNING 0.1 + _OFFSET_CRITICAL 0.2 +} + define service{ name linux-ssh-service diff --git a/package.json b/package.json index eb45669..1407cd6 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,12 @@ { "name": "Imrane Dessai", "email": "dessai.imrane@gmail.com" + }, + { + "name": "Gabes Jean", + "email": "naparuba@gmail.com" } + ], "repository": "https://github.com/DessaiImrane/pack-linux-ssh", "keywords": [