Italia998
asked on
What is the error i this Nagios config file?
Nagios just installed, works fine. I added this line to my nagios.cfg;
Works fine if the test-devs.cfg is empty, I tossed this into the config file, what is wrong?
cfg_file=/etc/nagios/objects/test-devs.cfg
Works fine if the test-devs.cfg is empty, I tossed this into the config file, what is wrong?
define host{
use linux-server ;
host_name 172.16.55.71 ;
alias Test Server 01 ;
address 172.16.55.71 ;
}
define hostgroup{
hostgroup_name linux-servers ;
alias Linux Servers ;
}
define service{
use 172.16.55.71.services ;
host_name 172.16.55.71 ;
service_description HTTP
check_command check_http
notifications_enabled 0
}
I checked the existing config files, there is no linux-hosts actually defined anywhere and Nagios starts up fine, until I just add my own test host.
;
at the end of most of the lines is probably where your issue is coming from
Ps instead of using
cfg_file=/etc/nagios/objec ts/test-de vs.cfg
you can use
cfg_dir=/etc/nagios/hosts
then move the file test-devs.cfg from the objects directory to the hosts directory so that you can keep configuration objects and regular host / service defenition files seperated.
at the end of most of the lines is probably where your issue is coming from
Ps instead of using
cfg_file=/etc/nagios/objec
you can use
cfg_dir=/etc/nagios/hosts
then move the file test-devs.cfg from the objects directory to the hosts directory so that you can keep configuration objects and regular host / service defenition files seperated.
ASKER
So, the items in the config file look correct?
ASKER
Here is my /etc/nagios/nagios.cfg
So, I followed what I saw in localhost.cfg
Why would mine not work and localhost work? It would be helpful if Nagios actually entered an error into its logfile....
# OBJECT CONFIGURATION FILE(S)
# These are the object configuration files in which you define hosts,
# host groups, contacts, contact groups, services, etc.
# You can split your object definitions across several config files
# if you wish (as shown below), or keep them all in a single config file.
# You can specify individual object config files as shown below:
cfg_file=/etc/nagios/objects/commands.cfg
cfg_file=/etc/nagios/objects/contacts.cfg
cfg_file=/etc/nagios/objects/timeperiods.cfg
cfg_file=/etc/nagios/objects/templates.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/etc/nagios/objects/localhost.cfg
# Definitions for monitoring a Windows machine
#cfg_file=/etc/nagios/objects/windows.cfg
# Definitions for monitoring a router/switch
#cfg_file=/etc/nagios/objects/switch.cfg
# Definitions for monitoring a network printer
#cfg_file=/etc/nagios/objects/printer.cfg
#cfg_file=/etc/nagios/objects/ups.cfg
cfg_file=/etc/nagios/objects/test-devs.cfg
So, I followed what I saw in localhost.cfg
###############################################################################
###############################################################################
#
# 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%
}
Why would mine not work and localhost work? It would be helpful if Nagios actually entered an error into its logfile....
What error do you get when you run the nagios configuration validation as shown below?
/usr/local/nagios/bin/nagi os -v /usr/local/nagios/etc/nagi os.cfg
/usr/local/nagios/bin/nagi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not quite what I needed, but close enough. ty ;)
ASKER
Nagios log has not a single error listed.