Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

mysql_error out of range value for column – How to fix in Nagios

by | Apr 24, 2021

The error, ‘mysql_error out of range value for column’ appears in the /var/log/messages file on the Nagios XI server.

As part of our Server Management Services, we assist our customers with several Nagios queries.

Today, let us see how to effectively resolve this error.

 

mysql_error out of range value for column

The error in the /var/log/messages file on the Nagios XI server looks like this:

Apr 23 23:30:03 centosxx ndo2db: Error: mysql_query() failed for ‘INSERT INTO nagios_scheduleddowntime SET instance_id=’1′, downtime_type=’1′,
object_id=’830′, entry_time=FROM_UNIXTIME(1517155261), author_name=’nagios_user’, comment_data=’AUTO: Standby Server’, internal_downtime_id=’804′,
triggered_by_id=’0′, is_fixed=’1′, duration=’31536000′, scheduled_start_time=FROM_UNIXTIME(1517239800),
scheduled_end_time=FROM_UNIXTIME(1548775800) ON DUPLICATE KEY UPDATE instance_id=’1′, downtime_type=’1′, object_id=’830′,
entry_time=FROM_UNIXTIME(1517155261), author_name=’nagios_user’, comment_data=’AUTO: Standby Server’, internal_downtime_id=’804′, triggered_by_id=’0′,
is_fixed=’1′, duration=’31536000′, scheduled_start_time=FROM_UNIXTIME(1517239800), scheduled_end_time=FROM_UNIXTIME(1548775800)’

Apr 23 23:30:03 centosxx ndo2db: mysql_error: ‘Out of range value for column ‘duration’ at row 1′

The error above may not be identical. However, it usually follows the ‘Out of range value for column message’.

It is the result of the MySQL/MariaDB server having the SQL Mode set to STRICT_TRANS_TABLES, NO_ENGINE_SUBSTITUTION.

Generally, this problem arises when we attempt to offload the databases to an external server using a MySQL/MariaDB custom installation.

With the following steps, we can identify what the SQL Mode is currently configured for.

Initially, we establish a terminal session to MySQL/MariaDB server hosting the Nagios XI databases.

Then we execute the following command:

mysql -u root -p’nagiosxi’ -e “SELECT @@GLOBAL.sql_mode;”

Replace the password of Nagios xi with the password of the root user on the database server.

The output shows us the SQL Mode has been defined:

+——————————————–+
| @@GLOBAL.sql_mode |
+——————————————–+
| STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+——————————————–+
Output that shows that NO SQL Mode has been defined:

+——————-+
| @@GLOBAL.sql_mode |
+——————-+
| |
+——————-+

 

Solution

To resolve this issue, we need to define the SQL Mode in the MySQL/MariaDB my.cnf configuration file.

Initially, we have to stop the required services on the Nagios XI server:

RHEL 7/8|CentOS 7/8|Debian|Ubuntu 16/18

systemctl stop nagios.service
systemctl stop ndo2db.service

Then we have to edit the my.cnf configuration file on MySQL/MariaDB database server.

  • RHEL 8|CentOS 8

vi /etc/my.cnf.d/mysql-server.cnf

  • RHEL 6/7| CentOS 6/7

vi /etc/my.cnf

  • Ubuntu 16/18

vi /etc/mysql/mysql.conf.d/mysqld.cnf

  • Debian 9

vi /etc/mysql/mariadb.conf.d/50-server.cnf

Eventually, locate the [mysqld] section and check to see if there exists a sql_mode:

[mysqld]
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

If it does, we need to replace it with the following. If it does not exist, we need to add the following:

[mysqld]
sql_mode=””

Then we save and close the file.

Later, we need to restart the database service:

  • RHEL 7|CentOS 7|Debian 9
systemctl restart mariadb.service
  • Debian 8|Ubuntu 16/18
systemctl restart mysql.service

Once done, execute the following command to ensure the SQL Mode is no longer set:

mysql -u root -p’nagiosxi’ -e “SELECT @@GLOBAL.sql_mode;”

Replace the password of Nagios xi with that of the root user on the database server.

A successful output with NO SQL Mode looks like this:

+——————-+
| @@GLOBAL.sql_mode |
+——————-+
| |
+——————-+

If it is correct, we can start the services on Nagios XI:

RHEL 7|CentOS 7|Debian|Ubuntu 16/18

systemctl start ndo2db.service
systemctl start nagios.service

Then we check the /var/log/messages file to ensure the error messages no longer appear.

[Failed with the resolution? We are here for you]

 

Conclusion

In short, the error appears in the /var/log/messages file on the Nagios XI server. Today, we saw how our Support Techs fix it

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF