[icinga-checkins] icinga.org: icingaweb2-module-director/feature-ddo-playground: Ddo/*State: clean up columns

git at icinga.org git at icinga.org
Tue Jun 21 15:07:35 CEST 2016


Module: icingaweb2-module-director
Branch: feature-ddo-playground
Commit: afd9bc2e9bfe2476e1cd4a11e0a94d1cd071f811
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=afd9bc2e9bfe2476e1cd4a11e0a94d1cd071f811

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jun 21 15:05:32 2016 +0200

Ddo/*State: clean up columns

---

 library/Director/Ddo/HostState.php    |   21 +++++++++++++++++----
 library/Director/Ddo/ServiceState.php |   19 ++++++++++++++++---
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/library/Director/Ddo/HostState.php b/library/Director/Ddo/HostState.php
index 70f6967..0c726a2 100644
--- a/library/Director/Ddo/HostState.php
+++ b/library/Director/Ddo/HostState.php
@@ -4,7 +4,7 @@ namespace Icinga\Module\Director\Ddo;
 
 class HostState extends StateObject
 {
-    protected $table = 'ddo_host_state';
+    protected $table = 'host_state';
 
     protected $keyName = 'checksum';
 
@@ -13,19 +13,32 @@ class HostState extends StateObject
         'checksum'              => null,
         'host'                  => null,
         'state'                 => null,
-        'state_type'            => null,
         'hard_state'            => null,
+        'state_type'            => null,
+        'attempt'               => null,
+        'problem'               => null,
+        'reachable'             => null,
         'severity'              => null,
         'acknowledged'          => null,
         'in_downtime'           => null,
         'last_update'           => null, // only on store if modified
         'last_state_change'     => null,
         'last_comment_checksum' => null,
-        'attempt'               => null,
-        'reachable'             => null,
         'check_source_checksum' => null,
     );
 
+    protected $booleans = array(
+        'problem',
+        'reachable',
+        'acknowledged',
+        'in_downtime'
+    );
+
+    protected $timestamps = array(
+        'last_update',
+        'last_state_change',
+    );
+
     protected function getSortingState()
     {
         return self::$hostStateSortMap[$this->state];
diff --git a/library/Director/Ddo/ServiceState.php b/library/Director/Ddo/ServiceState.php
index be621d3..3f1ce43 100644
--- a/library/Director/Ddo/ServiceState.php
+++ b/library/Director/Ddo/ServiceState.php
@@ -4,20 +4,21 @@ namespace Icinga\Module\Director\Ddo;
 
 class ServiceState extends StateObject
 {
-    protected $table = 'ddo_service_state';
+    protected $table = 'service_state';
 
     protected $keyName = 'checksum';
 
     protected $defaultProperties = array(
         // active ?
         'checksum'              => null,
-        'host_checksum'         => null,
+        // 'host_checksum'         => null,
         'host'                  => null,
         'service'               => null,
         'state'                 => null,
-        'state_type'            => null,
         'hard_state'            => null,
+        'state_type'            => null,
         'attempt'               => null,
+        'problem'               => null,
         'reachable'             => null,
         'severity'              => null,
         'acknowledged'          => null,
@@ -28,6 +29,18 @@ class ServiceState extends StateObject
         'check_source_checksum' => null,
     );
 
+    protected $booleans = array(
+        'problem',
+        'reachable',
+        'acknowledged',
+        'in_downtime'
+    );
+
+    protected $timestamps = array(
+        'last_update',
+        'last_state_change',
+    );
+
     protected function calculateSeverity()
     {
         $sev = parent::calculateSeverity();



More information about the icinga-checkins mailing list