Unable to add Host

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Unable to add Host

Postby DW2020 » Fri Jun 12, 2020 7:35 am

I followed the instructions for installing NagiOS Core here: https://pimylifeup.com/raspberry-pi-nagios/ and everything went fine with no errors whatsoever. When I tried to issue this command (sudo systemctl restart nagios) so that I could see the newly added host in the web Gui I get this error: Job for nagios.service failed because the control process exited with error code. See "systemctl status nagios.service" and "journalctl -xe" for details.

The web Gui says "Unable to get process status" and I look udner hosts and the host has not been added.

I have also tried a full reboot of the Rpi that is running NagiOS.

Any ideas please?

Thanks in advance!
DW2020
 
Posts: 6
Joined: Fri Jun 12, 2020 7:23 am

Re: Unable to add Host

Postby DW2020 » Fri Jun 12, 2020 9:14 am

I have tried rebuilding this from scratch and get the exact same result again.
DW2020
 
Posts: 6
Joined: Fri Jun 12, 2020 7:23 am

Re: Unable to add Host

Postby benjaminsmith » Fri Jun 12, 2020 2:55 pm

Hi @DW2020,

Thanks for joining the Nagios Community Forum! I would highly recommend following our official instructions on Raspbian:

https://support.nagios.com/kb/article/n ... l#Raspbian

The error message suggests the nagios service cannot start. I would recommend checking the system messages for clues (/var/log/messages).

There also may be an error in the object configuration files. Run the following command to verify the current configuration files.
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 2894
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Unable to add Host

Postby DW2020 » Fri Jun 12, 2020 3:12 pm

From running that command I get:

-bash: /usr/local/nagios/bin/nagios: Permission denied
DW2020
 
Posts: 6
Joined: Fri Jun 12, 2020 7:23 am

Re: Unable to add Host

Postby DW2020 » Fri Jun 12, 2020 3:26 pm

I am wiping the MicroSD and following the install instructions from the link you ahve guven me and will report abck on whetehr I get the same problem.

Scanning through the install instructions I dont see instructions for adding hosts, is there a set of instructions for this or do I follow below:

Adding your Host to Nagios

In this section, we will be showing you how to add your host to a configuration file that Nagios will read.

To do this, we will need to create a configuration file where we will define the various details of the device we want to monitor.

1. Let us start by changing into the “objects” configuration folder for Nagios.

This folder, by default, contains some sample configuration files. These files can be useful for seeing how to configure Nagios.

cd /usr/local/nagios/etc/objects

2. Let us now create a config file where we will specify our host’s configuration.

For this example, we will be calling this file pimylifeuphost.conf, however its best to use a name that best describes your device.

sudo nano pimylifeuphost.conf

3. Within this file, we need to enter the following lines.

You will need to make sure that you specify the IP address of the device you want to perform checks on.

define host {
use linux-server ; Host group to use
host_name Pi My Life Up Host ; Name of this host
alias pimylifeuphost ; Alias
address [YOURHOSTIPADDRESS] ; IP Address
}

This basic configuration will allow us to at least monitor whether the device is online by sending a ping request to it.

4. Once done, save the file by pressing CTRL + X, followed by Y, then ENTER

5. Next, we need to modify our Nagios configuration so that it knows to read our new config file.

Begin modifying the config file by running the following command.

sudo nano /usr/local/nagios/etc/nagios.cfg

6. Within this file, find the following line and add our new config line below it.

Find

cfg_file=/usr/local/nagios/etc/objects/templates.cfg

Add Below

cfg_file=/usr/local/nagios/etc/objects/pimylifeuphost.conf

Now when we restart Nagios, it will know to read this file and load in our settings defined within it.

7. Save the configuration file by pressing CTRL + X, followed by Y, then ENTER

8. We can now restart the Nagios service on our Raspberry Pi by using the command below.

sudo systemctl restart nagios
DW2020
 
Posts: 6
Joined: Fri Jun 12, 2020 7:23 am

Re: Unable to add Host

Postby DW2020 » Fri Jun 12, 2020 5:44 pm

OK, have tried again and when I install the host to monitor everythign falls over but this time I ran the /usr/local/nagios/bin/nagios -v /usr/ local/nagios/etc/nagios.cfg with SUDO in front and got the below input which I will try to figure out:

Nagios Core 4.4.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-08-20
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Unexpected EOF in file '/usr/local/nagios/etc/objects/PiAware.conf' on line 5 - ch eck for a missing closing bracket.
Error: Invalid max_check_attempts value for host 'PiAware.lan'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/PiAware.conf', 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.
DW2020
 
Posts: 6
Joined: Fri Jun 12, 2020 7:23 am

Re: Unable to add Host

Postby scottwilkerson » Mon Jun 15, 2020 1:39 pm

Can you share the contents of /usr/local/nagios/etc/objects/PiAware.conf ?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 18640
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Unable to add Host

Postby DW2020 » Tue Jun 16, 2020 3:32 am

I rechecked the file and found my mistake after going through it a few times but many thanks for answering.

DW
DW2020
 
Posts: 6
Joined: Fri Jun 12, 2020 7:23 am

Re: Unable to add Host

Postby benjaminsmith » Thu Jun 18, 2020 5:00 pm

Hi DW,
I rechecked the file and found my mistake after going through it a few times but many thanks for answering.

Great! Glad to hear you got it working.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 2894
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul


Return to Community Support

Who is online

Users browsing this forum: No registered users and 29 guests