Unable to Create new Service

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nelsonw
Posts: 64
Joined: Wed Feb 22, 2017 4:03 am

Unable to Create new Service

Post by nelsonw »

Hi,

I have recently migrated my previous nagios XI installation to a new server. I am able to create new "commands", "hosts" and hostgroups on the new server, but it is not allowing me to save new Services

Firstly, when I try to clone an existing Service, I get the message
"Error while inserting the date to the database: Field 'exclude' doesn't have a default value'

Secondly, when I create a new Service from the beginning, I add a "host" or "hostgroup" and click "save". But when I go back in to the Service, the host information is lost. When I subsequently try to "Apply the Configuration" it fails, because there is no host information in the Service cfg file

Please help

Thanks,
Nelson
nelsonw
Posts: 64
Joined: Wed Feb 22, 2017 4:03 am

Re: Unable to Create new Service

Post by nelsonw »

Hi,

The problem also occurs when I update an existing Service in XI (i.e. any host information (or host group) information is removed when I save the Service. "Applying the configuration" then fails

Does the service configuration get saved in the database. It's like my "host" information is not there, although I can see it in the XI GUI


Thanks,
Nelson
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Unable to Create new Service

Post by benjaminsmith »

Hi Nelson,

The configuration is store in the nagiosql database. However, when you apply configuration the data in that database is written out to configuration files in the usr/local/nagios/etc directory.

A few questions:

1. How did you migrate the server? Did you perform a backup on the older server and restore this on the new one or install a new version of Nagios XI and copy over the configuration files.

2. Go to Configure > CCM > Tools > Config File Management, perform the following steps:

1. Delete Files
2. Write Configs
3. Verify Files .... If you have errors, try to correct them and continue the process again until they are resolved.
4. Restart Nagios Core

3. Send us your system profile, so we can check the database logs for errors. Thanks.

To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and share in a private message and then reply to this post to bring it up in the queue.
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!
nelsonw
Posts: 64
Joined: Wed Feb 22, 2017 4:03 am

Re: Unable to Create new Service

Post by nelsonw »

Hi Ben,

I had problems with my upgrade. I initially followed the steps in, https://assets.nagios.com/downloads/nag ... ios-XI.pdf, but afterwards did a fullinstall on the target server.

I ran the steps listed in point2 below, host information was still not being saved on the service configuration.

I have sent my profile.zip file in a private message.


Regards,
Nelson
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Unable to Create new Service

Post by benjaminsmith »

Hi Nelson,

If you copied the configurations over from the old server, this has to be done in a very exacting order or there will be configuration errors. Did you follow the guide below?

Importing Config Files From Nagios Core Into Nagios XI
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!
nelsonw
Posts: 64
Joined: Wed Feb 22, 2017 4:03 am

Re: Unable to Create new Service

Post by nelsonw »

Hi Ben,

I did not follow this document, as it was referring to migrating Nagios Core to XI. The migration I performed was Nagios XI on CentOS to NagiosXI on Ubuntu. Should I have followed the steps in your document. I only followed the "Back-Up and Restore" KB article.


Regards,
Nelson
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Unable to Create new Service

Post by benjaminsmith »

Hi Nelson,

The backup and restore is the best procedure, but I wasn't certain if you completed that process or not. There are plenty of warnings in the configurations, but I don't see any errors that would prevent Nagios XI from applying configuration.

However, there are messages in the logs for ndo not running ( the database backend). Please run the following commands to re-start Nagios and clear the system message queues. You'll have to log super user to run the commands su -s.

Code: Select all

systemctl stop crond
systemctl stop npcd
systemctl stop nagios
systemctl stop ndo2db
pkill -9 -u nagios
for i in $(ipcs -q | grep nagios |awk '{print $2}'); do ipcrm -q $i; done
rm -rf /usr/local/nagiosxi/var/dbmaint.lock
rm -rf /usr/local/nagiosxi/var/event_handler.lock
rm -rf /usr/local/nagiosxi/scripts/reconfigure_nagios.lock
systemctl restart mariadb
systemctl start ndo2db
systemctl start nagios
systemctl start npcd
systemctl start crond
Run the following tail command, then create a new service, apply configuration and let me know if it is successful. If not, please post the output to the thread. Thanks.
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!
nelsonw
Posts: 64
Joined: Wed Feb 22, 2017 4:03 am

Re: Unable to Create new Service

Post by nelsonw »

Hi,

It was not successfully.

Please find output
- Note, I do not have crond running on my Ubuntu server. Also, I am using mysql, rather than mariadb
:~# systemctl stop crond
Failed to stop crond.service: Unit crond.service not loaded.
:~# systemctl stop npcd
:~# systemctl stop nagios
:~# systemctl stop ndo2db
:~# pkill -9 -u nagios
:~# for i in $(ipcs -q | grep nagios |awk '{print $2}'); do ipcrm -q $i; done
:~# rm -rf /usr/local/nagiosxi/var/dbmaint.lock
:~# rm -rf /usr/local/nagiosxi/var/event_handler.lock
:~# rm -rf /usr/local/nagiosxi/scripts/reconfigure_nagios.lock
:~# systemctl restart mysql
:~# systemctl start ndo2db
:~# systemctl start nagios
:~# systemctl start npcd
:~# systemctl start crond
Failed to start crond.service: Unit crond.service not found.


Regarding the Service I created, all the information is saved, with exception of host or hostgroup information. E.g. I can update the Service description, command, servicegroup, etc, this works fine. It is only host information that is not being saved

Then when I apply configuration, I get
Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/TEST.cfg', starting on line 16)



:~$ cat /usr/local/nagios/etc/services/TEST.cfg
###############################################################################
#
# Services configuration file
#
# Created by: Nagios CCM 3.0.3
# Date: 2019-09-13 11:54:39
# Version: Nagios Core 4.x
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
service_description TEST
servicegroups SHARED BROKER FEEDS A_D
max_check_attempts 1
check_interval 1
retry_interval 1
check_period 24x5
notification_period 24x5
register 1
}

###############################################################################
#
# Services configuration file
#
# END OF FILE
#
###############################################################################
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Unable to Create new Service

Post by benjaminsmith »

Hi @nelsonw,

The error message is expected as that service has no associated host. Additionally, it's missing other required service settings and there's not setting to inherit these from a template. The required settings will have a * next to their name.

Try using one of the configuration wizards to test your system. For example, run the Nagios XI Server Wizard and see if it's able to successfully create host and services. This wizard will create services to monitor itself.
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!
Locked