Page 1 of 1

Tables missing after upgrade to Nagios XI 5.9.2

Posted: Tue Jan 02, 2024 4:56 am
by djerveren
Hello.

I just upgraded to Nagios XI 5.9.2 and immediately noticed that Last Check for services weren't updating in the UI and Nagvis map objects all were blue had this error message:
Problem (Backend: nagiosxi): NDO claims that Nagios did no status update for more than "180" seconds. Make sure that Nagios and NDO daemons are running. (Backend-ID: nagiosxi)

I looked around a bit and found this in nagios.log:
[1704188370] NDO-3: query(TRUNCATE TABLE nagios_timeperiod_exceptions) failed with rc (1), mysql (1146: Table 'nagios.nagios_timeperiod_exceptions' doesn't exist)
[1704188370] NDO-3: query(TRUNCATE TABLE nagios_timeperiod_exception_timeranges) failed with rc (1), mysql (1146: Table 'nagios.nagios_timeperiod_exception_timeranges' doesn't exist)
[1704188370] NDO-3: query(TRUNCATE TABLE nagios_timeperiod_exclusions) failed with rc (1), mysql (1146: Table 'nagios.nagios_timeperiod_exclusions' doesn't exist)


So, apparently, for whatever reason, these three tables are not present in my MySQL database:

Code: Select all

mysql> SHOW TABLES LIKE "nagios_timeperiod%";
+---------------------------------------+
| Tables_in_nagios (nagios_timeperiod%) |
+---------------------------------------+
| nagios_timeperiod_timeranges          |
| nagios_timeperiods                    |
+---------------------------------------+
2 rows in set (0.00 sec)
Tables in question:
  • nagios.nagios_timeperiod_exceptions
  • nagios.nagios_timeperiod_exception_timeranges
  • nagios.nagios_timeperiod_exclusions
Does anyone happen to have .sql files that I can import and create the tables manually?

Re: Tables missing after upgrade to Nagios XI 5.9.2

Posted: Tue Jan 02, 2024 7:38 am
by djerveren
Nvm, installed a fresh instance on the side and pulled the table structure from there (including them in the end in case someone else runs into the same issue).

After that, I started getting error messages such as this nagios.log instead:

Code: Select all

[1704195787] NDO-3: ndo_return = 1 (Unknown column 'retain_status_information' in 'field list')
[1704195787] NDO-3: ndo_write_contacts(ndo-startup.c:972): Unable to prepare statement
[1704195787] NDO-3: ndo_write_contacts() failed. Disabling NDO.
[1704195787] NDO-3: NDO startup thread failed at ndo_write_object_config() - disabling NDO.
[1704195787] NDO-3: Ended contact_status thread
So, fixing them, one by one:

Code: Select all

ALTER TABLE nagios_contacts ADD COLUMN retain_status_information smallint NOT NULL DEFAULT 0 AFTER can_submit_commands;
ALTER TABLE nagios_contacts ADD COLUMN retain_nonstatus_information smallint NOT NULL DEFAULT 0 AFTER retain_status_information;
ALTER TABLE nagios_hosts ADD COLUMN should_be_drawn smallint NOT NULL DEFAULT 0;
ALTER TABLE nagios_hostgroups ADD COLUMN notes varchar(255) NOT NULL DEFAULT 0;
ALTER TABLE nagios_hostgroups ADD COLUMN notes_url varchar(255) NOT NULL DEFAULT '';
ALTER TABLE nagios_hostgroups ADD COLUMN action_url varchar(255) NOT NULL DEFAULT '';
ALTER TABLE nagios_services ADD COLUMN parallelize_check smallint NOT NULL DEFAULT '';
ALTER TABLE nagios_servicegroups ADD COLUMN notes varchar(255) NOT NULL DEFAULT '';
Maybe this will help someone else having similar problems, dunno.

Table structure dumps for the three initially missing tables:

nagios_timeperiod_exception_timeranges.sql

Code: Select all

CREATE TABLE `nagios_timeperiod_exception_timeranges` (
  `nagios_timeperiod_exception_timerange_id` int NOT NULL AUTO_INCREMENT,
  `instance_id` smallint NOT NULL DEFAULT '0',
  `timeperiod_exception_id` int NOT NULL DEFAULT '0',
  `start_sec` int NOT NULL DEFAULT '0',
  `end_sec` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`nagios_timeperiod_exception_timerange_id`),
  KEY `timeperiod_exception_id` (`timeperiod_exception_id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COMMENT='Timeperiod Exception Timeranges';
nagios_timeperiod_exceptions.sql

Code: Select all

CREATE TABLE `nagios_timeperiod_exceptions` (
  `timeperiod_exception_id` int NOT NULL AUTO_INCREMENT,
  `instance_id` smallint NOT NULL DEFAULT '0',
  `timeperiod_id` int NOT NULL DEFAULT '0',
  `exception_type` smallint NOT NULL DEFAULT '0',
  `syear` smallint NOT NULL DEFAULT '0',
  `smon` smallint NOT NULL DEFAULT '0',
  `smday` smallint NOT NULL DEFAULT '0',
  `swday` smallint NOT NULL DEFAULT '0',
  `swday_offset` smallint NOT NULL DEFAULT '0',
  `eyear` smallint NOT NULL DEFAULT '0',
  `emon` smallint NOT NULL DEFAULT '0',
  `emday` smallint NOT NULL DEFAULT '0',
  `ewday` smallint NOT NULL DEFAULT '0',
  `ewday_offset` smallint NOT NULL DEFAULT '0',
  `skip_interval` smallint NOT NULL DEFAULT '0',
  PRIMARY KEY (`timeperiod_exception_id`),
  KEY `timeperiod_id` (`timeperiod_id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COMMENT='Timeperiod Exceptions';
nagios_timeperiod_exclusions.sql

Code: Select all

CREATE TABLE `nagios_timeperiod_exclusions` (
  `parent_id` int NOT NULL,
  `child_id` int NOT NULL,
  KEY `parent_id` (`parent_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COMMENT='Timeperiod Exclusions';

Re: Tables missing after upgrade to Nagios XI 5.9.2

Posted: Wed Jan 03, 2024 10:23 am
by cnorell
djeveren,

Thanks for the update! If you have any other issues, feel free to post again.

Best Regards,

Cory Norell