From 4a0e8df2f207929a0b59cb509f0a1061ace131cf Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 13 Jul 2017 12:25:23 +0200 Subject: [PATCH] Host,Service: add check_timeout property fixes #546 --- library/Director/Objects/IcingaHost.php | 2 ++ library/Director/Objects/IcingaService.php | 2 ++ library/Director/Web/Form/DirectorObjectForm.php | 12 ++++++++++++ schema/mysql-migrations/upgrade_135.sql | 9 +++++++++ schema/mysql.sql | 4 +++- schema/pgsql-migrations/upgrade_135.sql | 9 +++++++++ schema/pgsql.sql | 4 +++- 7 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 schema/mysql-migrations/upgrade_135.sql create mode 100644 schema/pgsql-migrations/upgrade_135.sql diff --git a/library/Director/Objects/IcingaHost.php b/library/Director/Objects/IcingaHost.php index 985979af..36bf38c7 100644 --- a/library/Director/Objects/IcingaHost.php +++ b/library/Director/Objects/IcingaHost.php @@ -27,6 +27,7 @@ class IcingaHost extends IcingaObject 'check_period_id' => null, 'check_interval' => null, 'retry_interval' => null, + 'check_timeout' => null, 'enable_notifications' => null, 'enable_active_checks' => null, 'enable_passive_checks' => null, @@ -74,6 +75,7 @@ class IcingaHost extends IcingaObject protected $intervalProperties = array( 'check_interval' => 'check_interval', + 'check_timeout' => 'check_timeout', 'retry_interval' => 'retry_interval', ); diff --git a/library/Director/Objects/IcingaService.php b/library/Director/Objects/IcingaService.php index 590fc763..c49ec9db 100644 --- a/library/Director/Objects/IcingaService.php +++ b/library/Director/Objects/IcingaService.php @@ -27,6 +27,7 @@ class IcingaService extends IcingaObject 'check_period_id' => null, 'check_interval' => null, 'retry_interval' => null, + 'check_timeout' => null, 'enable_notifications' => null, 'enable_active_checks' => null, 'enable_passive_checks' => null, @@ -75,6 +76,7 @@ class IcingaService extends IcingaObject protected $intervalProperties = array( 'check_interval' => 'check_interval', + 'check_timeout' => 'check_timeout', 'retry_interval' => 'retry_interval', ); diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php index c057d036..d3883c77 100644 --- a/library/Director/Web/Form/DirectorObjectForm.php +++ b/library/Director/Web/Form/DirectorObjectForm.php @@ -1196,6 +1196,17 @@ abstract class DirectorObjectForm extends DirectorForm ) ); + $this->addElement( + 'text', + 'check_timeout', + array( + 'label' => $this->translate('Check timeout'), + 'description' => $this->translate( + "Check command timeout in seconds. Overrides the CheckCommand's timeout attribute" + ) + ) + ); + $periods = $this->db->enumTimeperiods(); if (!empty($periods)) { @@ -1253,6 +1264,7 @@ abstract class DirectorObjectForm extends DirectorForm 'check_interval', 'retry_interval', 'max_check_attempts', + 'check_timeout', 'check_period_id', 'enable_active_checks', 'enable_passive_checks', diff --git a/schema/mysql-migrations/upgrade_135.sql b/schema/mysql-migrations/upgrade_135.sql new file mode 100644 index 00000000..6a1d6878 --- /dev/null +++ b/schema/mysql-migrations/upgrade_135.sql @@ -0,0 +1,9 @@ +ALTER TABLE icinga_host + ADD COLUMN check_timeout SMALLINT UNSIGNED DEFAULT NULL AFTER retry_interval; + +ALTER TABLE icinga_service + ADD COLUMN check_timeout SMALLINT UNSIGNED DEFAULT NULL AFTER retry_interval; + +INSERT INTO director_schema_migration +(schema_version, migration_time) +VALUES (135, NOW()); diff --git a/schema/mysql.sql b/schema/mysql.sql index a07008aa..e6e6c679 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -444,6 +444,7 @@ CREATE TABLE icinga_host ( check_period_id INT(10) UNSIGNED DEFAULT NULL, check_interval VARCHAR(8) DEFAULT NULL, retry_interval VARCHAR(8) DEFAULT NULL, + check_timeout SMALLINT UNSIGNED DEFAULT NULL, enable_notifications ENUM('y', 'n') DEFAULT NULL, enable_active_checks ENUM('y', 'n') DEFAULT NULL, enable_passive_checks ENUM('y', 'n') DEFAULT NULL, @@ -592,6 +593,7 @@ CREATE TABLE icinga_service ( check_period_id INT(10) UNSIGNED DEFAULT NULL, check_interval VARCHAR(8) DEFAULT NULL, retry_interval VARCHAR(8) DEFAULT NULL, + check_timeout SMALLINT UNSIGNED DEFAULT NULL, enable_notifications ENUM('y', 'n') DEFAULT NULL, enable_active_checks ENUM('y', 'n') DEFAULT NULL, enable_passive_checks ENUM('y', 'n') DEFAULT NULL, @@ -1556,4 +1558,4 @@ CREATE TABLE icinga_user_resolved_var ( INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (134, NOW()); + VALUES (135, NOW()); diff --git a/schema/pgsql-migrations/upgrade_135.sql b/schema/pgsql-migrations/upgrade_135.sql new file mode 100644 index 00000000..63adfc0c --- /dev/null +++ b/schema/pgsql-migrations/upgrade_135.sql @@ -0,0 +1,9 @@ +ALTER TABLE icinga_host + ADD COLUMN check_timeout smallint DEFAULT NULL; + +ALTER TABLE icinga_service + ADD COLUMN check_timeout smallint DEFAULT NULL; + +INSERT INTO director_schema_migration + (schema_version, migration_time) + VALUES (135, NOW()); diff --git a/schema/pgsql.sql b/schema/pgsql.sql index ab622922..19b1cda4 100644 --- a/schema/pgsql.sql +++ b/schema/pgsql.sql @@ -568,6 +568,7 @@ CREATE TABLE icinga_host ( check_period_id integer DEFAULT NULL, check_interval character varying(8) DEFAULT NULL, retry_interval character varying(8) DEFAULT NULL, + check_timeout smallint DEFAULT NULL, enable_notifications enum_boolean DEFAULT NULL, enable_active_checks enum_boolean DEFAULT NULL, enable_passive_checks enum_boolean DEFAULT NULL, @@ -742,6 +743,7 @@ CREATE TABLE icinga_service ( check_period_id integer DEFAULT NULL, check_interval character varying(8) DEFAULT NULL, retry_interval character varying(8) DEFAULT NULL, + check_timeout smallint DEFAULT NULL, enable_notifications enum_boolean DEFAULT NULL, enable_active_checks enum_boolean DEFAULT NULL, enable_passive_checks enum_boolean DEFAULT NULL, @@ -1833,4 +1835,4 @@ CREATE INDEX user_resolved_var_schecksum ON icinga_user_resolved_var (checksum); INSERT INTO director_schema_migration (schema_version, migration_time) - VALUES (134, NOW()); + VALUES (135, NOW());