Unable to Import Configs/ and add hosts/services via api

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
madhukarneelaiahgari
Posts: 18
Joined: Wed May 01, 2019 12:38 pm

Unable to Import Configs/ and add hosts/services via api

Post by madhukarneelaiahgari »

Hello Team,

I'm having few issues after installing nagiosxi in our environment.

I'm unable to import any configs via UI and also add any services/hosts using api commands.

The error i'm seeing while importing the configs are:

Field 'display_name' doesn't have a default valueEntry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value
Entry config_name::base_amazon_rds inside tbl_service could not be inserted: Field 'display_name' doesn't have a default value

API Call Issue:

Even though CURL commands gives an out as service is added to nagios core , im unable to see the services in the UI.

I spoke to an sales representative and found my licenes has active support and maintenance benefits until December 08th, 2019.

Is it possible to troubleshoot this over a phone call and screen share ?

Please let me know.

Regards,
Madhu.

Regards,
Madhu.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by lmiltchev »

When you imported the files in XI, did you do it in this order?
Commands > Time Periods > Contact Templates > Contacts > Contact Groups > Host Templates > Hosts > Host Groups > Service Templates > Services > Service Groups
Did you run the Import Prep tool on the files before importing them?

https://library.nagios.com/library/prod ... -prep-tool

Run the following commands and show the output:

Code: Select all

uname -a
cat /etc/*release
chage -l nagios
grep nag /etc/group
grep nagios /etc/passwd
cat /etc/my.cnf
Is it possible to troubleshoot this over a phone call and screen share ?
If you purchased a phone support, you could call our main number (1-888-624-4671 or 651-204-9102) with ext. 4. Usually, we offer remote sessions only after all other support options, e.g. forum, ticketing system, etc. have been exhausted.
Be sure to check out our Knowledgebase for helpful articles and solutions!
madhukarneelaiahgari
Posts: 18
Joined: Wed May 01, 2019 12:38 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by madhukarneelaiahgari »

uname -a
Linux xxx 4.1.12-61.1.28.el7uek.x86_64 #2 SMP Thu Feb 23 19:55:12 PST 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@xxx ~]# cat /etc/*release
Oracle Linux Server release 7.3
NAME="Oracle Linux Server"
VERSION="7.3"
ID="ol"
VERSION_ID="7.3"
PRETTY_NAME="Oracle Linux Server 7.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.3
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Oracle Linux Server release 7.3
[root@xxx ~]# chage -l nagios
Last password change : Jun 13, 2019
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
[root@xxx ~]# grep nag /etc/group
nagios:x:1002:nagios,apache
nagcmd:x:1003:nagios,apache
[root@xxx ~]# grep nagios /etc/passwd
nagios:x:1002:1002::/home/nagios:/bin/bash
[root@xxx ~]# cat /etc/my.cnf
#
## This group is read both both by the client and the server
## use it for options that affect everything
##
[client-server]
#
##
## include all files from the config directory
##
!includedir /etc/my.cnf.d
#
[root@xxx ~]# cat /etc/my.cnf.d/innodb.cnf
[mysqld]
innodb_file_per_table=1
[root@xxx ~]# cat /etc/my.cnf.d/directories.cnf
[mysqld]
datadir=/data/mysql
log_error=/data/mysql/logs/mysql.log
[root@xxx ~]# cat /etc/my.cnf.d/
client.cnf directories.cnf innodb.cnf mysql-clients.cnf server.cnf server.cnf.rpmsave
[root@xxx ~]# cat /etc/my.cnf.d/client.cnf
#
# These two groups are read by the client library
# Use it for options that affect all clients, but not the server
#


[client]

# This group is not read by mysql client library,
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]

[root@xxx ~]# cat /etc/my.cnf.d/server.cnf.rpmsave
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
log-bin
server_id=1
binlog-format=MIXED

# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]
[root@xxx ~]#
madhukarneelaiahgari
Posts: 18
Joined: Wed May 01, 2019 12:38 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by madhukarneelaiahgari »

Also i'm unable to add the services/hosts when added via api.

curl -XPOST "http://xxx/nagiosxi/api/v1/config/host? ... x&pretty=1" -d "host_name=testapihost&address=127.0.0.1&check_command=check_ping\!3000,80%\!5000,100%&max_check_attempts=2&check_period=24x7&contacts=nagiosadmin&notification_interval=5&notification_period=24x7&applyconfig=1"
{
"success": "Successfully added testapihost to the system. Config applied, Nagios Core was restarted."
}

Eventhough it says added successfully, i'm unable to see it in XI.
Last edited by madhukarneelaiahgari on Fri Jun 14, 2019 1:05 pm, edited 1 time in total.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by lmiltchev »

Can you check to see if your PHP and System time is in sync?

Admin > System Config > System Profile > View System Info

You should see something like this:
Date/Time
PHP Timezone: US/Central
PHP Time: Fri, 14 Jun 2019 12:34:46 -0500
System Time: Fri, 14 Jun 2019 12:34:46 -0500
You need to make sure that there is no mismatch between the php and system time.

Also, can you run the following command successfully?

Code: Select all

/usr/local/nagiosxi/scripts/reconfigure_nagios.sh
Be sure to check out our Knowledgebase for helpful articles and solutions!
madhukarneelaiahgari
Posts: 18
Joined: Wed May 01, 2019 12:38 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by madhukarneelaiahgari »

Apache Information
PHP Version: 5.4.16
Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Server Name: xxx.
Server Address: xxx
Server Port: 80

Date/Time
PHP Timezone: America/Chicago
PHP Time: Fri, 14 Jun 2019 12:58:42 -0500
System Time: Fri, 14 Jun 2019 12:58:42 -0500

date
Fri Jun 14 12:58:33 CDT 2019




/usr/local/nagiosxi/scripts/reconfigure_nagios.sh
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&backend=1&username=nagiosxi&password=kSm4YUkuTL4H' -O nagiosql.login--2019-06-14 13:00:16-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.login’

[ <=> ] 35,454 --.-K/s in 0.008s

2019-06-14 13:00:16 (4.08 MB/s) - ‘nagiosql.login’ saved [35454]

LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosxi/includes/components/ccm/
Array
(
)
RESETTING PERMS
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&backend=1&username=nagiosxi&password=kSm4YUkuTL4H' -O nagiosql.login--2019-06-14 13:00:17-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.login’

[ <=> ] 35,454 --.-K/s in 0.009s

2019-06-14 13:00:17 (3.97 MB/s) - ‘nagiosql.login’ saved [35454]

LOGIN SUCCESSFUL!
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'backend=1&cmd=apply&type=writeConfig' -O nagiosql.export.monitoring
--2019-06-14 13:00:17-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.export.monitoring’

[ <=> ] 21,399 --.-K/s in 0.008s

2019-06-14 13:00:17 (2.62 MB/s) - ‘nagiosql.export.monitoring’ saved [21399]

WRITE CONFIGS SUCCESSFUL!
OUTPUT:
Nagios Core 4.2.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-07-2016
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...
Warning: Service 'ping' on host 'test' has no default contacts or contactgroups defined!
Checked 1 services.
Warning: Host 'test' has no default contacts or contactgroups defined!
Checked 1 hosts.
Checked 36 host groups.
Checked 0 service groups.
Checked 2 contacts.
Checked 0 contact groups.
Checked 189 commands.
Checked 3 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 3 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 2
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check
RET: 0
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by lmiltchev »

All looks normal. Can you PM me your profile? Please don't post it on the public forum.

Admin > System Profile > Download Profile
Be sure to check out our Knowledgebase for helpful articles and solutions!
madhukarneelaiahgari
Posts: 18
Joined: Wed May 01, 2019 12:38 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by madhukarneelaiahgari »

PM'd you the profile
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Unable to Import Configs/ and add hosts/services via api

Post by lmiltchev »

Replied in PM.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked