Notification mail pour Nagios core
bonjour
ça fait un moment que je cherche sans succès, alors je vous fait une petite demande pour m'éclairer sur ce que je fais de mal :(
J'ai un serveur Ubuntu server 16.10 avec Nagios et Postfix, mes tests d'envoi avec postfix fonctionnent sans problèmes ...
Néanmoins je n'arrive pas à recevoir d'alerte (par exemple quand un hôte est down ou up)
contacts.cfg
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email ******@gmail.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
} |
Mon matériel à check (je n'utilise pas encore les hostgroup alors je met tout dans un fichier)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
define host{
use generic-host
host_name test
alias test
address 192.168.0.10
check_period 24x7
check_interval 2
retry_interval 2
max_check_attempts 5
check_command ping
notifications_enabled 1
notification_period 24x7
notification_interval 100
notification_options d,u,r,f,s
contact_groups admins
register 1
} |
# Definition du service de Load Average
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| define service{
use generic-service
host_name test
service_description Load Average
check_command check_load!5.0,4.0,3.0!10.0,8.0,6.0
}
# Definition du service de controle d'url Web
define service{
use generic-service
host_name test
service_description Reponse interface Web Nagios
check_command check_http!"http://192.168.0.11/nagios"
notifications_enabled 0
}
# 'check_ping' command definition
define command{
command_name ping
command_line /usr/local/nagios/libexec/check_ping -H 192.168.0.10 -w 100.0,20% -c 500.0,60% -p 5
} |
commands.cfg
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
# '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$
} |
whereis mail
Code:
mail: /usr/bin/mail /etc/mail /etc/mail.rc /usr/share/man/man1/mail.1.gz
merci de l'aide que vous m’apporterait ;)