Page 1 of 1

Error inserting in table nagios_servicechecks

Posted: Fri Jun 18, 2021 9:34 am
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

Re: Error inserting in table nagios_servicechecks

Posted: Fri Jun 18, 2021 4:21 pm
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;"

Re: Error inserting in table nagios_servicechecks

Posted: Sat Jun 19, 2021 7:45 am
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

Re: Error inserting in table nagios_servicechecks

Posted: Sat Jun 19, 2021 8:18 am
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

Re: Error inserting in table nagios_servicechecks

Posted: Mon Jun 21, 2021 11:08 am
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;"

Re: Error inserting in table nagios_servicechecks

Posted: Thu Jun 24, 2021 3:21 am
by opservidores
Thank you, change made, everything working.