Failed to start LSB:

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Failed to start LSB:

Postby DOkuwa » Mon Oct 09, 2017 9:59 am

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

Re: Failed to start LSB:

Postby bolson » Mon Oct 09, 2017 11:37 am

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] tag:

/usr/local/nagios/etc/hosts.cfg
/usr/local/nagios/etc/objects/localhost.cfg
Brian Olson
Nagios Support Team
---
Nagios Enterprises, LLC
Email: customersupport@nagios.com
Web: https://www.nagios.com/
User avatar
bolson
Support Tech
 
Posts: 595
Joined: Tue Jul 11, 2017 10:34 am

Re: Failed to start LSB:

Postby scottwilkerson » Mon Oct 09, 2017 11:55 am

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.
User avatar
scottwilkerson
CTO
 
Posts: 7904
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Failed to start LSB:

Postby DOkuwa » Tue Oct 10, 2017 6:11 am

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 15 times
host.cfg-updated.docx
(19.65 KiB) Downloaded 10 times
DOkuwa
 
Posts: 58
Joined: Tue Aug 15, 2017 3:54 pm

Re: Failed to start LSB:

Postby scottwilkerson » Tue Oct 10, 2017 9:38 am

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
User avatar
scottwilkerson
CTO
 
Posts: 7904
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Failed to start LSB:

Postby DOkuwa » Tue Oct 10, 2017 9:54 am

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

Re: Failed to start LSB:

Postby scottwilkerson » Tue Oct 10, 2017 9:58 am

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
        }
User avatar
scottwilkerson
CTO
 
Posts: 7904
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Failed to start LSB:

Postby DOkuwa » Tue Oct 10, 2017 10:16 am

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: 58
Joined: Tue Aug 15, 2017 3:54 pm

Re: Failed to start LSB:

Postby DOkuwa » Tue Oct 10, 2017 10:49 am

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

Re: Failed to start LSB:

Postby scottwilkerson » Tue Oct 10, 2017 12:03 pm

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
User avatar
scottwilkerson
CTO
 
Posts: 7904
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Next

Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 29 guests