Error when trying to import Hosts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nthaler
Posts: 35
Joined: Fri Jul 08, 2016 11:24 am

Error when trying to import Hosts

Post by nthaler »

Hello!

I went to add some hosts to our Nagios-XI instance and am receiving and error when I use Import Config Files from the CCM.

I am able to add hosts through the UI.

I have previously added over 1000 hosts via the import tool.

The error I am receiving is;
Field 'name' doesn't have a default valueEntry host_name::drupal-dev-mysql01 inside tbl_host could not be inserted: Field 'name' doesn't have a default value

We offloaded the MySQL DB after out intial upload of Hosts and Services and I am wondering if that has something to do with the error?

Any ideas on what I need to change to fix this so I can import hosts again?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error when trying to import Hosts

Post by tgriep »

Can you login to the XI server as root, run the following command and post the output? Replace xxx.xxx.xxx.xxx with the IP address of your MYSQL server.

Code: Select all

 echo 'desc tbl_host;' | mysql  -t -u nagiosql -pnagios --databases nagiosql -h xxx.xxx.xxx.xxx
We should be able to see if the database settings are correct for the remote MYSQL server.
Also, can you upload the host config file you are trying to import so we can view it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error when trying to import Hosts

Post by tgriep »

One more thing, can you post the /etc/my.cnf file and the files in this folder /etc/my.cnf.d folder from the MYSQL server?
Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
nthaler
Posts: 35
Joined: Fri Jul 08, 2016 11:24 am

Re: Error when trying to import Hosts

Post by nthaler »

When I run that I am getting the following

[root@nagios-02 ~]# echo 'desc tbl_host;' | mysql -t -u nagiosql -p nagios --databases nagiosql -h 10.220.50.1
mysql: unknown option '--databases'
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Error when trying to import Hosts

Post by dwhitfield »

You might have PMed these, but can you post the /etc/my.cnf file and the files in this folder /etc/my.cnf.d folder from the MYSQL server?

If you did PM them, please update this thread so it will pop back up on our dashboard.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error when trying to import Hosts

Post by tgriep »

Whoops, no "s" in that option, try this instead.

Code: Select all

echo 'desc tbl_host;' | mysql  -t -u nagiosql -pnagios --databases nagiosql -h xxx.xxx.xxx.xxx
Be sure to check out our Knowledgebase for helpful articles and solutions!
nthaler
Posts: 35
Joined: Fri Jul 08, 2016 11:24 am

Re: Error when trying to import Hosts

Post by nthaler »

I sent you the my.cnf

I don't see a difference in the 2 commands you asked me to run.

echo 'desc tbl_host;' | mysql -t -u nagiosql -pnagios --databases nagiosql -h xxx.xxx.xxx.xxx

echo 'desc tbl_host;' | mysql -t -u nagiosql -pnagios --databases nagiosql -h xxx.xxx.xxx.xxx

Host file I am trying to import.

define host {
use host
host_name drupal-dev-mysql01
alias drupal-dev-mysql01
address drupal-dev-mysql01.highwire.org
hostgroups dev-servers
}
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error when trying to import Hosts

Post by tgriep »

I took a look at the my.cnf file from your mysql server and the following needs to be changed.
Edit the /etc/my.cnf file and change the following from

Code: Select all

sql-mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
to

Code: Select all

sql-mode='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
Save the file and restart the mysql server by running this command

Code: Select all

service mysqld restart
The XI server cannot save entries in to the MYSQL server while it is setup in the STRICT mode.
Be sure to check out our Knowledgebase for helpful articles and solutions!
nthaler
Posts: 35
Joined: Fri Jul 08, 2016 11:24 am

Re: Error when trying to import Hosts

Post by nthaler »

This looks to have fixed it.

Thank you!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Error when trying to import Hosts

Post by rkennedy »

Awesome! Going to lock this one up and mark it resolved.
Former Nagios Employee
Locked