¡Esta es una revisión vieja del documento!
Tabla de Contenidos
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
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.