jonas kellens
2009-10-31 10:06:47 UTC
In /usr/local/nagios/etc/objects I have created a new asterisk.cfg :
[***@nagios objects]# ls -al
-rw-r--r-- 1 nagios nagios 1483 Oct 31 12:03 asterisk.cfg
-rw-rw-r-- 1 nagios nagios 7714 Oct 30 19:30 commands.cfg
-rw-rw-r-- 1 nagios nagios 2166 Oct 30 19:30 contacts.cfg
-rw-rw-r-- 1 nagios nagios 5403 Oct 30 19:30 localhost.cfg
-rw-rw-r-- 1 nagios nagios 3124 Oct 30 19:30 printer.cfg
-rw-rw-r-- 1 nagios nagios 3293 Oct 30 19:30 switch.cfg
-rw-rw-r-- 1 nagios nagios 10812 Oct 30 19:30 templates.cfg
-rw-rw-r-- 1 nagios nagios 3209 Oct 30 19:30 timeperiods.cfg
-rw-rw-r-- 1 nagios nagios 4019 Oct 30 19:30 windows.cfg
In /usr/local/nagios/etc/nagios.cfg I have added :
# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
# Definitions for monitoring the Hosted Asterisk server
cfg_file=/usr/local/nagios/etc/objects/asterisk.cfg
# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
# Definitions for monitoring a router/switch
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg
# Definitions for monitoring a network printer
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg
The asterisk.cfg contains the following :
# Define a host for Hosted Asterisk
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 asterisk
alias Hosted Asterisk
address ip_address
max_check_attempts 3
check_period 24x7
contact_groups admins
notification_interval 30
notification_period 24x7
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
define service{
host_name asterisk
service_description Root Partition
max_check_attempts 5
check_interval 5
retry_interval 3
check_period 24x7
contact_groups admins
check_command check_nrpe!check_disk
}
But I always get the config error :
[***@nagios objects]# service nagios reload
Running configuration check... CONFIG ERROR! Reload aborted. Check
your Nagios configuration.
Could someone tell me why ?!
According to the Nagios documentation
(http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html) I have
all the necessary fields filled in.
Jonas.
[***@nagios objects]# ls -al
-rw-r--r-- 1 nagios nagios 1483 Oct 31 12:03 asterisk.cfg
-rw-rw-r-- 1 nagios nagios 7714 Oct 30 19:30 commands.cfg
-rw-rw-r-- 1 nagios nagios 2166 Oct 30 19:30 contacts.cfg
-rw-rw-r-- 1 nagios nagios 5403 Oct 30 19:30 localhost.cfg
-rw-rw-r-- 1 nagios nagios 3124 Oct 30 19:30 printer.cfg
-rw-rw-r-- 1 nagios nagios 3293 Oct 30 19:30 switch.cfg
-rw-rw-r-- 1 nagios nagios 10812 Oct 30 19:30 templates.cfg
-rw-rw-r-- 1 nagios nagios 3209 Oct 30 19:30 timeperiods.cfg
-rw-rw-r-- 1 nagios nagios 4019 Oct 30 19:30 windows.cfg
In /usr/local/nagios/etc/nagios.cfg I have added :
# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
# Definitions for monitoring the Hosted Asterisk server
cfg_file=/usr/local/nagios/etc/objects/asterisk.cfg
# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
# Definitions for monitoring a router/switch
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg
# Definitions for monitoring a network printer
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg
The asterisk.cfg contains the following :
# Define a host for Hosted Asterisk
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 asterisk
alias Hosted Asterisk
address ip_address
max_check_attempts 3
check_period 24x7
contact_groups admins
notification_interval 30
notification_period 24x7
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
define service{
host_name asterisk
service_description Root Partition
max_check_attempts 5
check_interval 5
retry_interval 3
check_period 24x7
contact_groups admins
check_command check_nrpe!check_disk
}
But I always get the config error :
[***@nagios objects]# service nagios reload
Running configuration check... CONFIG ERROR! Reload aborted. Check
your Nagios configuration.
Could someone tell me why ?!
According to the Nagios documentation
(http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html) I have
all the necessary fields filled in.
Jonas.