issue with importing config to nagios xi 5.4.5 version

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

issue with importing config to nagios xi 5.4.5 version

Post by pratik.patel »

Is there any issue with new angios xi 5.4.5 ?

I am trying to migrate from nagios core to nagios xi but having serious issue which is I think a bug in 5.4.5 version

trying to import this :
[root@xxx cfgprep]# cat IX.cfg
define service{
use generic-passive
host_name IX
service_description OUTBOUND_LINES
contact_groups Nagiosadmin
notification_options w,c,r
normal_check_interval 5
notification_interval 5
check_command reset_status

getting this error:
Field 'check_command' doesn't have a default valueEntry config_name::IX inside tbl_service could not be inserted: Field 'check_command' doesn't have a default value

this is the nagiosql table:
mysql> desc tbl_service;
+------------------------------+---------------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+------------------------------+---------------------+------+-----+-------------------+-----------------------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| config_name | varchar(255) | NO | | NULL | |
| host_name | tinyint(3) unsigned | NO | | 0 | |
| host_name_tploptions | tinyint(3) unsigned | NO | | 2 | |
| hostgroup_name | tinyint(3) unsigned | NO | | 0 | |
| hostgroup_name_tploptions | tinyint(3) unsigned | NO | | 2 | |
| service_description | varchar(255) | NO | | NULL | |
| display_name | varchar(255) | NO | | NULL | |
| servicegroups | tinyint(3) unsigned | NO | | 0 | |
| servicegroups_tploptions | tinyint(3) unsigned | NO | | 2 | |
| use_template | tinyint(3) unsigned | NO | | 0 | |
| use_template_tploptions | tinyint(3) unsigned | NO | | 2 | |
| check_command | text | NO | | NULL | |
| is_volatile | tinyint(3) unsigned | NO | | 2 | |
| initial_state | varchar(20) | NO | | NULL | |
| max_check_attempts | int(11) | YES | | NULL | |
| check_interval | int(11) | YES | | NULL | |
| retry_interval | int(11) | YES | | NULL | |
| active_checks_enabled | tinyint(3) unsigned | NO | | 2 | |
| passive_checks_enabled | tinyint(3) unsigned | NO | | 2 | |

my database is offloaded to different server.
Last edited by pratik.patel on Thu Jun 15, 2017 7:01 am, edited 1 time in total.
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by pratik.patel »

Also has many issues with other tables.

like importing contacts:

Entry contact_name::ABC inside tbl_contact could not be inserted: Field 'name' doesn't have a default value

original table description;
| address6 | varchar(255) | YES | | NULL | |
| name | varchar(255) | NO | | NULL | |
| use_variables | tinyint(3) unsigned | NO | | 0 | |

issue solved for contact with below changes:
alter table tbl_contact modify name varchar(255) Null;

| address6 | varchar(255) | YES | | NULL | |
| name | varchar(255) | YES | | NULL | |
| use_variables | tinyint(3) unsigned | NO | | 0 | |
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by tgriep »

What version of Nagios Core are you importing the file from?
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
Be sure to check out our Knowledgebase for helpful articles and solutions!
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by pratik.patel »

Yes I did in same order.

last month I was using nagios XI 5.4.4 on virtual box and it was working fine. But now we decided to install on physical server and offload the database to different server and when I installed fresh version it was 5.4.5 as it is the latest release.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by tgriep »

So you are not importing config files from a Nagios Core server but from an XI server that was running 5.4.4 in to a new server that is running 5.4.5, is that correct?
Are you getting errors when you import everything or just certain configs?

Can you provide the steps you took to migrate the config files?
Be sure to check out our Knowledgebase for helpful articles and solutions!
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by pratik.patel »

I imported config files from nagios core.

I am not getting any error with /usr/local/nagiosxi/tools/xiprepimport.php

steps:
1. mkdir /usr/local/nagios/etc/cfgprep
2. mkdir /usr/local/nagios/etc/cfgprep/orig
3. transferred nagios core folder to orig
4. php /usr/local/nagiosxi/tools/xiprepimport.php orig/nagios/checkcommands.cfg
5. php /usr/local/nagiosxi/tools/xiprepimport.php orig/nagios/timeperiods.cfg
6. php /usr/local/nagiosxi/tools/xiprepimport.php orig/nagios/contacts.cfg
7. php /usr/local/nagiosxi/tools/xiprepimport.php orig/nagios/contactgroups.cfg

and then import config files from nagios gui.
1. imported commands successfully.

2. getting below errors while importing timeperiods:
1 items failed to import successfully Hide Details
Field 'name' doesn't have a default valueEntry timeperiod_name::24x7 inside tbl_timeperiod successfully inserted
Entry timeperiod_name::workhours inside tbl_timeperiod successfully inserted
Entry timeperiod_name::nonworkhours inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::08-24x7 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::08-20x7 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::08-18x5 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::08-17x5 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::07-18x5 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::06-23x7 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::07-23x7 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::09-10x7 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::08:30-22x5 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::09:00-22x2 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::08-22x7 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value
Entry timeperiod_name::08:30-22x5_09-22x2 inside tbl_timeperiod could not be inserted: Field 'name' doesn't have a default value

3. getting below errors while importing contacts:
1 items failed to import successfully Hide Details
Field 'name' doesn't have a default valueEntry contact_name::AAA inside tbl_contact could not be inserted: Field 'name' doesn't have a default value
Entry contact_name::xxx inside tbl_contact could not be inserted: Field 'name' doesn't have a default value
Entry contact_name::yyyy _SMS inside tbl_contact could not be inserted: Field 'name' doesn't have a default value
Entry contact_name::zzzz inside tbl_contact could not be inserted: Field 'name' doesn't have a default value
Entry contact_name::qqqq inside tbl_contact could not be inserted: Field 'name' doesn't have a default value

4. getting below errors while importing contactgroups:
1 items failed to import successfully Hide Details
Field 'contactgroup_members' doesn't have a default valueEntry contactgroup_name::Nagios_Contacts inside tbl_contactgroup could not be inserted: Field 'contactgroup_members' doesn't have a default value
Entry contactgroup_name::AAA inside tbl_contactgroup could not be inserted: Field 'contactgroup_members' doesn't have a default value


Same error I can see when I import hosts, services, hostgroups and servicegroups.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by tgriep »

Could you post the timeperiods.cfg file so we can view the contents and see if the error can be recreated.
Be sure to check out our Knowledgebase for helpful articles and solutions!
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by pratik.patel »

Code: Select all

# '24x7' timeperiod definition
define timeperiod{
        timeperiod_name 24x7
        alias           24 Hours A Day, 7 Days A Week
        sunday          00:00-24:00
        monday          00:00-24:00
        tuesday         00:00-24:00
        wednesday       00:00-24:00
        thursday        00:00-24:00
        friday          00:00-24:00
        saturday        00:00-24:00
        }


# 'workhours' timeperiod definition
define timeperiod{
        timeperiod_name workhours
        alias           "Normal" Working Hours
        monday          09:00-18:00
        tuesday         09:00-18:00
        wednesday       09:00-18:00
        thursday        09:00-18:00
        friday          09:00-18:00
        }


# 'nonworkhours' timeperiod definition
define timeperiod{
        timeperiod_name nonworkhours
        alias           Non-Work Hours
        sunday          00:00-24:00
        monday          00:00-24:00
        tuesday         00:00-24:00
        wednesday       00:00-24:00
        thursday        00:00-24:00
        friday          00:00-24:00
        saturday        00:00-24:00
        }

define timeperiod{
        timeperiod_name 08-24x7
        alias           08:00 to 24:00, 7 Days A Week
        sunday          08:00-24:00
        monday          08:00-24:00
        tuesday         08:00-24:00
        wednesday       08:00-24:00
        thursday        08:00-24:00
        friday          08:00-24:00
        saturday        08:00-24:00
        }

define timeperiod{
        timeperiod_name 08-20x7
        alias           08:00 to 20:00, 7 Days A Week
        sunday          08:00-20:00
        monday          08:00-20:00
        tuesday         08:00-20:00
        wednesday       08:00-20:00
        thursday        08:00-20:00
        friday          08:00-20:00
        saturday        08:00-20:00
        }

define timeperiod{
        timeperiod_name 08-18x5
        alias           08:00 to 18:00, Monday to Friday
        monday          08:00-18:00
        tuesday         08:00-18:00
        wednesday       08:00-18:00
        thursday        08:00-18:00
        friday          08:00-18:00
        }

define timeperiod{
        timeperiod_name 08-17x5
        alias           08:00 to 16:45, Monday to Friday
        monday          08:00-16:45
        tuesday         08:00-16:45
        wednesday       08:00-16:45
        thursday        08:00-16:45
        friday          08:00-16:45
        }

define timeperiod{
        timeperiod_name 07-18x5
        alias           07:00 to 17:30, 5 Days A Week
        monday          07:00-17:30
        tuesday         07:00-17:30
        wednesday       07:00-17:30
        thursday        07:00-17:30
        friday          07:00-17:30
        }

define timeperiod{
        timeperiod_name 06-23x7
        alias           06:00 to 23:00, 7 Days A Week
        sunday          06:00-23:00
        monday          06:00-23:00
        tuesday         06:00-23:00
        wednesday       06:00-23:00
        thursday        06:00-23:00
        friday          06:00-23:00
        saturday        06:00-23:00
        }

define timeperiod{
        timeperiod_name 07-23x7
        alias           07:00 to 23:00, 7 Days A Week
        sunday          07:00-23:00
        monday          07:00-23:00
        tuesday         07:00-23:00
        wednesday       07:00-23:00
        thursday        07:00-23:00
        friday          07:00-23:00
        saturday        07:00-23:00
        }

define timeperiod{
        timeperiod_name 09-10x7
        alias           09:00 to 10:00, 7 Days A Week
        sunday          09:00-10:00
        monday          09:00-10:00
        tuesday         09:00-10:00
        wednesday       09:00-10:00
        thursday        09:00-10:00
        friday          09:00-10:00
        saturday        09:00-10:00
        }
define timeperiod{
        timeperiod_name 08:30-22x5
        alias           08:30 to 22:00, 5 Days A Week
        monday          08:30-22:00
        tuesday         08:30-22:00
        wednesday       08:30-22:00
        thursday        08:30-22:00
        friday          08:30-22:00
        }
define timeperiod{
        timeperiod_name 09:00-22x2
        alias           09:00 to 22:00, 2 Days A Week
        sunday          09:00-22:00
        saturday        09:00-22:00
        }

define timeperiod{
        timeperiod_name 08-22x7
        alias           08:00 to 22:00, 7 Days A Week
        sunday          08:00-22:00
        monday          08:00-22:00
        tuesday         08:00-22:00
        wednesday       08:00-22:00
        thursday        08:00-22:00
        friday          08:00-22:00
        saturday        08:00-22:00
        }

define timeperiod{
        timeperiod_name 08:30-22x5_09-22x2
        alias           08:30 to 22:00, 5 Days A Week and 09:00 to 22:00, 2 days a week
        sunday          09:00-22:00
        monday          08:30-22:00
        tuesday         08:30-22:00
        wednesday       08:30-22:00
        thursday        08:30-22:00
        friday          08:30-22:00
        saturday        09:00-22:00
        }
Last edited by tgriep on Mon Jun 19, 2017 9:26 am, edited 1 time in total.
Reason: Added Code Wraps around large output.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by tgriep »

The format of the time periods look like they should be OK.

Can you run the following on the Nagios server as root and post the output? Replace xxx.xxx.xxx.xxx with the IP address of your remote MYSQL server.

Code: Select all

echo 'desc tbl_timeperiod;' | mysql -u nagiosql -pnagios nagiosql -h xxx.xxx.xxx.xxx -t
echo 'select * from tbl_timeperiod;' | mysql -u nagiosql -pnagios nagiosql -h xxx.xxx.xxx.xxx -t
cd /usr/local/nagiosxi/scripts
su nagios
./reconfigure_nagios.sh
Be sure to check out our Knowledgebase for helpful articles and solutions!
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: issue with importing config to nagios xi 5.4.5 version

Post by pratik.patel »

Code: Select all

[root@ ~]# echo 'desc tbl_timeperiod;' | mysql -u nagiosql -p'nagiosql' nagiosql -h x -t
+-----------------+---------------------+------+-----+-------------------+-----------------------------+
| Field           | Type                | Null | Key | Default           | Extra                       |
+-----------------+---------------------+------+-----+-------------------+-----------------------------+
| id              | int(10) unsigned    | NO   | PRI | NULL              | auto_increment              |
| timeperiod_name | varchar(255)        | NO   | MUL |                   |                             |
| alias           | varchar(255)        | NO   |     |                   |                             |
| exclude         | tinyint(3) unsigned | NO   |     | 0                 |                             |
| name            | varchar(255)        | NO   |     | NULL              |                             |
| active          | enum('0','1')       | NO   |     | 1                 |                             |
| last_modified   | timestamp           | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| access_rights   | varchar(8)          | YES  |     | NULL              |                             |
| config_id       | tinyint(3) unsigned | NO   |     | 0                 |                             |
+-----------------+---------------------+------+-----+-------------------+-----------------------------+

[root@ ~]# echo 'select * from tbl_timeperiod;' | mysql -u nagiosql -pnagiosql nagiosql -h x  -t
+----+--------------------------------+------------------------------------+---------+--------------------+--------+---------------------+---------------+-----------+
| id | timeperiod_name                | alias                              | exclude | name               | active | last_modified       | access_rights | config_id |
+----+--------------------------------+------------------------------------+---------+--------------------+--------+---------------------+---------------+-----------+
|  1 | nagiosadmin_notification_times | Notification Times for nagiosadmin |       0 |                    | 1      | 2017-06-02 10:02:00 | NULL          |         1 |
|  2 | 24x7                           | 24 Hours A Day,7 Days A Week       |       0 |                    | 1      | 2017-06-16 08:52:15 | NULL          |         1 |
|  3 | workhours                      | "Normal" Working Hours             |       0 |                    | 1      | 2017-06-16 08:52:15 | NULL          |         1 |
|  4 | none                           | No Time Is A Good Time             |       0 |                    | 1      | 2017-06-02 10:02:00 | NULL          |         1 |
|  5 | us-holidays                    | U.S. Holidays                      |       0 | us-holidays        | 1      | 2017-06-02 10:02:00 | NULL          |         1 |
|  6 | 24x7_sans_holidays             | 24x7 Sans Holidays                 |       0 |                    | 1      | 2017-06-02 10:02:00 | NULL          |         1 |
|  7 | xi_timeperiod_24x7             | 24x7                               |       0 | xi_timeperiod_24x7 | 1      | 2017-06-02 10:02:01 | NULL          |         1 |
+----+--------------------------------+------------------------------------+---------+--------------------+--------+---------------------+---------------+-----------+



[root@x scripts]# su nagios
This account is currently not available.
[root@x scripts]#
[root@x scripts]# grep nagios /etc/passwd
nagios:x:994:992::/var/spool/nagios:/sbin/nologin
Locked