]> granicus.if.org Git - icinga2/commitdiff
contrib: Add MF's test config for compat/ido/livestatus
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 12 Aug 2013 11:33:51 +0000 (13:33 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 12 Aug 2013 11:33:51 +0000 (13:33 +0200)
contrib/config/mf/README [new file with mode: 0644]
contrib/config/mf/icinga2.conf [new file with mode: 0644]

diff --git a/contrib/config/mf/README b/contrib/config/mf/README
new file mode 100644 (file)
index 0000000..d8028b8
--- /dev/null
@@ -0,0 +1,5 @@
+This directory contains sample and test configuration
+for Icinga 2 by MF (Michael Friedrich, dnsmichi).
+
+May be changed or not work, and later deleted once general
+test config is sorted.
diff --git a/contrib/config/mf/icinga2.conf b/contrib/config/mf/icinga2.conf
new file mode 100644 (file)
index 0000000..a87686c
--- /dev/null
@@ -0,0 +1,294 @@
+/**
+ * Icinga 2 configuration file
+ * - this is where you define settings for the Icinga application including
+ * which hosts/services to check.
+ *
+ * The docs/icinga2-config.txt file in the source tarball has a detailed
+ * description of what configuration options are available.
+ */
+
+include <itl/itl.conf>
+include <itl/standalone.conf>
+
+/**
+ * Global configuration settings
+ */
+local object IcingaApplication "icinga" {
+ macros = {
+    plugindir = "/usr/lib/nagios/plugins",
+    iconimagedir = "/icinga2/images/icons"
+  }
+}
+
+/**
+ * Enable Syslogger
+ */
+ /*
+local object SyslogLogger "icinga2-syslog" {
+    severity = "information"
+}
+
+local object FileLogger "my-debug-file" {
+  severity = "debug",
+  path = "/home/michi/i2/var/log/icinga2/icinga2-debug.log"
+}
+*/
+/**
+ * The compat component periodically updates the status.dat and objects.cache
+ * files. These are used by the Icinga 1.x CGIs to display the state of
+ * hosts and services.
+ */
+library "compat"
+local object CompatComponent "compat" { }
+local object CompatLog "compat-log" { }
+
+/**
+ * INGRAPH
+ */
+local object PerfdataWriter "pnp" {
+  perfdata_path = "/data/icinga2/perfdata/service-perfdata",
+  format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$",
+  rotation_interval = 15s,
+}
+
+/**
+ * LIVESTATUS
+ */
+library "livestatus"
+
+local object LivestatusComponent "livestatus-tcp" {
+  socket_type = "tcp",
+  host = "10.0.10.18",
+  port = "6558"
+}
+
+local object LivestatusComponent "livestatus-unix" {
+  socket_type = "unix",
+  socket_path = "/home/michi/i2/var/run/icinga2/livestatus"
+}
+
+/**
+ * IDO
+ */
+library "ido_mysql"
+
+local object MysqlDbConnection "ido-mysql" {
+  host = "127.0.0.1",
+  port = "3306",
+  user = "icinga",
+  password = "icinga",
+  database = "icinga",
+  table_prefix = "icinga_",
+  instance_name = "icinga2",
+  instance_description = "icinga2 dev instance"
+}
+
+
+/**
+ * And finally we define some host that should be checked.
+ */
+set bumsti = 60
+
+template Service "notification-tmpl" {
+  notifications["mail-michi"] = {
+      templates = [ "mail-notification" ],
+      users = [ "michi" ],
+  },
+}
+
+template Service "flapper" inherits "ping4" {
+
+  notifications["mail-michi"] = {
+      templates = [ "mail-notification" ],
+      users = [ "michi" ],
+  },
+  check_command = "flapme",
+
+  enable_flapping = 1,
+  flapping_threshold = 20,
+  check_interval = 15s,
+  custom = {
+    "foo1" = "bar1",
+    "foo5" = "bar5"
+  },
+  servicegroups = [ "sg-thruk" ],
+}
+
+object Host "dummy01" {
+  hostgroups = [ "hg-thruk" ],
+  services["flapme"] = {
+    templates = [ "flapper" ],
+    check_command = "flapme",
+  },
+}
+
+object Host "localhost" {
+  services["flapme"] = {
+    templates = [ "flapper" ],
+    notifications["mail-michi"] = {
+        templates = [ "mail-notification" ],
+        users = [ "michi" ],
+        groups = [ "all-michis" ],
+        notification_period = "24x7",
+       notification_state_filter = (StateFilterUnknown | StateFilterOK | StateFilterWarning | StateFilterCritical),
+       notification_type_filter = (NotificationRecovery | NotificationDowntimeStart | NotificationDowntimeEnd),
+    },
+    check_command = "flapme",
+
+    enable_flapping = 1,
+    flapping_threshold = 20,
+    check_interval = 15s,
+
+    custom += {
+      "foo1" = "bar1",
+      "foo2" = "bar2",
+      "notes" = "flapping test $SERVICEATTEMPT$ / $MAXSERVICEATTEMPT$",
+      "notes_url" = "https://www.icinga.org/$HOSTNAME$/$SERVICEDESC$/$TIMET$",
+      "action_url" = "https://dev.icinga.org/$HOSTADDRESS$/$SERVICESTATE$",
+      "icon_image" = "$iconimagedir$/icinga2.png",
+      "icon_image_alt" = "custom attr macro expand test"
+    },
+    servicegroups = [ "sg-thruk" ],
+  },
+  services["ping4"] = {
+    templates = [ "ping4", "notification-tmpl" ],
+  },
+  services["ping6"] = {
+    templates = [ "ping6", "notification-tmpl" ],
+  },
+  services["ssh"] = {
+    templates = [ "ssh", "notification-tmpl" ],
+  },
+  services["load"] = {
+    templates = [ "load", "notification-tmpl" ],
+  },
+  services["users"] = {
+    templates = [ "users", "notification-tmpl" ],
+    servicegroups = [ "sg-thruk" ],
+    servicedependencies = [
+       { host = "dummy01", service = "flapme" },
+    ],
+  },
+
+  macros = {
+    address = "127.0.0.1",
+    address6 = "::1",
+  },
+
+  hostdependencies = [ "dummy01" ],
+  custom += {
+    "fooh1" = "barh1",
+    "fooh2" = "barh2",
+    "notes" = "host test $SERVICEATTEMPT$ / $MAXSERVICEATTEMPT$", /* this should work with hostcheck set */
+    "notes_url" = "https://www.icinga.org/$HOSTNAME$/$SERVICEDESC$/$TIMET$",
+    "action_url" = "https://dev.icinga.org/$HOSTADDRESS$/$SERVICESTATE$",
+    "icon_image" = "$iconimagedir$/icinga2.png",
+    "icon_image_alt" = "custom attr macro expand test",
+    "2d_coords" = "42,1337"
+  },
+
+  //hostcheck = "ping4",
+  hostcheck = "flapme",
+
+  hostgroups = [ "hg-thruk" ],
+
+  check_interval = (bumsti * 5)
+}
+
+object HostGroup "hg-thruk" {
+       display_name = "hg thruk livestatus",
+       custom = {
+               action_url = "http://www.icinga.org/about/icinga2",
+               notes_url = "http://docs.icinga.org/latest/en",
+               notes = "This is the icinga2 livestatus test"
+       }
+}
+
+object ServiceGroup "sg-thruk" {
+       display_name = "sg thruk livestatus",
+       custom = {
+               action_url = "http://www.icinga.org/about/icinga2",
+               notes_url = "http://docs.icinga.org/latest/en",
+               notes = "This is the icinga2 livestatus test"
+       }
+}
+
+object CheckCommand "flapme" inherits "plugin-check-command" {
+    command = "/home/michi/coding/icinga/icinga2/contrib/flap.sh",
+}
+
+object EventCommand "eventme" inherits "plugin-event-command" {
+    command = "echo \"event fired\"",
+}
+
+object NotificationCommand "notifyme" inherits "plugin-notification-command" {
+    command = "echo \"hello\"",
+}
+
+object NotificationCommand "mail" inherits "plugin-notification-command" {
+
+    command = "echo `date +%s` >> /tmp/i2.notify"
+}
+
+object User "michi-clone" {
+  groups = [ "all-michis" ],
+}
+
+object User "michi" {
+  groups = [ "all-michis" ],
+  notification_state_filter = (StateFilterUnknown | StateFilterOK | StateFilterWarning | StateFilterCritical),
+
+  enable_notifications = 1,
+  notification_period = "24x7",
+
+  macros = {
+    "name" = "bumsti",
+    "pager" = "keks@kekse.de",
+    "email" = "michael.friedrich@icinga.org",
+  },
+
+  custom = {
+    "cv_key01" = "cv_val01",
+    "cv_key03" = "cv_val03",
+    "cv_key07" = "cv_val07",
+  }
+}
+
+object UserGroup "all-michis" {
+  display_name = "all my michis",
+}
+
+template Notification "mail-notification" {
+
+    notification_command = "mail",
+}
+
+object TimePeriod "8x5" inherits "legacy-timeperiod" {
+  display_name = "icinga 2 8x5",
+  ranges = {
+    "monday" = "09:00-17:00",
+    "tuesday" = "09:00-17:00",
+    "wednesday" = "09:00-17:00",
+    "thursday" = "09:00-17:00",
+    "friday" = "09:00-17:00",
+  }
+}
+
+object TimePeriod "24x7" inherits "legacy-timeperiod" {
+  display_name = "icinga 2 24x7",
+  ranges = {
+    "monday" = "00:00-24:00",
+    "tuesday" = "00:00-24:00",
+    "wednesday" = "00:00-24:00",
+    "thursday" = "00:00-24:00",
+    "friday" = "00:00-24:00",
+    "saturday" = "00:00-24:00",
+    "sunday" = "00:00-24:00",
+  }
+}
+
+object TimePeriod "none" inherits "legacy-timeperiod" {
+  display_name = "icinga 2 none",
+  ranges = {
+  }
+}