Page 1 of 1

Monitor engine does not work after upgrade from 5.5.9 to 5.7

Posted: Mon Sep 14, 2020 9:43 am
by tatianagraciap
Hello,

After a offline upgrade from 5.5.9 to 5.7.3 on RHEL 7 the monitor engine does not work, i tried to restart the service but the monitor engine goes red after 2 minutes.

i have already restart the nagios service. i checked the nagios log error and i get the following info.

[1600091657] NDO-3: ndo_handle_service_status(ndo-handlers.c:953): Could not reconnect to MySQL database
[1600091658] NDO-3: Unable to prepare statement for query (27): Unknown column 'check_options' in 'field list'
[1600091658] NDO-3: Unable to prepare statement for query (28): Unknown column 'check_options' in 'field list'
[1600091658] NDO-3: Error preparing statements

Can you help me please?

Re: Monitor engine does not work after upgrade from 5.5.9 to

Posted: Mon Sep 14, 2020 3:52 pm
by scottwilkerson
It seems like a portion of the database may not have updated as expected

Lets' connect to mysql (if you change dthe mysql rppt password replace nagiosxi below with that password

Code: Select all

mysql -pnagiosxi nagios
Then lets execute the following code

Code: Select all

# Add the column 'check_options' to nagios_servicestatus if it doesn't already exist
SET @exist := (SELECT COUNT(*) FROM `information_schema`.`columns` WHERE table_name = 'nagios_servicestatus' AND column_name = 'check_options');
SET @sqlstmt := if( @exist <= 0,
'ALTER TABLE `nagios_servicestatus` ADD `check_options` smallint(6) NOT NULL default ''0'' AFTER `check_type`',
'select ''INFO: Column already exists.''');
PREPARE stmt FROM @sqlstmt;
EXECUTE stmt;

# Add the column 'check_options' to nagios_hoststatus if it doesn't already exist
SET @exist := (SELECT COUNT(*) FROM `information_schema`.`columns` WHERE table_name = 'nagios_hoststatus' AND column_name = 'check_options');
SET @sqlstmt := if (@exist <= 0, 
'ALTER TABLE `nagios_hoststatus` ADD `check_options` smallint(6) NOT NULL default ''0'' AFTER `check_type`',
'SELECT ''INFO: Column already exists.''');
PREPARE stmt FROM @sqlstmt;
EXECUTE stmt;

ALTER TABLE nagios_objects MODIFY name1 VARCHAR(1023) CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE nagios_objects MODIFY name2 VARCHAR(1023) CHARACTER SET utf8 COLLATE utf8_bin;
After this exit mysql

Code: Select all

exit
and restart nagios

Code: Select all

systemctl restart nagios