Error inserting in table nagios_servicechecks

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
opservidores
Posts: 7
Joined: Thu Sep 29, 2016 4:50 am

Error inserting in table nagios_servicechecks

Post by opservidores »

Hello All,

After upgrade to version 5.8.3, we got errors in /usr/local/nagios/var/archives/nagios-06-*-2021-00.log.

Log files increase from 6 MB to 11GB.

Run a checkDB, everything is fine.

I inserted manually with command showed on logs and I got this error :

MariaDB [nagios]> INSERT INTO nagios_servicechecks (instance_id, start_time, start_time_usec, end_time, end_time_usec, service_object_id, check_type, current_check_attempt, max_check_attempts, state, state_type, timeout, early_timeout, execution_time, latency, return_code, output, long_output, perfdata, command_object_id, command_args, command_line) VALUES (1,FROM_UNIXTIME(1623970798),888411,FROM_UNIXTIME(1623970799),20739,19179,0,1,2,0,1,120,0,0.132328,0.889330,0,'ntpd (pid 1206) is running...','','',0,'','') ON DUPLICATE KEY UPDATE instance_id = VALUES(instance_id), start_time = VALUES(start_time), start_time_usec = VALUES(start_time_usec), end_time = VALUES(end_time), end_time_usec = VALUES(end_time_usec), service_object_id = VALUES(service_object_id), check_type = VALUES(check_type), current_check_attempt = VALUES(current_check_attempt), max_check_attempts = VALUES(max_check_attempts), state = VALUES(state), state_type = VALUES(state_type), timeout = VALUES(timeout), early_timeout = VALUES(early_timeout), execution_time = VALUES(execution_time), latency = VALUES(latency), return_code = VALUES(return_code), output = VALUES(output), long_output = VALUES(long_output), perfdata = VALUES(perfdata), command_object_id = VALUES(command_object_id), command_args = VALUES(command_args), command_line = VALUES(command_line)
-> ;
ERROR 167 (22003): Out of range value for column 'servicecheck_id' at row 1


In an older post, the solution was downgrade NDO. Is it correct? What I need to do?

Regards,
Rui
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Error inserting in table nagios_servicechecks

Post by ssax »

Please run this command against your DB to fix it:

Code: Select all

mysql -h 127.0.0.1 -uroot -pnagiosxi nagios -e "alter table nagios_servicechecks modify servicecheck_id int(20) NOT NULL AUTO_INCREMENT;"
opservidores
Posts: 7
Joined: Thu Sep 29, 2016 4:50 am

Re: Error inserting in table nagios_servicechecks

Post by opservidores »

Thank you Saxx. I saw that solution on other post, with bigint. My question is : this change don't will be a problem in future upgrades?

Regards,
Rui
opservidores
Posts: 7
Joined: Thu Sep 29, 2016 4:50 am

Re: Error inserting in table nagios_servicechecks

Post by opservidores »

Change to int(20) didn't solve the error. The max value of a int column is 2147483647 ( https://dev.mysql.com/doc/refman/8.0/en ... types.html). My auto increment column already had that number.

Based on it, the solution is alter column to serial (or bigint), where the max value is 2^63-1.

The question is the same, do I have problems with future updates with that change?

Meanwhile I already apply the change to serial and it is working again.

Regards,
Rui
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Error inserting in table nagios_servicechecks

Post by ssax »

It will not impact upgrades, please set it to bigint.

Code: Select all

mysql -h 127.0.0.1 -uroot -pnagiosxi nagios -e "alter table nagios_servicechecks modify servicecheck_id bigint NOT NULL AUTO_INCREMENT;"
opservidores
Posts: 7
Joined: Thu Sep 29, 2016 4:50 am

Re: Error inserting in table nagios_servicechecks

Post by opservidores »

Thank you, change made, everything working.
Locked