[Pkg-nagios-devel] Bug#291256: nagios: Nagios fails with invalid SQL after upgrade

steveg Steve Greenland <steveg@lsli.com>, 291256@bugs.debian.org
Wed, 19 Jan 2005 11:41:19 -0600

Package: nagios
Severity: normal

(Sorry for the long lines, but I wanted to list the log messages and SQL
commands literally.)

After a recent upgrade on a 'testing' machine, nagios is no longer able to update the mysql 
records.  In nagios.log, we have:

[1106156026] Error: Could not insert/update status record for program in table 'programstatus' of database 'nagios'

>From the mysql log, we can see that the command causing the problem is:

INSERT INTO programstatus (last_update,program_start,nagios_pid,daemon_mode,last_command_check,last_log_rotation,enable_notifications,execute_service_checks,accept_passive_service_checks,enable_event_handlers,obsess_over_services,enable_flap_detection,enable_failure_prediction,process_performance_data) VALUES (FROM_UNIXTIME(1106154403),FROM_UNIXTIME(1106154373),'11280','0',FROM_UNIXTIME(1106154401),FROM_UNIXTIME(0),'1','1','1','1','0','0','1','1')

Testing with the mysql client, the problem is the "FROM_UNIXTIME(0)" for the last_log_rotation
field, which produces the error:

ERROR 1048: Column 'last_log_rotation' cannot be null

Substituting a legitimate time value causes the SQL to work. I've no
idea where/how to fix the nagios system.

Note that the "programstatus" table is just an example; I see the same
program with the hoststatus table. My suspicion is that nagios has lost
track of log rotation, but is unable to bootstrap itself.

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.18-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)