How to Add Icinga Director for Icinga2 and Icinga Web 2.

The design of Icinga Director is as such to make Icinga 2 configuration handling easy. It tries to target two main audiences:

  • Users with the desire to completely automate their datacenter
  • Sysops willing to grant their “point & click” users a lot of flexibility

What makes Icinga Director so special is the fact that it tries to target both of them at once.

Icinga Director uses the Icinga 2 API to talk to your monitoring system. It will help you to deploy your configuration, regardless of whether you are using a single node Icinga installation or a distributed setup with multiple masters and satellites.

To install Icinga Director please install Icinga2 and Icinga Web 2 using the following link:

How to install and configure Icinga2 and Icinga2 Web on CentOS 8 – Unixcop

After completing installation of Icniga2 and Icinga Web 2 create Database and permission for Director.

mysql -u root -p

Now, Enter the password that was set in the installation of Icinga2 and Icinga Web 2.

You will now enter in the DB, Create database and set user and its persmission.

CREATE DATABASE director CHARACTER SET 'utf8';
GRANT ALL ON director.* TO 'director'@'localhost' IDENTIFIED BY 'director';
FLUSH PRIVILEGES;
QUIT

Create a bash script and make it executable. We will use it to install Icinga director and its dependencies.

nano create_icinga_director.sh

Add the following line in the script:

#!/bin/bash
ICINGAWEB_MODULEPATH="/usr/share/icingaweb2/modules"
REPO_URL="https://github.com/icinga/icingaweb2-module-director"
TARGET_DIR="${ICINGAWEB_MODULEPATH}/director"
MODULE_VERSION="1.7.2"
git clone "${REPO_URL}" "${TARGET_DIR}" --branch v${MODULE_VERSION}
MODULE_NAME=incubator
MODULE_VERSION=v0.5.0
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"
MODULE_NAME=ipl
MODULE_VERSION=v0.5.0
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"
MODULE_NAME=reactbundle
MODULE_VERSION=v0.7.0
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"

save and quit the script file.

Give executable right using following command:

chmod +x create_icinga_director.sh

Run the bash script using following command:

bash create_icinga_director.sh

Load the schema for Director Database using below mentioned command:

mysql -u root -p director < /usr/share/icingaweb2/modules/director/schema/mysql.sql

Enable Director module.

icingacli module enable director

Creating New Resource;

You need now to log in into your Icinga Web, and create a new resource. Go to Configuration -> Application -> Resources. Then click Create New Resource, you need to set Resource Name, Database Name, Username, Password and Character Set. After that click on Validate Configuration, and if everything is OK, then click on Save Changes. During the Kickstart process of Icinga Director you will need to provide the credentials for an ApiUser, you can use the root user defined in api-users.conf.

create a file named director-service.sh, give execution permission and execute it.

nano director-permission.sh

Add the following script in the file:

#!/bin/bash
useradd -r -g icingaweb2 -d /var/lib/icingadirector -s /bin/false icingadirector
install -d -o icingadirector -g icingaweb2 -m 0750 /var/lib/icingadirector
MODULE_PATH=/usr/share/icingaweb2/modules/director
cp "${MODULE_PATH}/contrib/systemd/icinga-director.service" /etc/systemd/system/
systemctl daemon-reload
systemctl enable icinga-director.service
systemctl start icinga-director.service

give execute permission and run the script.

chmod +x director-permission.sh
bash director-permission.sh

Now you will see in the Activity Log in the Icinga Director menu option that there will be orange alerts. When you click there, you will see  in the center of the screen a message Deploy the pending changes just click the link to deploy them.

Now you are ready to take advantage of the benefits of using Director.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

x