Page 2 of 2
Re: Error in a simple config on Nagios Core 4.4.3
Posted: Mon Apr 22, 2019 11:34 am
by tgriep
I missed it from before but the verify has to be the nagios.cfg file. Run this to verify the Nagios configuration files.
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
That was causing the Null error.
Re: Error in a simple config on Nagios Core 4.4.3
Posted: Mon Apr 22, 2019 11:55 am
by mpedros
Now I do not get an error because the file "oficina.cfg" is all commented. As soon as I unplug it, the error reappears.
Code: Select all
root@debianNC:/usr/local/nagios/etc/objects# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.4.3
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-01-15
License: GPL
Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Checked 8 services.
Checked 1 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 24 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 1 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
root@debianNC:/usr/local/nagios/etc/objects# cat oficina.cfg
#define host{
# use generic-networking-device
# host_name FIREWALL
# alias FIREWALL
# address 192.168.6.1
# }
#define service{
# use generic-service
# host_name FIREWALL
# service_description Ping
# check_command check_ping!60.0,5%!100.0,10%
# }
root@debianNC:/usr/local/nagios/etc/objects#
Re: Error in a simple config on Nagios Core 4.4.3
Posted: Mon Apr 22, 2019 12:21 pm
by tgriep
I would delete that file from the system and there is something wrong with it.
Copy the localhost.cfg file and use that as the template for the new "oficina.cfg" file . Leave the settings in the file but update the name and IP address and see if that works.
Re: Error in a simple config on Nagios Core 4.4.3
Posted: Mon Apr 22, 2019 12:53 pm
by mpedros
Hi:
I followed the steps you said to me using the localhost.cfg file as template and it gives me an eeror on line 21, just where the host definition starts, I attached the step by step to verify what I did:
Code: Select all
root@debianNC:/usr/local/nagios/etc/objects# ls
baxo.cfg contacts.cfg oficina.cfg switch.cfg timeperiods.cfg
commands.cfg localhost.cfg printer.cfg templates.cfg windows.cfg
root@debianNC:/usr/local/nagios/etc/objects# cp oficina.cfg BKPoficina22042019.cfg
root@debianNC:/usr/local/nagios/etc/objects# rm oficina.cfg
root@debianNC:/usr/local/nagios/etc/objects# cp localhost.cfg oficina.cfg
root@debianNC:/usr/local/nagios/etc/objects# nano oficina.cfg
root@debianNC:/usr/local/nagios/etc/objects# cat oficina.cfg
###############################################################################
# LOCALHOST.CFG - SAMPLE OBJECT CONFIG FILE FOR MONITORING THIS MACHINE
#
#
# NOTE: This config file is intended to serve as an *extremely* simple
# example of how you can create configuration entries to monitor
# the local (Linux) machine.
#
###############################################################################
###############################################################################
#
# 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 firewall
alias firewall
address 192.168.6.1
}
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
# Define a service to "ping" the local machine
define service {
use local-service ; Name of service template to use
host_name firewall
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
root@debianNC:/usr/local/nagios/etc/objects# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/objects/oficina.cfg
Nagios Core 4.4.3
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-01-15
License: GPL
Website: https://www.nagios.org
Reading configuration data...
Error in configuration file '/usr/local/nagios/etc/objects/oficina.cfg' - Line 21 (NULL value)
Error processing main config file!
root@debianNC:/usr/local/nagios/etc/objects# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.4.3
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-01-15
License: GPL
Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Checked 9 services.
Checked 2 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 24 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 2 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
root@debianNC:/usr/local/nagios/etc/objects#
Re: Error in a simple config on Nagios Core 4.4.3
Posted: Mon Apr 22, 2019 3:04 pm
by tgriep
The reason you are getting the error, is because you are using the wrong file in the verification command.
You should never use a host file in the verify command.
Only run this which will verify the mail config file and all of the config files defined in the main nagios.cfg file.
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
https://assets.nagios.com/downloads/nag ... onfig.html
Re: Error in a simple config on Nagios Core 4.4.3
Posted: Mon Apr 22, 2019 4:06 pm
by mpedros
Hi Tgriep:
I apologize for my error, looking for how to solve the problem in some place I read that could be verified with the name of the file that gives error as well. It is already working so we can consider this ticket closed.
Thank you again for the great help!
Re: Error in a simple config on Nagios Core 4.4.3
Posted: Tue Apr 23, 2019 8:40 am
by tgriep
OK. I'll close and lock the post for you. But feel free to open a new post in the future for any new questions.