Failed to start LSB:

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.
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Failed to start LSB:

Post by DOkuwa »

I just did an upgrade on a new server and decided to stop and start Nagios service
and had this error message

Loaded: loaded (/etc/init.d/nagios; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-10-09 15:36:43 BST; 19min ago
Docs: man:systemd-sysv-generator(8)
Process: 6181 ExecStop=/etc/init.d/nagios stop (code=exited, status=0/SUCCESS)
Process: 6240 ExecStart=/etc/init.d/nagios start (code=exited, status=8)

Oct 09 15:36:43 ukldn-ixhs-nms02 nagios[6240]: Check your configuration file(s) to ensure that they contain valid
Oct 09 15:36:43 ukldn-ixhs-nms02 nagios[6240]: directives and data definitions. If you are upgrading from a previous
Oct 09 15:36:43 ukldn-ixhs-nms02 nagios[6240]: version of Nagios, you should be aware that some variables/definitions
Oct 09 15:36:43 ukldn-ixhs-nms02 nagios[6240]: may have been removed or modified in this version. Make sure to read
Oct 09 15:36:43 ukldn-ixhs-nms02 nagios[6240]: the HTML documentation regarding the config files, as well as the
Oct 09 15:36:43 ukldn-ixhs-nms02 nagios[6240]: 'Whats New' section to find out what has changed.
Oct 09 15:36:43 ukldn-ixhs-nms02 systemd[1]: nagios.service: Control process exited, code=exited status=8
Oct 09 15:36:43 ukldn-ixhs-nms02 systemd[1]: Failed to start LSB: Starts and stops the Nagios monitoring server.
Oct 09 15:36:43 ukldn-ixhs-nms02 systemd[1]: nagios.service: Unit entered failed state.
Oct 09 15:36:43 ukldn-ixhs-nms02 systemd[1]: nagios.service: Failed with result 'exit-code'



/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.3.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-08-24
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for host 'generic-host' (config file '/usr/local/nagios/etc/hosts.cfg', starting on line 88)


Error: Could not add object property in file '/usr/local/nagios/etc/hosts.cfg' on line 89.
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 24)
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.
bolson

Re: Failed to start LSB:

Post by bolson »

Code: Select all

Error: Could not add object property in file '/usr/local/nagios/etc/hosts.cfg' on line 89.
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 24)
Error processing object config files!
These configuration errors will need to be corrected before you will be able to start Nagios.

Please post the contents of the following files inside of a

Code: Select all

 tag:

/usr/local/nagios/etc/hosts.cfg
/usr/local/nagios/etc/objects/localhost.cfg
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Failed to start LSB:

Post by scottwilkerson »

Can you post the files with the error
/usr/local/nagios/etc/hosts.cfg
/usr/local/nagios/etc/objects/localhost.cfg


And we can take a look. You may also want to look at the lines in question of each of these files to diagnose the error.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: Failed to start LSB:

Post by DOkuwa »

Thanks
for your email
I am sending both files host.cfg and localhost.cfg as an attachment
I have truncated part of the hosts.cfg as in don't think is important( correct me if I am wrong)
I also copied this files from the old server which is working at the moment
Attachments
localhost.cfg
(5.25 KiB) Downloaded 756 times
host.cfg-updated.docx
(19.65 KiB) Downloaded 278 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Failed to start LSB:

Post by scottwilkerson »

You do not have a value set in localhost for max_check_attempts but it does use a template linux-server

However, I could not view linux-server as it was in neither file

you could add something like this to localhost and see if you get further

Code: Select all

max_check_attempts			5
check_interval			5
retry_interval			1
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: Failed to start LSB:

Post by DOkuwa »

thanks
where do I place this at the beginning or at the end
or it does not matter
this is not also present in my old nagios
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Failed to start LSB:

Post by scottwilkerson »

in localhost.cfg between { and }

like so

Code: Select all

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
        max_check_attempts         5
        check_interval         5
        retry_interval         1
        }
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: Failed to start LSB:

Post by DOkuwa »

hello
I have done for the define hosts only and the result the same( not starting the Nagios service)
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
        max_check_attempts         5
        check_interval         5
        retry_interval         1
        }
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: Failed to start LSB:

Post by DOkuwa »

@scottwilkerson
I know I think why Nagios is failing
it is my Nagios.cfg file
I have removed the amended one and have used the one that is bare I mean no configuration on it by myself
and the service started
but now my only issue is that I need to configure my Nagios server to include all the hosts,check,command etc which I don't think I can do thru the GUI
PLEASE TELL ME


/usr/local/nagios/etc# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg


Nagios Core 4.3.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-08-24
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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Failed to start LSB:

Post by scottwilkerson »

DOkuwa wrote:I know I think why Nagios is failing
it is my Nagios.cfg file
I have removed the amended one and have used the one that is bare I mean no configuration on it by myself
and the service started
but now my only issue is that I need to configure my Nagios server to include all the hosts,check,command etc which I don't think I can do thru the GUI
PLEASE TELL ME
Ok, you will need to look for the lines in your old nagios.cfg for lines that start with the following and copy them to the new file

Code: Select all

cfg_file=
cfg_dir=
This will add the directories to your configuration files.

Once you do that you will want to run the verification again

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked