Error in a simple config on Nagios Core 4.4.3
Error in a simple config on Nagios Core 4.4.3
Hi:
I just installed the version of Nagios Core 4.4.3, make a very simple configuration and I can not find the error ...
Configure 1 single host with only one service:
root@debianNC:/usr/local/nagios/etc/objects# cat oficina.cfg
define host{
use generic-host
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#
Add the file "oficina.cfg" to the file "nagios.cfg":
# 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
cfg_file=/usr/local/nagios/etc/objects/oficina.cfg
And when verifying it gives me the following errors:
root@debianNC:/usr/local/nagios/etc# /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 1 (NULL value)
Error processing main config file!
root@debianNC:/usr/local/nagios/etc# /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...
Error: Cannot open config file '/usr/local/nagios/etc/objects/baxo.cfg' for reading: No such file or directory
Error: Invalid max_check_attempts value for host 'FIREWALL'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/oficina.cfg', starting on line 1)
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data definitions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
Can someone help me that I can not identify the error?
Thank you very much in advance!
Martin Pedros
I just installed the version of Nagios Core 4.4.3, make a very simple configuration and I can not find the error ...
Configure 1 single host with only one service:
root@debianNC:/usr/local/nagios/etc/objects# cat oficina.cfg
define host{
use generic-host
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#
Add the file "oficina.cfg" to the file "nagios.cfg":
# 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
cfg_file=/usr/local/nagios/etc/objects/oficina.cfg
And when verifying it gives me the following errors:
root@debianNC:/usr/local/nagios/etc# /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 1 (NULL value)
Error processing main config file!
root@debianNC:/usr/local/nagios/etc# /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...
Error: Cannot open config file '/usr/local/nagios/etc/objects/baxo.cfg' for reading: No such file or directory
Error: Invalid max_check_attempts value for host 'FIREWALL'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/oficina.cfg', starting on line 1)
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data definitions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
Can someone help me that I can not identify the error?
Thank you very much in advance!
Martin Pedros
Last edited by mpedros on Mon Apr 22, 2019 4:08 pm, edited 1 time in total.
Martin Pedros
Re: Error in a simple config on Nagios Core 4.4.3
What is the output of this command:Error: Cannot open config file '/usr/local/nagios/etc/objects/baxo.cfg' for reading: No such file or directory
Error: Invalid max_check_attempts value for host 'FIREWALL'
Code: Select all
ls -l /usr/local/nagios/etc/objects
Code: Select all
define host {
use generic-host
host_name FIREWALL
alias Firewall
check_interval 5
max_check_attempts 5
retry_interval 1
address 192.168.6.1
}
Re: Error in a simple config on Nagios Core 4.4.3
Hi ssax:
Thank you very much for your prompt response. I made the requested changes and I continue with the same error:
Thanks,
Martin Pedros
Thank you very much for your prompt response. I made the requested changes and I continue with the same error:
Code: Select all
root@debianNC:/usr/local/nagios/etc/objects# ls -l /usr/local/nagios/etc/objects
total 60
-rw-rw-r-- 1 nagios nagios 6747 abr 8 16:46 commands.cfg
-rw-rw-r-- 1 nagios nagios 1797 abr 8 16:46 contacts.cfg
-rw-rw-r-- 1 nagios nagios 4777 abr 8 16:46 localhost.cfg
-rw-r--r-- 1 root nagios 142 abr 12 08:56 oficina.cfg
-rw-rw-r-- 1 nagios nagios 3001 abr 8 16:46 printer.cfg
-rw-rw-r-- 1 nagios nagios 3484 abr 8 16:46 switch.cfg
-rw-r--r-- 1 root nagios 1088 abr 11 11:19 templates_baxo.cfg
-rw-rw-r-- 1 nagios nagios 12533 abr 8 16:46 templates.cfg
-rw-rw-r-- 1 nagios nagios 3512 abr 8 16:46 timeperiods.cfg
-rw-rw-r-- 1 nagios nagios 4074 abr 8 16:46 windows.cfg
root@debianNC:/usr/local/nagios/etc/objects# cat oficina.cfg
define host {
use generic-host
host_name FIREWALL
alias Firewall
check_interval 5
max_check_attempts 5
retry_interval 1
address 192.168.6.1
}
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 1 (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...
Error: Cannot open config file '/usr/local/nagios/etc/objects/baxo.cfg' for reading: No such file or directory
Error: Invalid max_check_attempts value for host 'localhost'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/localhost.cfg', starting on line 21)
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data definitions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
root@debianNC:/usr/local/nagios/etc/objects#
Martin Pedros
Martin Pedros
Re: Error in a simple config on Nagios Core 4.4.3
Ssax:
I add a test that I did, the same configuration in the Nagios Core of my house works well, the only difference is that I have the version Nagios Core 4.4.0, will there be a problem with version 4.4.3? Attached captures:
Home Config:
Office config:
Thanks,
Martin Pedros
I add a test that I did, the same configuration in the Nagios Core of my house works well, the only difference is that I have the version Nagios Core 4.4.0, will there be a problem with version 4.4.3? Attached captures:
Home Config:
Office config:
Thanks,
Martin Pedros
Martin Pedros
Re: Error in a simple config on Nagios Core 4.4.3
Lets reset the permissions on the config file and make sure there are not any hidden characters in the file.
Run this as root to do that.
Install the dos2unix application on the server and run this to clear then out.
See if that helps.
If not, can you get all of the config files from the server, zip them up and upload them to the post so we can view them?
The error may be coming from the template file.
Run this as root to do that.
Code: Select all
chown nagios.nagios /usr/local/nagios/etc/objects/oficina.cfg
cmmod 664 /usr/local/nagios/etc/objects/oficina.cfg
Code: Select all
dos2unix /usr/local/nagios/etc/objects/oficina.cfg
If not, can you get all of the config files from the server, zip them up and upload them to the post so we can view them?
The error may be coming from the template file.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Error in a simple config on Nagios Core 4.4.3
Hi Tgriep:
The commands did not work for me. I attach the requested files.
Thanks in advance!
Martin Pedros
The commands did not work for me. I attach the requested files.
Thanks in advance!
Martin Pedros
- Attachments
-
- nagios-core-443.tar
- Files
- (92 KiB) Downloaded 145 times
Martin Pedros
Re: Error in a simple config on Nagios Core 4.4.3
Thanks for the files.
In the oficina.cfg file you are specifying a template called generic-networking-device but that template does not exist is any of the other templates.
Edit the template.cfg file and add this example to it. Save it and restart nagios to see if it runs now.
In the oficina.cfg file you are specifying a template called generic-networking-device but that template does not exist is any of the other templates.
Edit the template.cfg file and add this example to it. Save it and restart nagios to see if it runs now.
Code: Select all
define host {
name generic-networking-device ; The name of this host template
use generic-host ; This template inherits other values from the generic-host template
check_command check-host-alive ; Default command to check Linux hosts
check_interval 5 ; Actively check the host every 5 minutes
check_period 24x7
contact_groups admins ; Notifications get sent to the admins by default
max_check_attempts 5
notification_interval 120 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
notification_period 24x7
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
retry_interval 1 ; Schedule host check retries at 1 minute intervals
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Error in a simple config on Nagios Core 4.4.3
Hi Tgriep:
Sorry for the delay. I've tried it and it's the same error. In the next few days I will be a bit complicated to move forward with the tests, if you want to close this case. As soon as I can, I will resume the tests. Thank you very much for all the support.
Regards,
Martin Pedros
Sorry for the delay. I've tried it and it's the same error. In the next few days I will be a bit complicated to move forward with the tests, if you want to close this case. As soon as I can, I will resume the tests. Thank you very much for all the support.
Regards,
Martin Pedros
Martin Pedros
Re: Error in a simple config on Nagios Core 4.4.3
One more thing to try.
You have this configuration file in the nagios.cfg
But the file did not exist in the archive file from your previous post.
Remove that line from the nagios.cfg file and see if that fixes the issue.
You have this configuration file in the nagios.cfg
Code: Select all
cfg_file=/usr/local/nagios/etc/objects/baxo.cfg
Remove that line from the nagios.cfg file and see if that fixes the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Error in a simple config on Nagios Core 4.4.3
Hi Tgriep:
I had already verified that and I still have the same problem. What I do not understand is why I get that null error, and if I commented everything, it gives me the logical error that it is not in my account or host and service.
I had already verified that and I still have the same problem. What I do not understand is why I get that null error, and if I commented everything, it gives me the logical error that it is not in my account or host and service.
Code: Select all
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# /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# /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 1 (NULL value)
Error processing main config file!
root@debianNC:/usr/local/nagios/etc/objects#
Code: Select all
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# /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...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Error: There are no services defined!
Checked 0 services.
Error: There are no hosts defined!
Checked 0 hosts.
Checked 0 host groups.
Checked 0 service groups.
Error: There are no contacts defined!
Checked 0 contacts.
Checked 0 contact groups.
Checked 0 commands.
Checked 0 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 0 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 0 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Warning: Nothing specified for illegal_macro_output_chars variable!
Total Warnings: 1
Total Errors: 3
***> One or more problems was encountered while running the pre-flight check...
Check your configuration file(s) to ensure that they contain valid
directives and data definitions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
root@debianNC:/usr/local/nagios/etc/objects#
Martin Pedros