Premier commit

This commit is contained in:
“Albert
2023-01-05 11:44:26 +01:00
parent d46e9954ca
commit fb19dc24e5
554 changed files with 46045 additions and 0 deletions

View File

@@ -0,0 +1,159 @@
###############################################################################
# LOCALHOST.CFG - SAMPLE OBJECT CONFIG FILE FOR MONITORING THIS MACHINE
#
#
# NOTE: This config file is intended to serve as an *extremely* simple
# example of how you can create configuration entries to monitor
# the local (Linux) machine.
#
###############################################################################
###############################################################################
#
# HOST DEFINITION
#
###############################################################################
# Define a host for the local machine
define host {
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
}
###############################################################################
#
# HOST GROUP DEFINITION
#
###############################################################################
# Define an optional hostgroup for Linux machines
define hostgroup {
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost ; Comma separated list of hosts that belong to this group
}
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
# Define a service to "ping" the local machine
define service {
use local-service ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if
# < 10% free space on partition.
define service {
use local-service ; Name of service template to use
host_name localhost
service_description Root Partition
check_command check_local_disk!20%!10%!/
}
# Define a service to check the number of currently logged in
# users on the local machine. Warning if > 20 users, critical
# if > 50 users.
define service {
use local-service ; Name of service template to use
host_name localhost
service_description Current Users
check_command check_local_users!20!50
}
# Define a service to check the number of currently running procs
# on the local machine. Warning if > 250 processes, critical if
# > 400 processes.
define service {
use local-service ; Name of service template to use
host_name localhost
service_description Total Processes
check_command check_local_procs!250!400!RSZDT
}
# Define a service to check the load on the local machine.
define service {
use local-service ; Name of service template to use
host_name localhost
service_description Current Load
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}
# Define a service to check the swap usage the local machine.
# Critical if less than 10% of swap is free, warning if less than 20% is free
define service {
use local-service ; Name of service template to use
host_name localhost
service_description Swap Usage
check_command check_local_swap!20%!10%
}
# Define a service to check SSH on the local machine.
# Disable notifications for this service by default, as not all users may have SSH enabled.
define service {
use local-service ; Name of service template to use
host_name localhost
service_description SSH
check_command check_ssh
notifications_enabled 0
}
# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.
define service {
use local-service ; Name of service template to use
host_name localhost
service_description HTTP
check_command check_http
notifications_enabled 0
}

View File

@@ -0,0 +1,15 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name r-ext
alias serveur proxy
address 192.168.200.253
parents r-int
}

View File

@@ -0,0 +1,14 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name r-int
alias serveur proxy
address 172.16.0.254
}

View File

@@ -0,0 +1,13 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-adm
alias debian-servers
address 192.168.99.99
}

View File

@@ -0,0 +1,13 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-appli
alias debian-servers
address 172.16.0.3
}

View File

@@ -0,0 +1,13 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-backup
alias serveur proxy
address 172.16.0.4
}

View File

@@ -0,0 +1,14 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-fog
alias serveur proxy
address 172.16.0.16
}

View File

@@ -0,0 +1,13 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-infra
alias debian-servers
address 172.16.0.1
}

View File

@@ -0,0 +1,14 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-itil
alias serveur proxy
address 172.16.0.9
}

View File

@@ -0,0 +1,13 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-nxc
alias debian-servers
address 172.16.0.7
}

View File

@@ -0,0 +1,14 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-proxy
alias serveur proxy
address 172.16.0.2
}

View File

@@ -0,0 +1,14 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define host{
use linux-server ; Name of host template to use
host_name s-win
alias serveur proxy
address 172.16.0.6
}

View File

@@ -0,0 +1,151 @@
###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS
###############################################################################
################################################################################
# NOTIFICATION COMMANDS
################################################################################
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
################################################################################
# HOST CHECK COMMANDS
################################################################################
# On Debian, check-host-alive is being defined from within the
# nagios-plugins-basic package
define command {
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
define command {
command_name check_local_load
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
}
define command {
command_name check_local_procs
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
}
define command {
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}
define command {
command_name check_local_swap
command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
}
define command{
command_name check_snmp_storage
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$ -m $ARG3$ -w $ARG4$ -c $ARG5$
}
define command{
command_name check_snmp_load
command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$ -T $ARG3$ -w $ARG4$ -c $ARG5$
}
define command{
command_name check_snmp_mem
command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$ $ARG3$ -w $ARG4$ -c $ARG5$
}
define command{
command_name check_snmp_int
command_line $USER1$/check_snmp_netint.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$ -n $ARG3$ -a -m -k -M -w $ARG4$ -c $ARG5$
}
define command{
command_name check_iftraffic3
#command_name check_win_int
#command_line $USER1$/check_iftraffic3.pl -H $HOSTADDRESS$ -C $ARG1$
#command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$ -n $ARG3$ -k -M -g -w $ARG4$ -c $ARG5$
command_line $USER1$/check_iftraffic3.pl -H $HOSTADDRESS$ -C $ARG1$ -i $ARG2$ -w $ARG3$ -c $ARG4$
}
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
###############################
##WINDOWS
###############################
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -s root -p 12489 -v $ARG1$ $ARG2$
}
define command{
command_name check_dns_ext
command_line $USER1$/check_dns -H google.com -s '$HOSTADDRESS$'
}
#define command{
# command_line check_dns_int
# command_line $USER1*/check_dns -H s-infra.gsb.lan -s '$HOSTADDRESS$'
#}
#define command{
# command_line check_dhcp
# command_line $USER1$/check_dhcp -H $HOSTADDRESS$ -s $ARG1$ -i $ARG2$
#}
#define command{
# command_name check_dig
# command_line /usr/lib/nagios/plugins/check_dig -H '$HOSTADDRESS$' -l '$ARG1$'
#}
################################################################################
# PERFORMANCE DATA COMMANDS
################################################################################
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-perfdata.out
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out
}

View File

@@ -0,0 +1,30 @@
define hostgroup {
hostgroup_name debian-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members s-infra, s-proxy, s-adm, s-nxc, s-appli, s-backup, s-itil, s-fog, r-int, r-ext ; Comma separated list of hosts that belong to this group
}
define hostgroup {
hostgroup_name windows-servers
alias Serveurs Windows
members s-win
}
define hostgroup {
hostgroup_name http-servers
alias Serveurs web
members s-itil
}
define hostgroup {
hostgroup_name dhcp-servers
alias Serveurs DHCP
members s-adm, r-int
}
define hostgroup {
hostgroup_name dns-servers
alias Serveurs DNS
members s-infra, s-backup
}

View File

@@ -0,0 +1,23 @@
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp0s3
iface enp0s3 inet static
address 192.168.99.104/24
gateway 192.168.99.99
# Cote n-infra
allow-hotplug enp0s8
iface enp0s8 inet static
address 172.16.0.8/24
up ip route add 172.16.64.0/24 via 172.16.0.254
up ip route add 172.16.128.0/24 via 172.16.0.254
up ip route add 192.168.0.0/16 via 172.16.0.254
up ip route add 192.168.200.0/24 via 172.16.0.254

15
roles/nagios/files/nt.cfg Normal file
View File

@@ -0,0 +1,15 @@
# If you are confused about this command definition, cause you was
# reading other suggestions, please have a look into
# /usr/share/doc/monitoring-plugins/README.Debian
# 'check_nt' command definition
#define command {
# command_name check_nt
# command_line /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRESS$' -v '$ARG1$'
#}
# 'check_nscp' command definition
define command {
command_name check_nscp
command_line /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRESS$' -p 12489 -v '$ARG1$'
}

View File

@@ -0,0 +1,2 @@
[smtp.gmail.com]:587 nagios.gsb22@gmail.com:Azerty1+
chmod 600 /etc/postfix/sasl_passwd

View File

@@ -0,0 +1,126 @@
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#
define service {
use generic-service
hostgroup_name debian-servers
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service {
use generic-service
hostgroup_name windows-servers
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service {
hostgroup_name http-servers
service_description HTTP
check_command check_http
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
define service {
hostgroup_name debian-servers
service_description SSH
check_command check_ssh
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
define service{
use generic-service
hostgroup_name debian-servers
service_description Espace disque
check_command check_snmp_storage!public!--v2c!"^/$|tmp|usr|var"!90!95
}
define service{
use generic-service
hostgroup_name debian-servers
service_description Charge machine
check_command check_snmp_load!public!--v2c!netsl!2,1,1!3,2,2
}
define service{
use generic-service
hostgroup_name debian-servers
service_description Charge machine
check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0
}
define service{
use generic-service
hostgroup_name debian-servers
service_description RAM
check_command check_snmp_mem!public!--v2c!-N!95,60!99,90
}
define service{
use generic-service
hostgroup_name debian-servers
service_description Uptime
check_command check_snmp!-C public -o 1.3.6.1.2.1.1.3.0
}
define service{
use generic-service
hostgroup_name windows-servers
service_description Uptime
check_command check_snmp!-C public -o 1.3.6.1.2.1.1.3.0
}
define service{
use generic-service
hostgroup_name windows-servers
service_description Charge CPU
check_command check_nt!CPULOAD!-l 5,80,90,15,80,90
}
define service{
use generic-service
hostgroup_name windows-servers
service_description Uptime
check_command check_nt!UPTIME
}
define service{
use generic-service
hostgroup_name windows-servers
service_description Mem Use
check_command check_nt!MEMUSE!80,90
}
define service{
use generic-service
hostgroup_name windows-servers
service_description Disk Space
check_command check_nt!USEDDISKSPACE!-l C!10,5
}
define service{
use generic-service
hostgroup_name windows-servers
service_description Service DNS
check_command check_nt!SERVICESTATE!-l W32Time,"Client DNS"
}
define service{
use generic-service
hostgroup_name dns-servers
service_description DNS Ext
check_command check_dns_ext
}
#define service{
# use generic-service
# hostgroup_name dns-servers
# service_description DNS Int
# check_command check_dns_int
#}