Failed to Start Nagios service

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
brianribeiro
Posts: 4
Joined: Wed Jul 21, 2021 5:35 am

Failed to Start Nagios service

Post by brianribeiro »

Hi all,

I have installed nagios-4.4.6 version on my Raspbian GNU/Linux 10.
This operating system is installed on a Raspbery PI 4.
Everything seems to be fine but I can't start the Nagios service, I get the following error.

root@raspberrypi:/usr/local/nagios/etc# service nagios restart
Job for nagios.service failed because the control process exited with error code.
See "systemctl status nagios.service" and "journalctl -xe" for details.
root@raspberrypi:/usr/local/nagios/etc#

systemctl status nagios.service says:

root@raspberrypi:/usr/local/nagios/etc# systemctl status nagios.service
● nagios.service - Nagios Core 4.4.6
Loaded: loaded (/lib/systemd/system/nagios.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-07-21 12:38:58 CEST; 57s ago
Docs: https://www.nagios.org/documentation
Process: 5847 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=1/FAILURE)
Process: 5848 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)

Jul 21 12:38:58 raspberrypi nagios[5847]: ***> One or more problems was encountered while processing the config files...
Jul 21 12:38:58 raspberrypi nagios[5847]: Check your configuration file(s) to ensure that they contain valid
Jul 21 12:38:58 raspberrypi nagios[5847]: directives and data definitions. If you are upgrading from a previous
Jul 21 12:38:58 raspberrypi nagios[5847]: version of Nagios, you should be aware that some variables/definitions
Jul 21 12:38:58 raspberrypi nagios[5847]: may have been removed or modified in this version. Make sure to read
Jul 21 12:38:58 raspberrypi nagios[5847]: the HTML documentation regarding the config files, as well as the
Jul 21 12:38:58 raspberrypi nagios[5847]: 'Whats New' section to find out what has changed.
Jul 21 12:38:58 raspberrypi systemd[1]: nagios.service: Control process exited, code=exited, status=1/FAILURE
Jul 21 12:38:58 raspberrypi systemd[1]: nagios.service: Failed with result 'exit-code'.
Jul 21 12:38:58 raspberrypi systemd[1]: Failed to start Nagios Core 4.4.6.
root@raspberrypi:/usr/local/nagios/etc#



Also journalctl -xe says:

--
-- The unit nagios.service has entered the 'failed' state with result 'exit-code'.
Jul 21 12:40:30 raspberrypi systemd[1]: Failed to start Nagios Core 4.4.6.
-- Subject: A start job for unit nagios.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nagios.service has finished with a failure.
--
-- The job identifier is 2430 and the job result is failed.
Jul 21 12:42:55 raspberrypi systemd[1]: Starting Nagios Core 4.4.6...
-- Subject: A start job for unit nagios.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nagios.service has begun execution.
--
-- The job identifier is 2487.
Jul 21 12:42:55 raspberrypi nagios[5940]: Nagios Core 4.4.6
Jul 21 12:42:55 raspberrypi nagios[5940]: Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Jul 21 12:42:55 raspberrypi nagios[5940]: Copyright (c) 1999-2009 Ethan Galstad
Jul 21 12:42:55 raspberrypi nagios[5940]: Last Modified: 2020-04-28
Jul 21 12:42:55 raspberrypi nagios[5940]: License: GPL
Jul 21 12:42:55 raspberrypi nagios[5940]: Website: https://www.nagios.org
Jul 21 12:42:55 raspberrypi nagios[5940]: Reading configuration data...
Jul 21 12:42:55 raspberrypi nagios[5940]: Read main config file okay...
Jul 21 12:42:55 raspberrypi nagios[5940]: Error: Invalid host object directive 'address 172.20.61.175'.
Jul 21 12:42:55 raspberrypi nagios[5940]: Error: Could not add object property in file '/usr/local/nagios/etc/hosts/linux-host1.cfg' on line 20.
Jul 21 12:42:55 raspberrypi nagios[5940]: Error: Invalid max_check_attempts value for host 'linux-host1'
Jul 21 12:42:55 raspberrypi nagios[5940]: Error: Could not register host (config file '/usr/local/nagios/etc/hosts/linux-host1.cfg', starting on line 16)
Jul 21 12:42:55 raspberrypi nagios[5940]: Error processing object config files!
Jul 21 12:42:55 raspberrypi nagios[5940]: ***> One or more problems was encountered while processing the config files...
Jul 21 12:42:55 raspberrypi nagios[5940]: Check your configuration file(s) to ensure that they contain valid
Jul 21 12:42:55 raspberrypi nagios[5940]: directives and data definitions. If you are upgrading from a previous
Jul 21 12:42:55 raspberrypi nagios[5940]: version of Nagios, you should be aware that some variables/definitions
Jul 21 12:42:55 raspberrypi nagios[5940]: may have been removed or modified in this version. Make sure to read
Jul 21 12:42:55 raspberrypi nagios[5940]: the HTML documentation regarding the config files, as well as the
Jul 21 12:42:55 raspberrypi nagios[5940]: 'Whats New' section to find out what has changed.
Jul 21 12:42:55 raspberrypi systemd[1]: nagios.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStartPre= process belonging to unit nagios.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Jul 21 12:42:55 raspberrypi systemd[1]: nagios.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit nagios.service has entered the 'failed' state with result 'exit-code'.
Jul 21 12:42:55 raspberrypi systemd[1]: Failed to start Nagios Core 4.4.6.
-- Subject: A start job for unit nagios.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit nagios.service has finished with a failure.
--
-- The job identifier is 2487 and the job result is failed.


/usr/local/nagios/etc/services (linux-host1.cfg file) it's like:

define service{
use generic-service
host_name linux-host1
service_description check-host-alive
check_command check-host-alive
}

also, /usr/local/nagios/etc/hosts (linux-host1.cfg file) it's like:

define host{
name linux-box ; Name of this template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}

define host{
use linux-box ; Inherit default values from a template
host_name linux-host1 ; The name we're giving to this server
alias linux ; A longer name for the server
address 172.20.61.175 ; IP address of Remote Linux host
}


Sorry for the whole paragraph & my english, but this is my first time interacting with this system and I don't have much experience.
Can you tell me where I am going wrong?

Thanks in advance.

BR.
dkstuart23
Posts: 8
Joined: Thu Feb 18, 2021 2:42 pm

Re: Failed to Start Nagios service

Post by dkstuart23 »

at first glance, it looks like it doesn't like the following--
Jul 21 12:42:55 raspberrypi nagios[5940]: Error: Invalid max_check_attempts value for host 'linux-host1'

a couple things to try-
1) comment that line out and see if it works. without digging into that parameter further, I would guess that there is a default value.
2) research to see what values that parameter accepts. Maybe it doesn't like a double digit value.
brianribeiro
Posts: 4
Joined: Wed Jul 21, 2021 5:35 am

Re: Failed to Start Nagios service

Post by brianribeiro »

It seems to be solved by modifying some parameters in some .CFGs.
Sorry, I'm new to this.

Thanks for the help.
Locked