Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.03k stars 579 forks source link

[dev.icinga.com #5266] failing query causes reconnect with DELETE/UPDATE (missing INSERT) #1011

Closed icinga-migration closed 10 years ago

icinga-migration commented 10 years ago

This issue has been migrated from Redmine: https://dev.icinga.com/issues/5266

Created by mfriedrich on 2013-12-05 10:01:45 +00:00

Assignee: mfriedrich Status: Resolved (closed on 2013-12-05 11:14:08 +00:00) Target Version: 0.0.6 Last Update: 2014-09-16 09:19:36 +00:00 (in Redmine)

Icinga Version: 0.0.6-dev

[2013-12-05 10:48:58 +0100]  information/base: WQ #1 items: 0
[2013-12-05 10:48:58 +0100]  debug/checker: Executing service check for 'c1-dns-3:bind-response'
[2013-12-05 10:48:58 +0100]  debug/checker: Executing service check for 'c1-exchange-2:win-exchange imap'
[2013-12-05 10:48:58 +0100]  debug/db_ido: add service check history for 'c1-dns-3:bind-response'
[2013-12-05 10:48:58 +0100]  debug/checker: Check finished for service 'c1-dns-3:bind-response'
[2013-12-05 10:48:58 +0100]  debug/checker: ResultTimerHandler entered.
[2013-12-05 10:48:58 +0100]  information/checker: Pending services: 3; Idle services: 363; Checks/s: 2.4
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: SELECT version FROM icinga_dbversion WHERE name='idoutils'
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: SELECT instance_id FROM icinga_instances WHERE instance_name = 'icinga2'
[2013-12-05 10:48:58 +0100]  information/db_ido_mysql: MySQL IDO instance id: 1 (schema version: '1.11.0')
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: SET SESSION TIME_ZONE='+00:00'
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: INSERT INTO icinga_conninfo (instance_id, connect_time, last_checkin_time, agent_name, agent_version, connect_type, data_start_time) VALUES (1, NOW()
, NOW(), 'icinga2 db_ido_mysql', 'v0.0.5', 'INITIAL', NOW())
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_commands WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_comments WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_contact_addresses WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_contact_notificationcommands WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_contactgroup_members WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_contactgroups WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_contacts WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_contactstatus WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_customvariables WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_customvariablestatus WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_host_contactgroups WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_host_contacts WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_host_parenthosts WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/base: Thread pool; current: 8; adjustment: 0
[2013-12-05 10:48:58 +0100]  information/base: Pool #2: Pending tasks: 0; Average latency: 0ms; Max latency: 0ms; Threads: 8; Pool utilization: 4.16823%
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_hostdependencies WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_hostgroup_members WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_hostgroups WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_hosts WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_hoststatus WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_programstatus WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_scheduleddowntime WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_service_contactgroups WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_service_contacts WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_servicedependencies WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_servicegroup_members WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_servicegroups WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_services WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_servicestatus WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_timeperiod_timeranges WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: DELETE FROM icinga_timeperiods WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: SELECT object_id, objecttype_id, name1, name2, is_active FROM icinga_objects WHERE instance_id = 1
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: BEGIN

[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5',  config_type = '1',  instance_id = 1,  object_id = 40 WHERE object_id = 40
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_akcp -H $HOSTADDRESS$ -C $USER4$ -P $ARG1$ -w $ARG2$ -c $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 41 WHERE object_id = 41
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_fake.pl --state=$ARG1$',  config_type = '1',  instance_id = 1,  object_id = 42 WHERE object_id = 42
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_fujitsu_primergy.pl -H $HOSTADDRESS$ -C $ARG1$',  config_type = '1',  instance_id = 1,  object_id = 43 WHERE object_id = 43
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_http -H $HOSTADRESS$ -w 5 -c 10',  config_type = '1',  instance_id = 1,  object_id = 44 WHERE object_id = 44
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_http -H $ARG1$',  config_type = '1',  instance_id = 1,  object_id = 45 WHERE object_id = 45
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_imap -H $HOSTADDRESS$',  config_type = '1',  instance_id = 1,  object_id = 46 WHERE object_id = 46
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_interfaces -h $HOSTADDRESS$ -c $ARG1$ -r $ARG2$ -p \'$SERVICEPERFDATA$\' -t $LASTSERVICECHECK$ -d',  config_type = '1',  instance_id = 1,  object_id = 47 WHERE object_id = 47
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_ipmi_sensor -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -T $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 48 WHERE object_id = 48
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_knuerr_rms.pl -H $HOSTADDRESS$ -I $ARG1$',  config_type = '1',  instance_id = 1,  object_id = 49 WHERE object_id = 49
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_knuerr_rms.pl -H $HOSTADDRESS$ --clamp $ARG1$',  config_type = '1',  instance_id = 1,  object_id = 50 WHERE object_id = 50
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 51 WHERE object_id = 51
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_load -w $ARG1$ -c $ARG2$',  config_type = '1',  instance_id = 1,  object_id = 52 WHERE object_id = 52
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 53 WHERE object_id = 53
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_swap -w $ARG1$ -c $ARG2$',  config_type = '1',  instance_id = 1,  object_id = 54 WHERE object_id = 54
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_users -w $ARG1$ -c $ARG2$',  config_type = '1',  instance_id = 1,  object_id = 55 WHERE object_id = 55
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_pcmeasure2.pl -H $HOSTADDRESS$ -S $ARG1$ -w $ARG2$ -c $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 56 WHERE object_id = 56
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_mysql_health --hostname $HOSTADDRESS$ --username $USER10$ --password $USER11$ --mode $ARG1$ $ARG2$',  config_type = '1',  instance_id = 1,  object_id = 57 WHERE object_id = 57
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_nrpe -n -H $HOSTADDRESS$ -p $ARG1$ -c $ARG2$ $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 58 WHERE object_id = 58
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_dummy $ARG1$ \"$ARG2$\"',  config_type = '1',  instance_id = 1,  object_id = 59 WHERE object_id = 59
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_phoney/check_phoney.py -H $HOSTNAME$ -A $HOSTADDRESS$ -S $SERVICENAME$ -c $ARG1$ $ARG2$',  config_type = '1',  instance_id = 1,  object_id = 60 WHERE object_id = 60
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5',  config_type = '1',  instance_id = 1,  object_id = 61 WHERE object_id = 61
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_pop -H $HOSTADDRESS$',  config_type = '1',  instance_id = 1,  object_id = 62 WHERE object_id = 62
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_senturion.pl -H $HOSTADDRESS$ -C public -t $ARG1$ -w $ARG2$ -c $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 63 WHERE object_id = 63
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_smtp -H $HOSTADDRESS$',  config_type = '1',  instance_id = 1,  object_id = 64 WHERE object_id = 64
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$',  config_type = '1',  instance_id = 1,  object_id = 65 WHERE object_id = 65
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/check_ssh $ARG1$ $HOSTADDRESS$',  config_type = '1',  instance_id = 1,  object_id = 66 WHERE object_id = 66
[2013-12-05 10:48:58 +0100]  debug/db_ido_mysql: Query: UPDATE icinga_commands SET command_line = '$USER1$/custom/check_temptraxe -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$',  config_type = '1',  instance_id = 1,  object_id = 67 WHERE object_id = 67

Changesets

2013-12-05 11:12:57 +00:00 by (unknown) fa14b39719822ca9a46edccedf06080d85180591

DB IDO: Fix reconnect config/status inserts.

Fixes #5266
icinga-migration commented 10 years ago

Updated by mfriedrich on 2013-12-05 10:42:45 +00:00

UPDATE only for tables

all related queries (such as icinga_host_parenthosts, icinga_hostdependencies or icinga_service_contacts, icinga_service_contactgroups) are performed using the required INSERT query.

side effect of the missing servicegroup_object_id -> GetObjectID returns -1 and inserts that into the members table.

[2013-12-05 10:48:59 +0100]  debug/db_ido_mysql: Query: INSERT INTO icinga_servicegroup_members (instance_id, service_object_id, servicegroup_id) VALUES (1, 232, -1)

something changed with the handling of DynamicObjects and their OnConfigUpdate() handling, causing UPDATE instead of INSERT queries in this regard.

icinga-migration commented 10 years ago

Updated by Anonymous on 2013-12-05 11:14:08 +00:00

Applied in changeset i2:fa14b39719822ca9a46edccedf06080d85180591.

icinga-migration commented 10 years ago

Updated by mfriedrich on 2014-09-16 09:19:36 +00:00