postgresql migration to mysql... 99% working
Posted: Tue Apr 16, 2019 4:17 am
Dear all,
I migrated postgresql to mysql, following the procedure.
Nagios XI (5.5) is working well, i have only a little problem trying to do an 'Apply Configuration'. The error message is:
SQL Error [nagiosql] : Unknown column 'l.id' in 'field list'
Into the 'nagiosql' mysql databases, the table tbl_session_locks missed. I created it by myself but i don't know the structure, so i put only one field (the primary key 'id'). The error infact is related to the fact that nagios find the table but the expected fields are still missing.
If i comment out these lines in the /usr/local/nagiosxi/html/includes/components/nagioscorecfg/applyconfig.php it works:
#$user_id = intval($_SESSION['user_id']);
#$sql = "SELECT *, l.id AS id FROM `tbl_session_locks` AS l LEFT JOIN `tbl_session` AS s ON l.sid = s.id WHERE s.user_id != ".$user_id.";";
#$res = exec_sql_query(DB_NAGIOSQL, $sql);
#$locks = $res->getArray();
$locks;
but i don't think it to be a valid idea (it should be the code which verifies is other users are trying to apply the configuration).
How can i fix it?
could you give me the sql code to create the table? (By the way also table nagiosql.tbl_session was missing)
Regards
Francesco
I migrated postgresql to mysql, following the procedure.
Nagios XI (5.5) is working well, i have only a little problem trying to do an 'Apply Configuration'. The error message is:
SQL Error [nagiosql] : Unknown column 'l.id' in 'field list'
Into the 'nagiosql' mysql databases, the table tbl_session_locks missed. I created it by myself but i don't know the structure, so i put only one field (the primary key 'id'). The error infact is related to the fact that nagios find the table but the expected fields are still missing.
If i comment out these lines in the /usr/local/nagiosxi/html/includes/components/nagioscorecfg/applyconfig.php it works:
#$user_id = intval($_SESSION['user_id']);
#$sql = "SELECT *, l.id AS id FROM `tbl_session_locks` AS l LEFT JOIN `tbl_session` AS s ON l.sid = s.id WHERE s.user_id != ".$user_id.";";
#$res = exec_sql_query(DB_NAGIOSQL, $sql);
#$locks = $res->getArray();
$locks;
but i don't think it to be a valid idea (it should be the code which verifies is other users are trying to apply the configuration).
How can i fix it?
could you give me the sql code to create the table? (By the way also table nagiosql.tbl_session was missing)
Regards
Francesco