PDA

View Full Version : Probleme au test de la config :(


clemmatt
02-15-2006, 12:04 PM
Bonjour alors voilà mon soucis (un parmis d'autres en l'occurence) :

Lorsque je tape:
bash-3.00# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg


ça me renvoie l'erreur :

Nagios 2.0
Copyright (c) 1999-2006 Ethan Galstad (http://www.nagios.org)
Last Modified: 02-07-2006
License: GPL

Reading configuration data...

Error: Unexpected token or statement in file '/usr/local/nagios/etc/minimal.cfg' on line 60.

***> One or more problems was encountered while processing the config files...


Donc du coup de file dans le fichier en question et là je tombe sur le ligne 60 :

# This is a sample host notification command that can be used to send email
# notifications (about host alerts) to contacts.

#define command{
(ligne 60)command_name host-notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
}

Voilà et quand je lance un /etc/init.d/nagios il me met :
bash-3.00# /etc/init.d/nagios restart
Running configuration check... FAILED! Restart aborted. Check your Nagios configuration.
bash-3.00#

C normal mais bon !!
Ca sent pas bon tout ça ! :lol:

Voilà merci de m'eclairer s'il vous plait !

surcouf
02-15-2006, 02:46 PM
# This is a sample host notification command that can be used to send email
# notifications (about host alerts) to contacts.

#define command{
(ligne 60)command_name host-notify-by-email


Rassure-moi, c'est d'origine ou bien le résultat d'un mauvais copié/collé ?

clemmatt
02-15-2006, 02:56 PM
le résultat d'un mauvais copié/collé :D
jvoulais préciser que c'etait celle là la ligne 60 et j'ai voulu mettre en italique mais ça a foiré normal lol !

Bon sinon une petite solution ? :wink:

surcouf
02-15-2006, 06:23 PM
le résultat d'un mauvais copié/collé :D
jvoulais préciser que c'etait celle là la ligne 60 et j'ai voulu mettre en italique mais ça a foiré normal lol !

Y compris le # précédant la directive "define" ?

clemmatt
02-16-2006, 10:38 AM
Yes Sir :wink:

surcouf
02-16-2006, 10:46 AM
Yes Sir :wink:

Dans ce cas, il nous faudrait le fichier complet.

templuche
02-16-2006, 11:29 AM
Bonjour,

Oreon ne gère pas la configuration de Nagios 2.X.

clemmatt
02-16-2006, 11:53 AM
Je me suis ptete trompé de section mais je n'ai pas oreon je n'ai que Nagios 2.0
Pour ce qui est du fichier de config minimal.cfg :

<bon j'ai mis en commentaire des ligne ou ça plantait :


################################################## #############################
# MINIMAL.CFG
#
# MINIMALISTIC OBJECT CONFIG FILE (Template-Based Object File Format)
#
# Last Modified: 08-10-2005
#
#
# NOTE: This config file is intended to be used to test a Nagios installation
# that has been compiled with support for the template-based object
# configuration files.
#
# This config file is intended to servce as an *extremely* simple
# example of how you can create your object configuration file(s).
# If you're interested in more complex object configuration files for
# Nagios, look in the sample-config/template-object/ subdirectory of
# the distribution.
#
################################################## #############################



################################################## #############################
################################################## #############################
#
# TIME PERIODS
#
################################################## #############################
################################################## #############################

# This defines a timeperiod where all times are valid for checks,
# notifications, etc. The classic "24x7" support nightmare. :-)

define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}



################################################## #############################
################################################## #############################
#
# COMMANDS
#
################################################## #############################
################################################## #############################

# This is a sample service notification command that can be used to send email
# notifications (about service alerts) to contacts.

#define command{
# command_name notify-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$OUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **"
#$CONTACTEMAIL$
# }


# This is a sample host notification command that can be used to send email
# notifications (about host alerts) to contacts.

#define command{
# command_name host-notify-by-email
# command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\
#\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
# }


# Command to check to see if a host is "alive" (up) by pinging it

#define command{
# command_name check-host-alive
# command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 99,99% -c 100,100% -p 1
# }


# Generic command to check a device by pinging it

#define command{
# command_name check_ping
# command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
# }


# Command used to check disk space usage on local partitions

#define command{
# command_name check_local_disk
# command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
# }


# Command used to check the number of currently logged in users on the
# local machine

#define command{
# command_name check_local_users
# command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
# }


# Command to check the number of running processing on the local machine

#define command{
# command_name check_local_procs
# command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$
# }


# Command to check the load on the local machine

#define command{
# command_name check_local_load
# command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
# }



################################################## #############################
################################################## #############################
#
# CONTACTS
#
################################################## #############################
################################################## #############################

# In this simple config file, a single contact will receive all alerts.
# This assumes that you have an account (or email alias) called
# "nagios-admin" on the local host.

define contact{
contact_name nagios-admin
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email nagios-admin@localhost
}



################################################## #############################
################################################## #############################
#
# CONTACT GROUPS
#
################################################## #############################
################################################## #############################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagios-admin
}



################################################## #############################
################################################## #############################
#
# HOSTS
#
################################################## #############################
################################################## #############################

# Generic host definition template - This is NOT a real host, just a template!

define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}


# Since this is a simple configuration file, we only monitor one host - the
# local host (this machine).

define host{
use generic-host ; Name of host template to use
host_name localhost
alias localhost
address 127.0.0.1
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,r
contact_groups admins
}



################################################## #############################
################################################## #############################
#
# HOST GROUPS
#
################################################## #############################
################################################## #############################

# We only have one host in our simple config file, so there is no need to
# create more than one hostgroup.

define hostgroup{
hostgroup_name test
alias Test Servers
members localhost
}



################################################## #############################
################################################## #############################
#
# SERVICES
#
################################################## #############################
################################################## #############################

# Generic service definition template - This is NOT a real service, just a template!

define service{
name generic-service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}


# Define a service to "ping" the local machine

define service{
use generic-service ; Name of service template to use
host_name localhost
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
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 generic-service ; Name of service template to use
host_name localhost
service_description Root Partition
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
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 generic-service ; Name of service template to use
host_name localhost
service_description Current Users
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
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 users.

define service{
use generic-service ; Name of service template to use
host_name localhost
service_description Total Processes
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_local_procs!250!400
}



# Define a service to check the load on the local machine.

define service{
use generic-service ; Name of service template to use
host_name localhost
service_description Current Load
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}



# EOF



merci bien