PDA

View Full Version : [REGLE] Notification par mail pour les services


srenon
03-08-2006, 01:31 PM
Bonjour,


Lorsqu'un service tombe je reçois la notification de la part de l'hote et pas de la part du service lui même!!!

la commande pour la notification des services se nome notify_by_email elle contient ceci :

/usr/bin/printf "%b" "***** Nagios 1.X *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

Aurais je mal compris quelque chose?

Sebastien

templuche
03-08-2006, 02:03 PM
Bonjour,

Indique la configuration de ton service pour voir? Fait un copier-coller de toutes les directives (et de celles du template si il y a bien entendu).

srenon
03-08-2006, 03:34 PM
voici un exemple de définition de service

define service{
use STemplate_Tomcat
service_description SDM2g
host_name xinf-prodias
check_command check_http_tomcat!80!"http://xinf-prodias/sdm/......"
normal_check_interval 5
retry_check_interval 1
freshness_threshold 0
low_flap_threshold 0
high_flap_threshold 0
}

et le template associée!!


# 'STemplate_Tomcat' service definition 159
#
#service_id 424
define service{
name STemplate_Tomcat
service_description STemplate_Tomcat
is_volatile 1
check_command check_http_tomcat!80!url!a rechercher
max_check_attempts 3
normal_check_interval 10
retry_check_interval 5
active_checks_enabled 1
passive_checks_enabled 1
check_period 24x7
parallelize_check 1
obsess_over_service 1
check_freshness 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 0
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
contact_groups ServeursHTTP
stalking_options o,w,u,c
register 0
}


Voili voilou

surcouf
03-08-2006, 03:38 PM
voici un exemple de définition de service

define service{
use STemplate_Tomcat
service_description SDM2g
host_name xinf-prodias
check_command check_http_tomcat!80!"http://xinf-prodias/sdm/......"
normal_check_interval 5
retry_check_interval 1
freshness_threshold 0
low_flap_threshold 0
high_flap_threshold 0
}

et le template associée!!


# 'STemplate_Tomcat' service definition 159
#
#service_id 424
define service{
name STemplate_Tomcat
service_description STemplate_Tomcat
is_volatile 1
check_command check_http_tomcat!80!url!a rechercher
max_check_attempts 3
normal_check_interval 10
retry_check_interval 5
active_checks_enabled 1
passive_checks_enabled 1
check_period 24x7
parallelize_check 1
obsess_over_service 1
check_freshness 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 0
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
contact_groups ServeursHTTP
stalking_options o,w,u,c
register 0
}


Et celles des contacts appartenant au contactgroup ServeursHTTP ?
Ainsi que celles du fichier nagios.cfg et on aura fait le tour.

templuche
03-08-2006, 03:40 PM
Bonjour,

Pardon j'ai oublié une information : les contacts du contactgroup ServeursHttp .

srenon
03-08-2006, 04:06 PM
# 'ServeursHTTP' Contactgroup definition 4
#
define contactgroup{
contactgroup_name ServeursHTTP
alias ServeursHTTP
members Sebastien_RENON
}

################################################## #################
# #
# GENERATED BY OREON #
# #
# Developped by : #
# - Julien Mathis #
# - Romain Le Merlus #
# #
# www.oreon.org #
# For information : contact@oreon.org #
################################################## #################

################################################## #################
# #
# Last modification March 8, 2006, 12:21 pm #
# By S øbastien RENON #
# #
################################################## #################

log_file=/usr/local/nagios/var/nagios.log


cfg_file=/usr/local/nagios/etc/checkcommands.cfg
cfg_file=/usr/local/nagios/etc/misccommands.cfg
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/dependencies.cfg
cfg_file=/usr/local/nagios/etc/escalations.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg

resource_file=/usr/local/nagios/etc/resource.cfg

aggregate_status_updates=1

status_update_interval=15

status_file=/usr/local/nagios/var/status.log

nagios_user=nagios
nagios_group=nagios

check_external_commands=1
command_check_interval=-1

command_file=/usr/local/nagios/var/rw/nagios.cmd
comment_file=/usr/local/nagios/var/comment.log
downtime_file=/usr/local/nagios/var/downtime.log
lock_file=/usr/local/nagios/var/nagios.lock
temp_file=/usr/local/nagios/var/rw/nagios.tmp


log_rotation_method=d
log_archive_path=/usr/local/nagios/var/archives/

use_syslog=1
log_notifications=1
log_service_retries=1
log_host_retries=1
log_event_handlers=1
log_initial_states=0

log_external_commands=1

log_passive_service_checks=0

inter_check_delay_method=n
service_interleave_factor=s

max_concurrent_checks=20
service_reaper_frequency=10
sleep_time=1


service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5


retain_state_information=1
state_retention_file=/usr/local/nagios/var/status.sav
retention_update_interval=60
use_retained_program_state=1

interval_length=60
use_agressive_host_checking=0
execute_service_checks=1
accept_passive_service_checks=1

check_service_freshness=0
enable_notifications=1
enable_event_handlers=1
process_performance_data=1


obsess_over_services=0
check_for_orphaned_services=0


freshness_check_interval=60
aggregate_status_updates=1
status_update_interval=15
enable_flap_detection=0


low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0


date_format=euro

illegal_object_name_chars=`~!$^&*|'"<>,()?=
illegal_macro_output_chars=`~$&|'"<>

admin_email=nagios
admin_pager=nagiospager


Autre chose?

templuche
03-08-2006, 04:54 PM
les contacts du contactgroup.

srenon
03-08-2006, 05:08 PM
# 'Sebastien_RENON' contact definition 1
#
define contact{
contact_name Sebastien_RENON
alias Sebastien_RENON
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands host-notify-by-email
service_notification_period 24x7
service_notification_options w,u,c,r
service_notification_commands host-notify-by-email
email sebastien.renon@haras-nationaux.fr
}

et je crois que le problème viens d'ici :
service_notification_commands host-notify-by-email !!!!

templuche
03-08-2006, 05:20 PM
Exactement!

srenon
03-08-2006, 05:22 PM
Merci de votre aide !!!