]> granicus.if.org Git - icinga2/commitdiff
Implement mods-available/mods-enabled.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 27 Sep 2013 08:44:24 +0000 (10:44 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 27 Sep 2013 08:45:38 +0000 (10:45 +0200)
Refs #4573

21 files changed:
configure.ac
doc/2.0-getting-started.md [new file with mode: 0644]
doc/2.1.1-setting-up-icinga-2.md [moved from doc/2-getting-started.md with 57% similarity]
doc/2.1.2-setting-up-icinga-classic-ui.md [new file with mode: 0644]
doc/2.1.3-setting-up-check-plugins.md [new file with mode: 0644]
doc/2.1.4-configuring-ido.md [new file with mode: 0644]
doc/2.2-running-icinga.md [new file with mode: 0644]
doc/2.3-monitoring-basics.md [new file with mode: 0644]
doc/3.1-configuration-syntax.md
doc/4-advanced-topics.md [new file with mode: 0644]
etc/icinga2/Makefile.am
etc/icinga2/conf.d/Makefile.am [new file with mode: 0644]
etc/icinga2/conf.d/localhost.conf [new file with mode: 0644]
etc/icinga2/conf.d/macros.conf [new file with mode: 0644]
etc/icinga2/icinga2.conf [new file with mode: 0644]
etc/icinga2/icinga2.conf.dist [deleted file]
etc/icinga2/mods-available/Makefile.am [new file with mode: 0644]
etc/icinga2/mods-available/compat.conf [new file with mode: 0644]
etc/icinga2/mods-available/compat.load [new file with mode: 0644]
lib/config/config_lexer.cc
tools/Makefile.am

index 68871ced1277f515360066666fae057fbf16d7b1..39d53aa1e34a2eb33e2aadbe5c09c008dfb58788 100644 (file)
@@ -138,6 +138,8 @@ docs/Doxyfile
 docs/Makefile
 etc/Makefile
 etc/icinga2/Makefile
+etc/icinga2/conf.d/Makefile
+etc/icinga2/mods-available/Makefile
 etc/init.d/Makefile
 icinga-app/Makefile
 itl/Makefile
@@ -153,6 +155,7 @@ third-party/cJSON/Makefile
 third-party/execvpe/Makefile
 third-party/mmatch/Makefile
 tools/Makefile
+tools/i2modconf
 tools/mkembedconfig/Makefile
 ])
 AC_OUTPUT([
diff --git a/doc/2.0-getting-started.md b/doc/2.0-getting-started.md
new file mode 100644 (file)
index 0000000..a705768
--- /dev/null
@@ -0,0 +1,7 @@
+# Getting Started
+
+## Installation
+
+This tutorial is a step-by-step introduction to installing Icinga 2 and
+the standalone version of the Icinga 1.x classic web interface. It assumes
+that you are familiar with the system you're installing Icinga 2 on.
similarity index 57%
rename from doc/2-getting-started.md
rename to doc/2.1.1-setting-up-icinga-2.md
index 15b5f873026faaacf13c6cc3d52f15067e457fb9..b100cefc2a114ec6596714e55e22135dcea3ab8d 100644 (file)
@@ -1,11 +1,3 @@
-# Getting Started
-
-## Installation
-
-This tutorial is a step-by-step introduction to installing Icinga 2 and
-the standalone version of the Icinga 1.x classic web interface. It assumes
-that you are familiar with the system you're installing Icinga 2 on.
-
 ### Setting up Icinga 2
 
 In order to get started with Icinga 2 you will have to install it. The
@@ -24,8 +16,9 @@ available. Please check http://packages.icinga.org/ to see if packages
 are available for your favorite distribution.
 
 In case you're running a distribution for which Icinga 2 packages are
-not yet available you will have to check out the Icinga 2 Git repository
-from git://git.icinga.org/icinga2 and read the *INSTALL* file.
+not yet available you will have to use the release tarball which you
+can download from the [Icinga website](https://www.icinga.org/). The
+release tarballs contain an *INSTALL* file with further information.
 
 #### Installation Paths
 
@@ -153,121 +146,3 @@ we enabled earlier by including the itl/itl.conf configuration file.
 The *macros* attribute can be used to define macros that are available for all
 services which belong to this host. Most of the templates in the Icinga Template
 Library require an *address* macro.
-
-### Setting up Icinga Classic UI
-
-Icinga 2 can write *status.dat* and *objects.cache* files in the format that
-is supported by the Icinga 1.x Classic UI. External commands (a.k.a. the
-"command pipe") are also supported. It also supports writing Icinga 1.x
-log files which are required for the reporting functionality in the Classic UI.
-
-These features are implemented as part of the *compat* library and are enabled
-by default in the example configuration file.
-
-You should be able to find the *status.dat* and *objects.cache* files in
-*/var/cache/icinga2*. The log files can be found in */var/log/icinga2/compat*.
-The command pipe can be found in */var/run/icinga2*.
-
-#### Installing Icinga Classic UI
-
-You can install Icinga 1.x Classic UI in standalone mode using the
-following commands:
-
-    $ wget http://downloads.sourceforge.net/project/icinga/icinga/1.9.3/icinga-1.9.3.tar.gz
-    $ tar xzf icinga-1.9.3.tar.gz ; cd icinga-1.9.3
-    $ ./configure --enable-classicui-standalone --prefix=/usr/local/icinga2-classicui
-    $ make classicui-standalone
-    $ sudo make install classicui-standalone install-webconf-auth
-    $ sudo service apache2 restart
-
-> **Note**
->
-> A detailed guide on installing Icinga 1.x Classic UI Standalone can be
-> found on the Icinga Wiki here:
-> [https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Classic+UI+Standalone](https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Classic+UI+Standalone)
-
-#### Configuring the Classic UI
-
-After installing the Classic UI you will need to update the following
-settings in your *cgi.cfg* configuration file in the *STANDALONE (ICINGA 2)
-OPTIONS* section:
-
-  Configuration Setting               |Value
-  ------------------------------------|------------------------------------
-  object\_cache\_file                 |/var/cache/icinga2/objects.cache
-  status\_file                        |/var/cache/icinga2/status.dat
-  resource\_file                      |-
-  command\_file                       |/var/run/icinga2/icinga2.cmd
-  check\_external\_commands           |1
-  interval\_length                    |60
-  status\_update\_interval            |10
-  log\_file                           |/var/log/icinga2/compat/icinga.log
-  log\_rotation\_method               |h
-  log\_archive\_path                  |/var/log/icinga2/compat/archives
-  date\_format                        |us
-  ------------------------------------ ------------------------------------
-
-> **Note**
->
-> Depending on how you installed Icinga 2 some of those paths and options
-> might be different.
-
-In order for commands to work you will need to grant the web server
-write permissions for the command pipe:
-
-    # chgrp www-data /var/run/icinga2/icinga2.cmd
-    # chmod 660 /var/run/icinga2/icinga2.cmd
-
-> **Note**
->
-> Change "www-data" to the group the Apache HTTP daemon is running as.
-
-Verify that your Icinga 1.x Classic UI works by browsing to your Classic
-UI installation URL, e.g.
-[http://localhost/icinga](http://localhost/icinga)
-
-### Configuring IDO
-
-TODO
-
-## Running Icinga
-
-TODO
-
-## Monitoring Basics
-
-### Hosts
-
-TODO
-
-### Services
-
-TODO
-
-### Check Commands
-
-TODO
-
-### Macros
-
-TODO
-
-## Using Templates
-
-TODO
-
-## Groups
-
-TODO
-
-## Host/Service Dependencies
-
-TODO
-
-## Time Periods
-
-TODO
-
-## Notifications
-
-TODO
diff --git a/doc/2.1.2-setting-up-icinga-classic-ui.md b/doc/2.1.2-setting-up-icinga-classic-ui.md
new file mode 100644 (file)
index 0000000..2e8cd70
--- /dev/null
@@ -0,0 +1,71 @@
+### Setting up Icinga Classic UI
+
+Icinga 2 can write *status.dat* and *objects.cache* files in the format that
+is supported by the Icinga 1.x Classic UI. External commands (a.k.a. the
+"command pipe") are also supported. It also supports writing Icinga 1.x
+log files which are required for the reporting functionality in the Classic UI.
+
+These features are implemented as part of the *compat* library and are enabled
+by default in the example configuration file.
+
+You should be able to find the *status.dat* and *objects.cache* files in
+*/var/cache/icinga2*. The log files can be found in */var/log/icinga2/compat*.
+The command pipe can be found in */var/run/icinga2*.
+
+#### Installing Icinga Classic UI
+
+You can install Icinga 1.x Classic UI in standalone mode using the
+following commands:
+
+    $ wget http://downloads.sourceforge.net/project/icinga/icinga/1.9.3/icinga-1.9.3.tar.gz
+    $ tar xzf icinga-1.9.3.tar.gz ; cd icinga-1.9.3
+    $ ./configure --enable-classicui-standalone --prefix=/usr/local/icinga2-classicui
+    $ make classicui-standalone
+    $ sudo make install classicui-standalone install-webconf-auth
+    $ sudo service apache2 restart
+
+> **Note**
+>
+> A detailed guide on installing Icinga 1.x Classic UI Standalone can be
+> found on the Icinga Wiki here:
+> [https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Classic+UI+Standalone](https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Classic+UI+Standalone)
+
+#### Configuring the Classic UI
+
+After installing the Classic UI you will need to update the following
+settings in your *cgi.cfg* configuration file in the *STANDALONE (ICINGA 2)
+OPTIONS* section:
+
+  Configuration Setting               |Value
+  ------------------------------------|------------------------------------
+  object\_cache\_file                 |/var/cache/icinga2/objects.cache
+  status\_file                        |/var/cache/icinga2/status.dat
+  resource\_file                      |-
+  command\_file                       |/var/run/icinga2/icinga2.cmd
+  check\_external\_commands           |1
+  interval\_length                    |60
+  status\_update\_interval            |10
+  log\_file                           |/var/log/icinga2/compat/icinga.log
+  log\_rotation\_method               |h
+  log\_archive\_path                  |/var/log/icinga2/compat/archives
+  date\_format                        |us
+  ------------------------------------ ------------------------------------
+
+> **Note**
+>
+> Depending on how you installed Icinga 2 some of those paths and options
+> might be different.
+
+In order for commands to work you will need to grant the web server
+write permissions for the command pipe:
+
+    # chgrp www-data /var/run/icinga2/icinga2.cmd
+    # chmod 660 /var/run/icinga2/icinga2.cmd
+
+> **Note**
+>
+> Change "www-data" to the group the Apache HTTP daemon is running as.
+
+Verify that your Icinga 1.x Classic UI works by browsing to your Classic
+UI installation URL, e.g.
+[http://localhost/icinga](http://localhost/icinga)
diff --git a/doc/2.1.3-setting-up-check-plugins.md b/doc/2.1.3-setting-up-check-plugins.md
new file mode 100644 (file)
index 0000000..3736c23
--- /dev/null
@@ -0,0 +1,22 @@
+### Setting up Check Plugins
+
+On its own Icinga 2 does not know how to check external services. The
+[Nagios Plugins Project](https://www.nagios-plugins.org/) provides an extensive
+set of *plugins* which can be used by Icinga 2 to check whether services are
+working properly.
+
+The recommended way of installing these standard plugins is to use your
+distribution's package manager. For your convenience here is a list of package
+names for some of the more popular operating systems/distributions:
+
+OS/Distribution | Package Name   | Installation Path
+----------------|----------------|---------------------------
+RHEL/CentOS     | nagios-plugins | /usr/lib/nagios/plugins
+Debian          | nagios-plugins | /usr/lib/nagios/plugins
+FreeBSD         | nagios-plugins | /usr/local/libexec/nagios
+OS X (MacPorts) | nagios-plugins | /opt/local/libexec
+
+Depending on which directory your plugins are installed into you may need to
+update the *plugindir* macro in your Icinga 2 configuration. This macro is used
+by the service templates contained in the Icinga Template Library to determine
+where to find the plugin binaries.
\ No newline at end of file
diff --git a/doc/2.1.4-configuring-ido.md b/doc/2.1.4-configuring-ido.md
new file mode 100644 (file)
index 0000000..678bf37
--- /dev/null
@@ -0,0 +1,3 @@
+### Configuring IDO
+
+TODO
diff --git a/doc/2.2-running-icinga.md b/doc/2.2-running-icinga.md
new file mode 100644 (file)
index 0000000..988c0e8
--- /dev/null
@@ -0,0 +1,3 @@
+## Running Icinga
+
+TODO
diff --git a/doc/2.3-monitoring-basics.md b/doc/2.3-monitoring-basics.md
new file mode 100644 (file)
index 0000000..be56ae0
--- /dev/null
@@ -0,0 +1,38 @@
+## Monitoring Basics
+
+### Hosts
+
+TODO
+
+### Services
+
+TODO
+
+### Check Commands
+
+TODO
+
+### Macros
+
+TODO
+
+## Using Templates
+
+TODO
+
+## Groups
+
+TODO
+
+## Host/Service Dependencies
+
+TODO
+
+## Time Periods
+
+TODO
+
+## Notifications
+
+TODO
+
index 01fa7ac78046188cc486e11a78a35592c2444b0b..1bd229cd32e18fdf06c4848d94a043730ed3f9a9 100644 (file)
@@ -306,7 +306,7 @@ Global variables may be used in constant expressions.
 > Constant expressions are evaluated as soon as they're encountered in
 > the configuration file.
 
-### <a id="comments" /> Comments
+### <a id="comments"></a> Comments
 
 The Icinga 2 configuration format supports C/C++-style comments.
 
diff --git a/doc/4-advanced-topics.md b/doc/4-advanced-topics.md
new file mode 100644 (file)
index 0000000..e8ad2bf
--- /dev/null
@@ -0,0 +1,13 @@
+# Advanced Topics
+
+## External Commands
+
+TODO
+
+## Event Handlers
+
+TODO
+
+## Cluster
+
+TODO
index 452e13451d69b21c560b8253483e530b67bf8831..3007070762de6a3e4f9f115599ad5e706f8fffc7 100644 (file)
@@ -1,5 +1,26 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = \
+       conf.d \
+       mods-available
+
 icinga2confdir = $(sysconfdir)/icinga2
-icinga2conf_DATA = \
-       icinga2.conf.dist
 
-EXTRA_DIST = $(icinga2conf_DATA)
+CONFIG_FILES = \
+       icinga2.conf
+
+install-data-local:
+       @for file in $(CONFIG_FILES); do \
+       if [ ! -e $(icinga2confdir)/$$file ]; then \
+         $(INSTALL_DATA) $$file $(icinga2confdir)/$$file; \
+       fi; \
+       done
+
+EXTRA_DIST = $(CONFIG_FILES)
+
+install-exec-hook:
+       @cd $(icinga2confdir) && \
+       if [ ! -e mods-enabled ]; then \
+         $(MKDIR_P) mods-enabled && \
+         $(LN_S) ../mods-available/compat.conf mods-enabled/; \
+       fi
diff --git a/etc/icinga2/conf.d/Makefile.am b/etc/icinga2/conf.d/Makefile.am
new file mode 100644 (file)
index 0000000..46a37b0
--- /dev/null
@@ -0,0 +1,16 @@
+## Process this file with automake to produce Makefile.in
+
+icinga2confdir = $(sysconfdir)/icinga2/conf.d
+
+CONFIG_FILES = \
+       localhost.conf \
+       macros.conf
+
+install-data-local:
+       @for file in $(CONFIG_FILES); do \
+       if [ ! -e $(icinga2confdir)/$$file ]; then \
+         $(INSTALL_DATA) $$file $(icinga2confdir)/$$file; \
+       fi; \
+       done
+
+EXTRA_DIST = $(CONFIG_FILES)
diff --git a/etc/icinga2/conf.d/localhost.conf b/etc/icinga2/conf.d/localhost.conf
new file mode 100644 (file)
index 0000000..191bffa
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * And finally we define some host that should be checked.
+ */
+object Host "localhost" {
+  services["ping4"] = {
+    templates = [ "ping4" ]
+  },
+
+  services["ping6"] = {
+    templates = [ "ping6" ]
+  },
+
+  services["http"] = {
+    templates = [ "http_ip" ]
+  },
+
+  services["ssh"] = {
+    templates = [ "ssh" ]
+  },
+
+  services["load"] = {
+    templates = [ "load" ]
+  },
+
+  services["processes"] = {
+    templates = [ "processes" ]
+  },
+
+  services["users"] = {
+    templates = [ "users" ]
+  },
+
+  services["disk"] = {
+    templates = [ "disk" ]
+  },
+
+  macros = {
+    address = "127.0.0.1",
+    address6 = "::1",
+  },
+  
+  check = "ping4",
+}
diff --git a/etc/icinga2/conf.d/macros.conf b/etc/icinga2/conf.d/macros.conf
new file mode 100644 (file)
index 0000000..fc270e2
--- /dev/null
@@ -0,0 +1,7 @@
+/**
+ * Global macros
+ */
+set IcingaMacros = {
+  plugindir = "/usr/lib/nagios/plugins"
+}
+
diff --git a/etc/icinga2/icinga2.conf b/etc/icinga2/icinga2.conf
new file mode 100644 (file)
index 0000000..2be576a
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * Icinga 2 configuration file
+ * - this is where you define settings for the Icinga application including
+ * which hosts/services to check.
+ *
+ * For an overview of all available configuration options please refer
+ * to the documentation that is distributed as part of Icinga 2.
+ */
+
+include <itl/itl.conf>
+include <itl/standalone.conf>
+
+/**
+ * The mods-available directory contains a number of configuration
+ * files for features which can be enabled and disabled using the
+ * i2enmod / i2dismod tools. These two tools work by creating
+ * and removing symbolic links in the mods-enabled directory.
+ */
+include "mods-enabled/*.conf"
+
+/**
+ * Although in theory you could define all your objects in this file
+ * the preferred way is to create separate files in the conf.d
+ * directory.
+ */
+include "conf.d/*.conf"
+
diff --git a/etc/icinga2/icinga2.conf.dist b/etc/icinga2/icinga2.conf.dist
deleted file mode 100644 (file)
index d0a52eb..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Icinga 2 configuration file
- * - this is where you define settings for the Icinga application including
- * which hosts/services to check.
- *
- * The docs/icinga2-config.adoc file in the source tarball has a detailed
- * description of what configuration options are available.
- */
-
-include <itl/itl.conf>
-include <itl/standalone.conf>
-
-/**
- * Global macros
- */
-set IcingaMacros = {
-  plugindir = "/usr/local/icinga/libexec"
-}
-
-/**
- * The compat library 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. CompatLog writeis the Icinga 1.x icinga.log and archives.
- */
-library "compat"
-object StatusDataWriter "status" { }
-object ExternalCommandListener "command" { }
-object CompatLogger "compat-log" { }
-
-/**
- * And finally we define some host that should be checked.
- */
-object Host "localhost" {
-  services["ping4"] = {
-    templates = [ "ping4" ]
-  },
-
-  services["ping6"] = {
-    templates = [ "ping6" ]
-  },
-
-  services["http"] = {
-    templates = [ "http_ip" ]
-  },
-
-  services["ssh"] = {
-    templates = [ "ssh" ]
-  },
-
-  services["load"] = {
-    templates = [ "load" ]
-  },
-
-  services["processes"] = {
-    templates = [ "processes" ]
-  },
-
-  services["users"] = {
-    templates = [ "users" ]
-  },
-
-  services["disk"] = {
-    templates = [ "disk" ]
-  },
-
-  macros = {
-    address = "127.0.0.1",
-    address6 = "::1",
-  },
-  
-  check = "ping4",
-}
diff --git a/etc/icinga2/mods-available/Makefile.am b/etc/icinga2/mods-available/Makefile.am
new file mode 100644 (file)
index 0000000..7051316
--- /dev/null
@@ -0,0 +1,17 @@
+## Process this file with automake to produce Makefile.in
+
+icinga2confdir = $(sysconfdir)/icinga2/mods-available
+icinga2conf_DATA = \
+       compat.load
+
+CONFIG_FILES = \
+       compat.conf
+
+install-data-local:
+       @for file in $(CONFIG_FILES); do \
+       if [ ! -e $(icinga2confdir)/$$file ]; then \
+         $(INSTALL_DATA) $$file $(icinga2confdir)/$$file; \
+       fi; \
+       done
+
+EXTRA_DIST = $(CONFIG_FILES) $(icinga2conf_DATA)
diff --git a/etc/icinga2/mods-available/compat.conf b/etc/icinga2/mods-available/compat.conf
new file mode 100644 (file)
index 0000000..2c636f3
--- /dev/null
@@ -0,0 +1,12 @@
+/**
+ * The compat library 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. CompatLog writeis the Icinga 1.x icinga.log and archives.
+ */
+
+include "compat.load"
+
+object StatusDataWriter "status" { }
+object ExternalCommandListener "command" { }
+object CompatLogger "compat-log" { }
+
diff --git a/etc/icinga2/mods-available/compat.load b/etc/icinga2/mods-available/compat.load
new file mode 100644 (file)
index 0000000..f99df2f
--- /dev/null
@@ -0,0 +1,2 @@
+library "compat"
+
index db634672619cfc5eba74d10ec12507ff65e2ee90..a765a78e40339f98be90abb3349940bb935a9c0f 100644 (file)
@@ -1,5 +1,5 @@
 
-#line 3 "config_lexer.cc"
+#line 3 "../../../lib/config/config_lexer.cc"
 
 #define  YY_INT_ALIGNED short int
 
@@ -676,7 +676,7 @@ static char *lb_steal(lex_buf *lb)
 
 
 
-#line 680 "config_lexer.cc"
+#line 680 "../../../lib/config/config_lexer.cc"
 
 #define INITIAL 0
 #define C_COMMENT 1
@@ -933,7 +933,7 @@ YY_DECL
 
        lex_buf string_buf;
 
-#line 937 "config_lexer.cc"
+#line 937 "../../../lib/config/config_lexer.cc"
 
     yylval = yylval_param;
 
@@ -1382,7 +1382,7 @@ YY_RULE_SETUP
 #line 230 "config_lexer.ll"
 ECHO;
        YY_BREAK
-#line 1386 "config_lexer.cc"
+#line 1386 "../../../lib/config/config_lexer.cc"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(C_COMMENT):
 case YY_STATE_EOF(STRING):
index 9f4d8e98012305dac5673967a858ee51ec3bdc7a..5d21b1d6e6bab46b9f9b9ef5251f300beaac22de 100644 (file)
@@ -1,3 +1,11 @@
-
 SUBDIRS = \
                  mkembedconfig
+
+bin_SCRIPTS = i2modconf
+CLEANFILES = $(bin_SCRIPTS)
+
+EXTRA_DIST = i2modconf.in
+
+install-exec-hook:
+       $(LN_S) -f i2modconf $(bindir)/i2enmod
+       $(LN_S) -f i2modconf $(bindir)/i2dismod