SQL ERROR: syntax error while applying configuration
Posted: Fri Apr 06, 2018 7:52 am
Hello,
I am running a Nagios 2014R2.7 on RHEL6.9 VM.
Each time I apply configuration, I get this error message:
SQL: SQL Error [nagiosxi] : ERROR: syntax error at or near "user" LINE 1: INSERT INTO xi_auditlog (log_time,source,user,type,message,i... ^
It seems the configuration is correctly applied though.
Background:
I migrated the nagiosxi db from postgresql to mysql using this topic https://support.nagios.com/kb/article.php?id=560
Then I got similar error message (cant' remember exactly the error message), and I could not access the VM for weeks (ip address changed...)
Now I reverted changes to postgresql db but since then I'm having this error message...
I have checked the postgresql db, there are no rows in the xi_auditlog table...
nagiosxi=> \d
List of relations
Schema | Name | Type | Owner
--------+-----------------------------+----------+----------
public | if_command_id_seq | sequence | nagiosxi
public | if_meta_id_seq | sequence | nagiosxi
public | if_option_id_seq | sequence | nagiosxi
public | if_sysstat_id_seq | sequence | nagiosxi
public | if_user_id_seq | sequence | nagiosxi
public | if_usermeta_id_seq | sequence | nagiosxi
public | xi_auditlog | table | nagiosxi
public | xi_auditlog_auditlog_id_seq | sequence | nagiosxi
public | xi_commands | table | nagiosxi
public | xi_commands_command_id_seq | sequence | nagiosxi
public | xi_events | table | nagiosxi
public | xi_events_event_id_seq | sequence | nagiosxi
public | xi_incidents | table | nagiosxi
public | xi_incidents_id_seq | sequence | nagiosxi
public | xi_meta | table | nagiosxi
public | xi_meta_meta_id_seq | sequence | nagiosxi
public | xi_options | table | nagiosxi
public | xi_options_option_id_seq | sequence | nagiosxi
public | xi_sysstat | table | nagiosxi
public | xi_sysstat_sysstat_id_seq | sequence | nagiosxi
public | xi_usermeta | table | nagiosxi
public | xi_usermeta_usermeta_id_seq | sequence | nagiosxi
public | xi_users | table | nagiosxi
public | xi_users_user_id_seq | sequence | nagiosxi
(24 rows)
nagiosxi=> \d xi_auditlog
Table "public.xi_auditlog"
Column | Type | Modifiers
-------------+-----------------------------+-------------------------------------------------------------------
auditlog_id | integer | not null default nextval('xi_auditlog_auditlog_id_seq'::regclass)
log_time | timestamp without time zone |
source | text |
user | text |
type | integer |
message | text |
ip_address | text |
Indexes:
"xi_auditlog_pkey" PRIMARY KEY, btree (auditlog_id)
"xi_auditlog_ip_address" btree (ip_address)
"xi_auditlog_log_time" btree (log_time)
"xi_auditlog_source" btree (source)
"xi_auditlog_type" btree (type)
"xi_auditlog_user" btree ("user")
nagiosxi=> select * from xi_auditlog;
auditlog_id | log_time | source | user | type | message | ip_address
-------------+----------+--------+------+------+---------+------------
(0 rows)
I still have the sqldump generated to convert the db to mysql, and I want to restore it, but I have questions (I'm not a db guy...)
- I have run several command to check/vacuum the db, and it seems it's not corrupted, but I can't figure why the xi_auditlog table is empty now, as there are records in the dump for this table... Any tips to check the db is welcome
- the dump is generated with --data_only option, will it be a problem to restore it, as I can't just drop/restore everything?
- is there a link between nagios, nagiosql mysql db and nagiosxi postresql db that would make this restore difficult? (as the server ran several weeks with nagiosxi migrated to mysql, and modifications were done)?
Thanks for your help.
BL
I am running a Nagios 2014R2.7 on RHEL6.9 VM.
Each time I apply configuration, I get this error message:
SQL: SQL Error [nagiosxi] : ERROR: syntax error at or near "user" LINE 1: INSERT INTO xi_auditlog (log_time,source,user,type,message,i... ^
It seems the configuration is correctly applied though.
Background:
I migrated the nagiosxi db from postgresql to mysql using this topic https://support.nagios.com/kb/article.php?id=560
Then I got similar error message (cant' remember exactly the error message), and I could not access the VM for weeks (ip address changed...)
Now I reverted changes to postgresql db but since then I'm having this error message...
I have checked the postgresql db, there are no rows in the xi_auditlog table...
nagiosxi=> \d
List of relations
Schema | Name | Type | Owner
--------+-----------------------------+----------+----------
public | if_command_id_seq | sequence | nagiosxi
public | if_meta_id_seq | sequence | nagiosxi
public | if_option_id_seq | sequence | nagiosxi
public | if_sysstat_id_seq | sequence | nagiosxi
public | if_user_id_seq | sequence | nagiosxi
public | if_usermeta_id_seq | sequence | nagiosxi
public | xi_auditlog | table | nagiosxi
public | xi_auditlog_auditlog_id_seq | sequence | nagiosxi
public | xi_commands | table | nagiosxi
public | xi_commands_command_id_seq | sequence | nagiosxi
public | xi_events | table | nagiosxi
public | xi_events_event_id_seq | sequence | nagiosxi
public | xi_incidents | table | nagiosxi
public | xi_incidents_id_seq | sequence | nagiosxi
public | xi_meta | table | nagiosxi
public | xi_meta_meta_id_seq | sequence | nagiosxi
public | xi_options | table | nagiosxi
public | xi_options_option_id_seq | sequence | nagiosxi
public | xi_sysstat | table | nagiosxi
public | xi_sysstat_sysstat_id_seq | sequence | nagiosxi
public | xi_usermeta | table | nagiosxi
public | xi_usermeta_usermeta_id_seq | sequence | nagiosxi
public | xi_users | table | nagiosxi
public | xi_users_user_id_seq | sequence | nagiosxi
(24 rows)
nagiosxi=> \d xi_auditlog
Table "public.xi_auditlog"
Column | Type | Modifiers
-------------+-----------------------------+-------------------------------------------------------------------
auditlog_id | integer | not null default nextval('xi_auditlog_auditlog_id_seq'::regclass)
log_time | timestamp without time zone |
source | text |
user | text |
type | integer |
message | text |
ip_address | text |
Indexes:
"xi_auditlog_pkey" PRIMARY KEY, btree (auditlog_id)
"xi_auditlog_ip_address" btree (ip_address)
"xi_auditlog_log_time" btree (log_time)
"xi_auditlog_source" btree (source)
"xi_auditlog_type" btree (type)
"xi_auditlog_user" btree ("user")
nagiosxi=> select * from xi_auditlog;
auditlog_id | log_time | source | user | type | message | ip_address
-------------+----------+--------+------+------+---------+------------
(0 rows)
I still have the sqldump generated to convert the db to mysql, and I want to restore it, but I have questions (I'm not a db guy...)
- I have run several command to check/vacuum the db, and it seems it's not corrupted, but I can't figure why the xi_auditlog table is empty now, as there are records in the dump for this table... Any tips to check the db is welcome
- the dump is generated with --data_only option, will it be a problem to restore it, as I can't just drop/restore everything?
- is there a link between nagios, nagiosql mysql db and nagiosxi postresql db that would make this restore difficult? (as the server ran several weeks with nagiosxi migrated to mysql, and modifications were done)?
Thanks for your help.
BL