Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Merge branch 'feature/add-check-source-node-name-5612' into next
Browse files Browse the repository at this point in the history
Fixes #5612
  • Loading branch information
Michael Friedrich committed Feb 6, 2014
2 parents 28e0875 + adef108 commit 86081d0
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 1 deletion.
15 changes: 15 additions & 0 deletions module/idoutils/db/mysql/mysql.sql
Expand Up @@ -39,6 +39,7 @@ CREATE TABLE IF NOT EXISTS icinga_acknowledgements (
persistent_comment smallint default 0,
notify_contacts smallint default 0,
end_time timestamp default '0000-00-00 00:00:00',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (acknowledgement_id)
) ENGINE=InnoDB COMMENT='Current and historical host and service acknowledgements';

Expand Down Expand Up @@ -82,6 +83,7 @@ CREATE TABLE IF NOT EXISTS icinga_commenthistory (
expiration_time timestamp default '0000-00-00 00:00:00',
deletion_time timestamp default '0000-00-00 00:00:00',
deletion_time_usec int default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (commenthistory_id),
UNIQUE KEY instance_id (instance_id,object_id,comment_time,internal_comment_id)
) ENGINE=InnoDB COMMENT='Historical host and service comments';
Expand Down Expand Up @@ -232,6 +234,7 @@ CREATE TABLE IF NOT EXISTS icinga_contactnotifications (
start_time_usec int default 0,
end_time timestamp default '0000-00-00 00:00:00',
end_time_usec int default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (contactnotification_id),
UNIQUE KEY instance_id (instance_id,contact_object_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical record of contact notifications';
Expand Down Expand Up @@ -407,6 +410,7 @@ CREATE TABLE IF NOT EXISTS icinga_downtimehistory (
was_cancelled smallint default 0,
is_in_effect smallint default 0,
trigger_time timestamp default '0000-00-00 00:00:00',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (downtimehistory_id),
UNIQUE KEY instance_id (instance_id,object_id,entry_time,internal_downtime_id)
) ENGINE=InnoDB COMMENT='Historical scheduled host and service downtime';
Expand Down Expand Up @@ -437,6 +441,7 @@ CREATE TABLE IF NOT EXISTS icinga_eventhandlers (
return_code smallint default 0,
output TEXT character set latin1 default '',
long_output TEXT default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (eventhandler_id),
UNIQUE KEY instance_id (instance_id,object_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical host and service event handlers';
Expand All @@ -454,6 +459,7 @@ CREATE TABLE IF NOT EXISTS icinga_externalcommands (
command_type smallint default 0,
command_name varchar(128) character set latin1 default '',
command_args TEXT character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (externalcommand_id)
) ENGINE=InnoDB COMMENT='Historical record of processed external commands';

Expand All @@ -477,6 +483,7 @@ CREATE TABLE IF NOT EXISTS icinga_flappinghistory (
high_threshold double default '0',
comment_time timestamp default '0000-00-00 00:00:00',
internal_comment_id bigint unsigned default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (flappinghistory_id)
) ENGINE=InnoDB COMMENT='Current and historical record of host and service flapping';

Expand Down Expand Up @@ -511,6 +518,7 @@ CREATE TABLE IF NOT EXISTS icinga_hostchecks (
output TEXT character set latin1 default '',
long_output TEXT default '',
perfdata TEXT character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (hostcheck_id)
) ENGINE=InnoDB COMMENT='Historical host checks';

Expand Down Expand Up @@ -820,6 +828,7 @@ CREATE TABLE IF NOT EXISTS icinga_logentries (
realtime_data smallint default 0,
inferred_data_extracted smallint default 0,
object_id bigint unsigned default NULL,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (logentry_id)
) ENGINE=InnoDB COMMENT='Historical record of log entries';

Expand All @@ -844,6 +853,7 @@ CREATE TABLE IF NOT EXISTS icinga_notifications (
long_output TEXT default '',
escalated smallint default 0,
contacts_notified smallint default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (notification_id),
UNIQUE KEY instance_id (instance_id,object_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical record of host and service notifications';
Expand Down Expand Up @@ -881,6 +891,7 @@ CREATE TABLE IF NOT EXISTS icinga_processevents (
program_name varchar(16) character set latin1 default '',
program_version varchar(20) character set latin1 default '',
program_date varchar(10) character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (processevent_id)
) ENGINE=InnoDB COMMENT='Historical Icinga process events';

Expand Down Expand Up @@ -995,6 +1006,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicechecks (
output TEXT character set latin1 default '',
long_output TEXT default '',
perfdata TEXT character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (servicecheck_id)
) ENGINE=InnoDB COMMENT='Historical service checks';

Expand Down Expand Up @@ -1277,6 +1289,8 @@ CREATE TABLE IF NOT EXISTS icinga_statehistory (
last_hard_state smallint default 0,
output TEXT character set latin1 default '',
long_output TEXT default '',
check_source varchar(255) character set latin1 default NULL,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (statehistory_id)
) ENGINE=InnoDB COMMENT='Historical host and service state changes';

Expand All @@ -1300,6 +1314,7 @@ CREATE TABLE IF NOT EXISTS icinga_systemcommands (
return_code smallint default 0,
output TEXT character set latin1 default '',
long_output TEXT default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (systemcommand_id),
UNIQUE KEY instance_id (instance_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical system commands that are executed';
Expand Down
20 changes: 20 additions & 0 deletions module/idoutils/db/mysql/upgrade/mysql-upgrade-1.11.0.sql
Expand Up @@ -18,6 +18,26 @@ ALTER TABLE icinga_programstatus ADD COLUMN config_dump_in_progress SMALLINT DEF
-- -----------------------------------------
CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, comment_time, internal_comment_id);

-- -----------------------------------------
-- #5612
-- -----------------------------------------
ALTER TABLE icinga_statehistory ADD COLUMN check_source varchar(255) character set latin1 default NULL;

ALTER TABLE icinga_acknowledgements ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_commenthistory ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_contactnotifications ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_downtimehistory ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_eventhandlers ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_externalcommands ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_flappinghistory ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_hostchecks ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_logentries ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_notifications ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_processevents ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_servicechecks ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_statehistory ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;
ALTER TABLE icinga_systemcommands ADD COLUMN icinga_node varchar(255) character set latin1 default NULL;

-- -----------------------------------------
-- update dbversion
-- -----------------------------------------
Expand Down
17 changes: 16 additions & 1 deletion module/idoutils/db/oracle/create_icinga_objects_oracle.sql
Expand Up @@ -248,6 +248,7 @@ CREATE TABLE acknowledgements (
is_sticky integer default 0 ,
persistent_comment integer default 0 ,
notify_contacts integer default 0,
icinga_node varchar2(255) default NULL,
end_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR')
) tablespace &&DATATBS ;

Expand Down Expand Up @@ -294,6 +295,7 @@ CREATE TABLE commenthistory (
expires integer default 0 ,
expiration_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR') ,
deletion_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR') ,
icinga_node varchar2(255) default NULL,
deletion_time_usec integer default 0
)tablespace &&DATATBS;

Expand Down Expand Up @@ -502,6 +504,7 @@ CREATE TABLE contactnotifications (
instance_id integer default 0 ,
notification_id integer default 0 ,
contact_object_id integer default 0 ,
icinga_node varchar2(255) default NULL,
start_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR') ,
start_time_usec integer default 0 ,
end_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR') ,
Expand Down Expand Up @@ -672,6 +675,7 @@ CREATE TABLE downtimehistory (
actual_end_time_usec integer default 0 ,
was_cancelled integer default 0,
is_in_effect integer default 0,
icinga_node varchar2(255) default NULL,
trigger_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR')
)tablespace &&DATATBS;

Expand Down Expand Up @@ -705,6 +709,7 @@ CREATE TABLE eventhandlers (
early_timeout integer default 0 ,
execution_time number default 0 ,
return_code integer default 0 ,
icinga_node varchar2(255) default NULL,
output clob,
long_output clob
)
Expand All @@ -727,6 +732,7 @@ CREATE TABLE externalcommands (
id integer ,
instance_id integer default 0 ,
entry_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR') ,
icinga_node varchar2(255) default NULL,
command_type integer default 0 ,
command_name varchar2(128),
command_args varchar2(1024)
Expand Down Expand Up @@ -756,6 +762,7 @@ CREATE TABLE flappinghistory (
low_threshold number default 0 ,
high_threshold number default 0 ,
comment_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR') ,
icinga_node varchar2(255) default NULL,
internal_comment_id integer default 0
)
tablespace &&DATATBS;
Expand Down Expand Up @@ -842,6 +849,7 @@ CREATE TABLE hostchecks (
execution_time number default 0 ,
latency number default 0 ,
return_code integer default 0 ,
icinga_node varchar2(255) default NULL,
output clob,
long_output clob,
perfdata clob)
Expand Down Expand Up @@ -1154,6 +1162,7 @@ CREATE TABLE logentries (
logentry_data clob,
realtime_data integer default 0 ,
inferred_data_extracted integer default 0 ,
icinga_node varchar2(255) default NULL,
object_id integer default NULL
)
lob (logentry_data) store as logentries_data_lob(tablespace &&LOBTBS)
Expand Down Expand Up @@ -1183,6 +1192,7 @@ CREATE TABLE notifications (
output clob,
long_output clob,
escalated integer default 0 ,
icinga_node varchar2(255) default NULL,
contacts_notified integer default 0
)
lob (output) store as notifications_outp_lob(tablespace &&LOBTBS)
Expand Down Expand Up @@ -1231,6 +1241,7 @@ CREATE TABLE processevents (
event_time TIMESTAMP(0) WITH LOCAL TIME ZONE default TO_TIMESTAMP_TZ('01.01.1970 UTC','DD.MM.YYYY TZR') ,
event_time_usec integer default 0 ,
process_id integer default 0 ,
icinga_node varchar2(255) default NULL,
program_name varchar2(16),
program_version varchar2(20),
program_date varchar2(10)
Expand Down Expand Up @@ -1395,6 +1406,7 @@ CREATE TABLE servicechecks (
execution_time number default 0 ,
latency number default 0 ,
return_code integer default 0 ,
icinga_node varchar2(255) default NULL,
output clob,
long_output clob,
perfdata clob
Expand Down Expand Up @@ -1688,7 +1700,9 @@ CREATE TABLE statehistory (
last_state integer default -1 ,
last_hard_state integer default -1 ,
output clob,
long_output clob
long_output clob,
icinga_node varchar2(255) default NULL,
check_source varchar2(255) default NULL,
)
lob (output) store as statehistory_outp_lob(tablespace &&LOBTBS)
lob (long_output) store as statehistory_loutp_lob(tablespace &&LOBTBS)
Expand Down Expand Up @@ -1716,6 +1730,7 @@ CREATE TABLE systemcommands (
early_timeout integer default 0 ,
execution_time number default 0 ,
return_code integer default 0 ,
icinga_node varchar2(255) default NULL,
output clob,
long_output clob
)
Expand Down
20 changes: 20 additions & 0 deletions module/idoutils/db/oracle/upgrade/oracle-upgrade-1.11.0.sql
Expand Up @@ -46,6 +46,26 @@ ALTER TABLE programstatus ADD config_dump_in_progress integer default 0;
-- -----------------------------------------
CREATE INDEX commenthistory_delete_idx ON commenthistory (instance_id, comment_time, internal_comment_id) tablespace &&IDXTBS;

-- -----------------------------------------
-- #5612
-- -----------------------------------------
ALTER TABLE statehistory ADD check_source varchar2(255) default NULL;

ALTER TABLE acknowledgements ADD icinga_node varchar2(255) default NULL;
ALTER TABLE commenthistory ADD icinga_node varchar2(255) default NULL;
ALTER TABLE contactnotifications ADD icinga_node varchar2(255) default NULL;
ALTER TABLE downtimehistory ADD icinga_node varchar2(255) default NULL;
ALTER TABLE eventhandlers ADD icinga_node varchar2(255) default NULL;
ALTER TABLE externalcommands ADD icinga_node varchar2(255) default NULL;
ALTER TABLE flappinghistory ADD icinga_node varchar2(255) default NULL;
ALTER TABLE hostchecks ADD icinga_node varchar2(255) default NULL;
ALTER TABLE logentries ADD icinga_node varchar2(255) default NULL;
ALTER TABLE notifications ADD icinga_node varchar2(255) default NULL;
ALTER TABLE processevents ADD icinga_node varchar2(255) default NULL;
ALTER TABLE servicechecks ADD icinga_node varchar2(255) default NULL;
ALTER TABLE statehistory ADD icinga_node varchar2(255) default NULL;
ALTER TABLE systemcommands ADD icinga_node varchar2(255) default NULL;

-- -----------------------------------------
-- finally update dbversion
-- -----------------------------------------
Expand Down
15 changes: 15 additions & 0 deletions module/idoutils/db/pgsql/pgsql.sql
Expand Up @@ -65,6 +65,7 @@ CREATE TABLE icinga_acknowledgements (
persistent_comment INTEGER default 0,
notify_contacts INTEGER default 0,
end_time timestamp with time zone default '1970-01-01 00:00:00',
icinga_node text default NULL,
CONSTRAINT PK_acknowledgement_id PRIMARY KEY (acknowledgement_id)
) ;

Expand Down Expand Up @@ -108,6 +109,7 @@ CREATE TABLE icinga_commenthistory (
expiration_time timestamp with time zone default '1970-01-01 00:00:00',
deletion_time timestamp with time zone default '1970-01-01 00:00:00',
deletion_time_usec INTEGER default 0,
icinga_node text default NULL,
CONSTRAINT PK_commenthistory_id PRIMARY KEY (commenthistory_id) ,
CONSTRAINT UQ_commenthistory UNIQUE (instance_id,object_id,comment_time,internal_comment_id)
);
Expand Down Expand Up @@ -258,6 +260,7 @@ CREATE TABLE icinga_contactnotifications (
start_time_usec INTEGER default 0,
end_time timestamp with time zone default '1970-01-01 00:00:00',
end_time_usec INTEGER default 0,
icinga_node text default NULL,
CONSTRAINT PK_contactnotification_id PRIMARY KEY (contactnotification_id) ,
CONSTRAINT UQ_contactnotifications UNIQUE (instance_id,contact_object_id,start_time,start_time_usec)
) ;
Expand Down Expand Up @@ -434,6 +437,7 @@ CREATE TABLE icinga_downtimehistory (
was_cancelled INTEGER default 0,
is_in_effect INTEGER default 0,
trigger_time timestamp with time zone default '1970-01-01 00:00:00',
icinga_node text default NULL,
CONSTRAINT PK_downtimehistory_id PRIMARY KEY (downtimehistory_id) ,
CONSTRAINT UQ_downtimehistory UNIQUE (instance_id,object_id,entry_time,internal_downtime_id)
) ;
Expand Down Expand Up @@ -464,6 +468,7 @@ CREATE TABLE icinga_eventhandlers (
return_code INTEGER default 0,
output TEXT default '',
long_output TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_eventhandler_id PRIMARY KEY (eventhandler_id) ,
CONSTRAINT UQ_eventhandlers UNIQUE (instance_id,object_id,start_time,start_time_usec)
) ;
Expand All @@ -481,6 +486,7 @@ CREATE TABLE icinga_externalcommands (
command_type INTEGER default 0,
command_name TEXT default '',
command_args TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_externalcommand_id PRIMARY KEY (externalcommand_id)
) ;

Expand All @@ -504,6 +510,7 @@ CREATE TABLE icinga_flappinghistory (
high_threshold double precision default 0,
comment_time timestamp with time zone default '1970-01-01 00:00:00',
internal_comment_id bigint default 0,
icinga_node text default NULL,
CONSTRAINT PK_flappinghistory_id PRIMARY KEY (flappinghistory_id)
) ;

Expand Down Expand Up @@ -538,6 +545,7 @@ CREATE TABLE icinga_hostchecks (
output TEXT default '',
long_output TEXT default '',
perfdata TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_hostcheck_id PRIMARY KEY (hostcheck_id)
) ;

Expand Down Expand Up @@ -846,6 +854,7 @@ CREATE TABLE icinga_logentries (
realtime_data INTEGER default 0,
inferred_data_extracted INTEGER default 0,
object_id bigint default NULL,
icinga_node text default NULL,
CONSTRAINT PK_logentry_id PRIMARY KEY (logentry_id)
) ;

Expand All @@ -870,6 +879,7 @@ CREATE TABLE icinga_notifications (
long_output TEXT default '',
escalated INTEGER default 0,
contacts_notified INTEGER default 0,
icinga_node text default NULL,
CONSTRAINT PK_notification_id PRIMARY KEY (notification_id) ,
CONSTRAINT UQ_notifications UNIQUE (instance_id,object_id,start_time,start_time_usec)
) ;
Expand Down Expand Up @@ -908,6 +918,7 @@ CREATE TABLE icinga_processevents (
program_name TEXT default '',
program_version TEXT default '',
program_date TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_processevent_id PRIMARY KEY (processevent_id)
) ;

Expand Down Expand Up @@ -1022,6 +1033,7 @@ CREATE TABLE icinga_servicechecks (
output TEXT default '',
long_output TEXT default '',
perfdata TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_servicecheck_id PRIMARY KEY (servicecheck_id)
) ;

Expand Down Expand Up @@ -1303,6 +1315,8 @@ CREATE TABLE icinga_statehistory (
last_hard_state INTEGER default '-1',
output TEXT default '',
long_output TEXT default '',
check_source varchar(255) default NULL,
icinga_node text default NULL,
CONSTRAINT PK_statehistory_id PRIMARY KEY (statehistory_id)
) ;

Expand All @@ -1326,6 +1340,7 @@ CREATE TABLE icinga_systemcommands (
return_code INTEGER default 0,
output TEXT default '',
long_output TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_systemcommand_id PRIMARY KEY (systemcommand_id) ,
CONSTRAINT UQ_systemcommands UNIQUE (instance_id,start_time,start_time_usec)
) ;
Expand Down

0 comments on commit 86081d0

Please sign in to comment.