This is a cache of https://support.nagios.com/kb/article/nagios-xi-sql-error-nagiosxi-error-syntax-error-754.html. It is a snapshot of the page at 2025-05-14T00:09:16.580+0000.
Nagios <strong>xi</strong> - SQL Error [nagios<strong>xi</strong>] : ERROR: syntax error
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:

 

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

 

RHEL 7/8 | CentOS 7/8 | Oracle Linux 7 /8| Debian | Ubuntu 16/18/20

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/



Special Offer For Knowledgebase Visitors! Get a huge discount on Nagios Log Server by clicking below.

Get 60% Off Nagios Log Server!

Did you know? Nagios provides complete monitoring of: Windows, Linux, UNIX, Servers, Websites, SNMP, DHCP, DNS, Email, Storage, Files, Apache, IIS, EC2, and more!

4 (1)
Article Rating (1 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 - Configuration Verification Failed
Viewed 19872 times since Mon, Jan 25, 2016
Backups are not being generated due to tar creation errors
Viewed 4155 times since Thu, Feb 27, 2020
Nagios xi - Last Check Time Not Updating
Viewed 20702 times since Tue, Jan 6, 2015
Nagios xi - Defining Global Environment Variables
Viewed 10874 times since Thu, Mar 17, 2016
Nagios xi - Resolving "Cannot connect to database" Error - Core Config Manager
Viewed 8397 times since Mon, Jan 25, 2016
Nagios xi - Core 4 Load Spikes on 1.75 and 7 Hour Intervals
Viewed 4859 times since Mon, Jan 25, 2016
Nagios xi - Apply Configuration Never Completes
Viewed 22737 times since Tue, Jan 27, 2015
Nagios xi - ICMP and Ping Checks Stopped Graphing
Viewed 13863 times since Mon, Jan 25, 2016
Nagios xi - Optimizing The PHP Settings File
Viewed 68707 times since Thu, Jul 13, 2017
Nagios xi - STRICT_TRANS_TABLES
Viewed 7948 times since Thu, Nov 16, 2017