Home » Categories » Products » Nagios XI » Troubleshooting » Common Problems

Nagios XI - SQL Error [nagiosxi] : ERROR: syntax error

Problem Description

This KB article explains how to resolve an error similar to the following that appears in the Nagios XI GUI:

SQL Error [nagiosxi] : ERROR:  syntax error at or near "localhost"
LINE 1: ...ios XI','nagiosadmin',4,'User reconfigured host \'localhost\...

 

The postgresql log file in /var/lib/pgsql/data/pg_log/ will have more detailed information:

ERROR:  syntax error at or near "localhost" at character 166
STATEMENT: INSERT INTO xi_auditlog (log_time,source,"user",type,message,ip_address,details) VALUES ('2017-09-06 14:15:29','Nagios XI','nagiosadmin',4,'User reconfigured host \'localhost\'','10.9.2.41','Array
        (
            [host_name] => localhost
            [use] => linux-server
            [alias] => localhost
            [address] => 127.0.0.1
            [first_notification_delay] => 0
            [notifications_enabled] => 1
            [register] => 1
            [contacts] => nagiosadmin
        )
        ')

 

This error occurs on the Host or Service Status Detail page > Configure tab, when you are using the re-configure a host or service option.

The problem only occurs with older installations of Nagios XI that historically used PostgreSQL for the nagiosxi database. Fresh installations of Nagios XI since 5.x do not experience this issue.

The problem only occurs with PostgreSQL 9.1 or greater.

 

 

Resolution

A simple change to the postgresql.conf file will resolve this problem.

Establish a terminal session to your Nagios XI server as root and edit the postgresql.conf file with this command:

vi /var/lib/pgsql/data/postgresql.conf

When using the vi editor, to make changes press i on the keyboard first to enter insert mode. Press Esc to exit insert mode.

 

Locate the following line:

#standard_conforming_strings =

Tip: typing /conform and pressing Enter in vi should take you directly to this section in the file.

 

Remove the # from the begging of the line and set it to off:

standard_conforming_strings = off

 

When you have finished, save the changes in vi by typing:

:wq

and press Enter.

 

You need to restart the postgresql service using one of the commands below:

 

RHEL/CentOS 5.x/6.x

service postgresql restart

 

RHEL/CentOS 7.x

systemctl restart postgresql.service

 

This completes the changes required for resolving the problem described above.

 

 

Further Information

The following documentation explains in detail the standard_conforming_strings option:

https://www.postgresql.org/docs/9.1/static/release-9-1.html

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios XI - Scheduled Downtime Not Working
Viewed 1027 times since Mon, Oct 10, 2016
Nagios XI - Status Information Cut Off At 256 Characters
Viewed 1827 times since Thu, Feb 25, 2016
Nagios XI - MK Livestatus Problems With Mod-Gearman
Viewed 1376 times since Thu, Feb 25, 2016
Nagios XI - Upgrade errors - root.crontab.orig: cannot overwrite existing file
Viewed 845 times since Tue, Jan 26, 2016
Nagios XI - Problems Using Nagios XI With Proxies
Viewed 4740 times since Mon, Jan 25, 2016
Nagios XI - WMI Authentication Problems
Viewed 2587 times since Thu, Feb 25, 2016
Nagios XI - Last Check Time Not Updating
Viewed 4342 times since Tue, Jan 6, 2015
Nagios XI - Configuration Verification Failed
Viewed 3720 times since Mon, Jan 25, 2016
Active Directory / LDAP - Troubleshooting Authentication Integration
Viewed 621 times since Mon, Jun 26, 2017
ERROR: Please add the ’Optional’ channel to your Red Hat systems subscriptions
Viewed 2593 times since Tue, Jan 26, 2016