Herramientas de usuario

Herramientas del sitio


unattended_installations:installation_icinga_2

Installing Icinga 2

You can install Icinga 2 by using your distribution's package manager to install the icinga2 package.

# apt-get install icinga2

Enabled Features during Installation

The default installation will enable three features required for a basic Icinga 2 installation:

  • checker for executing checks
  • notification for sending notifications
  • mainlog for writing the icinga2.log file

You can verify that by calling icinga2 feature list CLI command to see which features are enabled and disabled.

 # icinga2 feature list
 Disabled features: api command compatlog debuglog graphite icingastatus ido-mysql ido-pgsql livestatus notification perfdata statusdata syslog
 Enabled features: checker mainlog notification

Installation Paths

By default Icinga 2 uses the following files and directories:

/etc/icinga2 	               Contains Icinga 2 configuration files.
/etc/init.d/icinga2 	       The Icinga 2 init script.
/usr/sbin/icinga2 	       The Icinga 2 binary.
/usr/share/doc/icinga2         Documentation files that come with Icinga 2.
/usr/share/icinga2/include     The Icinga Template Library and plugin command configuration.
/var/run/icinga2 	       PID file.
/var/run/icinga2/cmd 	       Command pipe and Livestatus socket.
/var/cache/icinga2 	       status.dat/objects.cache, icinga2.debug files
/var/spool/icinga2 	       Used for performance data spool files.
/var/lib/icinga2 	       Icinga 2 state file, cluster log, local CA and configuration files.
/var/log/icinga2 	       Log file location and compat/ directory for the CompatLogger feature.

Running Icinga 2

Init Script

Icinga 2's init script is installed in /etc/init.d/icinga2 by default:

# /etc/init.d/icinga2
Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status}

Configuration Syntax Highlighting

Icinga 2 ships configuration examples for syntax highlighting using the vim and nano editors.Debian package icinga2-common install these files into /usr/share/icinga2-common/syntax. Sources provide these files in tools/syntax.

Configuration Syntax Highlighting using Nano Copy the /etc/nanorc sample file to your home directory. Create the /etc/nano directory and copy the provided in /usr/share/icinga2-common/syntax/ icinga2.nanorc into it.

$ cp /etc/nanorc ~/.nanorc
# mkdir -p /etc/nano
# cp icinga2.nanorc /etc/nano/

Then include the icinga2.nanorc file in your ~/.nanorc by adding the following line:

$ nano ~/.nanorc
## Icinga 2
include "/etc/nano/icinga2.nanorc"

Test it:

$ nano /etc/icinga2/conf.d/templates.conf

Setting up Icinga Web 2

Icinga 2 can be used with Icinga Web 2 and a number of other web interfaces. This chapter explains how to set up Icinga Web 2.

The DB IDO (Database Icinga Data Output) modules for Icinga 2 take care of exporting all configuration and status information into a database. The IDO database is used by a number of projects including Icinga Web 2, Icinga Reporting or Icinga Web 1.x.

There is a separate module for each database backend. At present support for both MySQL and PostgreSQL is implemented.

Configuring DB IDO MySQL and Installing MySQL database server

# apt-get install mysql-server mysql-client

Installing the IDO modules for MySQL

The next step is to install the icinga2-ido-mysql package using your distribution's package manager.

# apt-get install icinga2-ido-mysql

Note

The Debian/Ubuntu packages provide a database configuration wizard by default. 
You can skip the automated setup and install/upgrade the database manually if you prefer that.

Setting up the MySQL database

Set up a MySQL database for Icinga 2:

# mysql -u root -p
mysql>  CREATE DATABASE icinga;
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
mysql> exit

After creating the database you can import the Icinga 2 IDO schema using the following command:

# mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql

The mysql.sql not contain the table structure to store users and preferences, so inside the database icinga have to create that structure to prevent errors when the configuration via web.

CREATE TABLE `icingaweb_group`(
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`parent` varchar(64) COLLATE utf8_unicode_ci NULL DEFAULT NULL,
`ctime` timestamp NULL DEFAULT NULL,
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `icingaweb_group_membership`(
`group_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`ctime` timestamp NULL DEFAULT NULL,
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`group_name`,`username`),
CONSTRAINT `fk_icingaweb_group_membership_icingaweb_group` FOREIGN KEY (`group_name`)
REFERENCES `icingaweb_group` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `icingaweb_user`(
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`active` tinyint(1) NOT NULL,
`password_hash` varbinary(255) NOT NULL,
`ctime` timestamp NULL DEFAULT NULL,
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `icingaweb_user_preference`(
`username` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`section` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`value` varchar(255) NOT NULL,
`ctime` timestamp NULL DEFAULT NULL,
`mtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, 
PRIMARY KEY (`username`,`section`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Enabling the IDO MySQL module

The package provides a new configuration file that is installed in /etc/icinga2/features-available/ido-mysql.conf. You will need to update the database credentials in this file.

You can enable the ido-mysql feature configuration file using icinga2 feature enable:

# icinga2 feature enable ido-mysql
Module 'ido-mysql' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.
# service icinga2 restart

Webserver

# apt-get install apache2

Setting Up External Command Pipe

# icinga2 feature enable command
# service icinga2 restart

By default the command pipe file is owned by the group icingacmd with read/write permissions. Add your webserver's user to the group icingacmd to enable sending commands to Icinga 2 through your web interface:

# usermod -a -G icingacmd www-data

Installing up Icinga Web 2

unattended_installations/installation_icinga_2.txt · Última modificación: 2022/11/02 17:58 por 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki