[Nagios-devel] [PATCH] NODutils: Duplicate lines in servicechecks

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] [PATCH] NODutils: Duplicate lines in servicechecks

Post by Guest »

As remarked in the other thread, the unique constraints for the table
nagios_servicechecks is missing causing duplicate rows. This patch
removes the KEY defines and adds an unique key just like
nagios_hostchecks has defined too.

As I am not sure in which file you will put the ALTER statements since
1.4b9 is out already, I'll attach those statements as is.

--------------------------

diff --git a/db/mysql.sql b/db/mysql.sql
index 3036f46..386a460 100644
--- a/db/mysql.sql
+++ b/db/mysql.sql
@@ -1004,9 +1004,7 @@ CREATE TABLE IF NOT EXISTS `nagios_servicechecks` (
`long_output` TEXT NOT NULL default '',
`perfdata` TEXT character set latin1 NOT NULL default '',
PRIMARY KEY (`servicecheck_id`),
- KEY `instance_id` (`instance_id`),
- KEY `service_object_id` (`service_object_id`),
- KEY `start_time` (`start_time`)
+ UNIQUE KEY `instance_id`
(`instance_id`,`service_object_id`,`start_time`,`start_time_usec`)
) ENGINE=MyISAM COMMENT='Historical service checks';

--------------------------

ALTER table nagios_servicechecks DROP KEY instance_id;
ALTER table nagios_servicechecks DROP KEY service_object_id;
ALTER table nagios_servicechecks DROP KEY start_time;

ALTER table nagios_servicechecks ADD UNIQUE KEY `instance_id`
(`instance_id`,`service_object_id`,`start_time`,`start_time_usec`);

--------------------------

I've tested the patch and everything works fine now - no more duplicate
rows.

Kind regards,
Michael

--
DI (FH) Michael Friedrich
[email protected]
Tel: +43 1 4277 14359

Vienna University Computer Center
Universitaetsstrasse 7
A-1010 Vienna, Austria






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked