[icinga-checkins] icinga.org: icinga2-migration/master: add Icinga 2 Dependency and Notification object basis

git at icinga.org git at icinga.org
Sun Jun 15 01:56:17 CEST 2014


Module: icinga2-migration
Branch: master
Commit: cdeb139b459ae41ab3d0258e3aacca79534a33a2
URL:    https://git.icinga.org/?p=icinga2-migration.git;a=commit;h=cdeb139b459ae41ab3d0258e3aacca79534a33a2

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Sat Jun 14 23:03:57 2014 +0200

add Icinga 2 Dependency and Notification object basis

---

 .../application/clicommands/MigrateCommand.php     |   24 +++++++++++
 .../library/Conftool/Icinga2/Icinga2Dependency.php |   43 ++++++++++++++++++++
 .../Conftool/Icinga2/Icinga2Notification.php       |   43 ++++++++++++++++++++
 .../Conftool/Icinga2/Icinga2ObjectDefinition.php   |   20 +++++++++
 4 files changed, 130 insertions(+)

diff --git a/modules/conftool/application/clicommands/MigrateCommand.php b/modules/conftool/application/clicommands/MigrateCommand.php
index 0ae23e5..f3f7368 100644
--- a/modules/conftool/application/clicommands/MigrateCommand.php
+++ b/modules/conftool/application/clicommands/MigrateCommand.php
@@ -121,6 +121,30 @@ class MigrateCommand extends Command
         }
         printf("//MIGRATE TIMEPERIODS -- END\n");
 
+        printf("//MIGRATE HOST DEPENDENCIES -- BEGIN\n");
+        foreach ($config->getDefinitions('hostdependency') as $object) {
+            Icinga2ObjectDefinition::fromIcingaObjectDefinition($object, $config)->dump();
+        }
+        printf("//MIGRATE HOST DEPENDENCIES -- END\n");
+
+        printf("//MIGRATE SERVICE DEPENDENCIES -- BEGIN\n");
+        foreach ($config->getDefinitions('servicedependency') as $object) {
+            Icinga2ObjectDefinition::fromIcingaObjectDefinition($object, $config)->dump();
+        }
+        printf("//MIGRATE SERVICE DEPENDENCIES -- END\n");
+
+        printf("//MIGRATE HOST ESCALATION -- BEGIN\n");
+        foreach ($config->getDefinitions('hostescalation') as $object) {
+            Icinga2ObjectDefinition::fromIcingaObjectDefinition($object, $config)->dump();
+        }
+        printf("//MIGRATE HOST ESCALATION -- END\n");
+
+        printf("//MIGRATE SERVICE ESCALATION -- BEGIN\n");
+        foreach ($config->getDefinitions('serviceescalation') as $object) {
+            Icinga2ObjectDefinition::fromIcingaObjectDefinition($object, $config)->dump();
+        }
+        printf("//MIGRATE SERVICE ESCALATION -- END\n");
+
         $end = microtime(true);
         $runtime = $end - $start;
 
diff --git a/modules/conftool/library/Conftool/Icinga2/Icinga2Dependency.php b/modules/conftool/library/Conftool/Icinga2/Icinga2Dependency.php
new file mode 100644
index 0000000..1bdeb9f
--- /dev/null
+++ b/modules/conftool/library/Conftool/Icinga2/Icinga2Dependency.php
@@ -0,0 +1,43 @@
+<?php
+// {{{ICINGA_LICENSE_HEADER}}}
+/**
+ * This file is part of Icinga Web 2.
+ *
+ * Icinga Web 2 - Head for multiple monitoring backends.
+ * Copyright (C) 2014 Icinga Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * @copyright  2013 Icinga Development Team <info at icinga.org>
+ * @license    http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
+ * @author     Icinga Development Team <info at icinga.org>
+ *
+ */
+// {{{ICINGA_LICENSE_HEADER}}}
+
+namespace Icinga\Module\Conftool\Icinga2;
+
+class Icinga2Dependency extends Icinga2ObjectDefinition
+{
+    protected $type = 'Dependency';
+
+    protected $v1AttributeMap = array(
+        //
+    );
+
+    protected function convertDependency_line($line) {
+
+    }
+}
\ No newline at end of file
diff --git a/modules/conftool/library/Conftool/Icinga2/Icinga2Notification.php b/modules/conftool/library/Conftool/Icinga2/Icinga2Notification.php
new file mode 100644
index 0000000..f42bc4e
--- /dev/null
+++ b/modules/conftool/library/Conftool/Icinga2/Icinga2Notification.php
@@ -0,0 +1,43 @@
+<?php
+// {{{ICINGA_LICENSE_HEADER}}}
+/**
+ * This file is part of Icinga Web 2.
+ *
+ * Icinga Web 2 - Head for multiple monitoring backends.
+ * Copyright (C) 2014 Icinga Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * @copyright  2013 Icinga Development Team <info at icinga.org>
+ * @license    http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
+ * @author     Icinga Development Team <info at icinga.org>
+ *
+ */
+// {{{ICINGA_LICENSE_HEADER}}}
+
+namespace Icinga\Module\Conftool\Icinga2;
+
+class Icinga2Notification extends Icinga2ObjectDefinition
+{
+    protected $type = 'Notification'; // FIXME
+
+    protected $v1AttributeMap = array(
+        //'command_line' => 'command',
+    );
+
+    protected function convertNotification_line($line) {
+
+    }
+}
\ No newline at end of file
diff --git a/modules/conftool/library/Conftool/Icinga2/Icinga2ObjectDefinition.php b/modules/conftool/library/Conftool/Icinga2/Icinga2ObjectDefinition.php
index 84e7493..b57b7a0 100644
--- a/modules/conftool/library/Conftool/Icinga2/Icinga2ObjectDefinition.php
+++ b/modules/conftool/library/Conftool/Icinga2/Icinga2ObjectDefinition.php
@@ -555,6 +555,26 @@ class Icinga2ObjectDefinition
                 $new->setAttributesFromIcingaObjectDefinition($object, $config);
                 break;
 
+            case 'hostdependency':
+                $new = new Icinga2Dependency($object);
+                $new->setAttributesFromIcingaObjectDefinition($object, $config);
+                break;
+
+            case 'servicedependency':
+                $new = new Icinga2Dependency($object);
+                $new->setAttributesFromIcingaObjectDefinition($object, $config);
+                break;
+
+            case 'hostescalation':
+                $new = new Icinga2Notification($object);
+                $new->setAttributesFromIcingaObjectDefinition($object, $config);
+                break;
+
+            case 'serviceescalation':
+                $new = new Icinga2Notification($object);
+                $new->setAttributesFromIcingaObjectDefinition($object, $config);
+                break;
+
             default:
                 throw new Icinga2ConfigMigrationException(
                     sprintf(



More information about the icinga-checkins mailing list