Implement mods-available/mods-enabled.

Refs #4573
This commit is contained in:
Gunnar Beutner 2013-09-27 10:44:24 +02:00
parent 41e6d50693
commit 74708766d1
21 changed files with 326 additions and 210 deletions

View 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([

View File

@ -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.

View 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

View File

@ -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)

View File

@ -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.

View File

@ -0,0 +1,3 @@
### Configuring IDO
TODO

View File

@ -0,0 +1,3 @@
## Running Icinga
TODO

View File

@ -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

View 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.

13
doc/4-advanced-topics.md Normal file
View File

@ -0,0 +1,13 @@
# Advanced Topics
## External Commands
TODO
## Event Handlers
TODO
## Cluster
TODO

View File

@ -1,5 +1,26 @@
icinga2confdir = $(sysconfdir)/icinga2
icinga2conf_DATA = \
icinga2.conf.dist
## Process this file with automake to produce Makefile.in
EXTRA_DIST = $(icinga2conf_DATA)
SUBDIRS = \
conf.d \
mods-available
icinga2confdir = $(sysconfdir)/icinga2
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

View File

@ -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)

View File

@ -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",
}

View File

@ -0,0 +1,7 @@
/**
* Global macros
*/
set IcingaMacros = {
plugindir = "/usr/lib/nagios/plugins"
}

27
etc/icinga2/icinga2.conf Normal file
View File

@ -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"

View File

@ -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",
}

View File

@ -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)

View File

@ -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" { }

View File

@ -0,0 +1,2 @@
library "compat"

View 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):

View 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