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

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

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.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Mel
Melhttps://unixcop.com
Unix/Linux Guru and FOSS supporter

2 COMMENTS

  1. Followed this through and got this error when trying to start the icinga director:

    — Unit icinga-director.service has begun starting up.
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: Started by systemd, notifying watchdog every 5s via /run/systemd/notify
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: PHP Fatal error: Uncaught Error: Call to undefined function posix_getpid() in /usr/share/icingaweb2/modules/incubator/vendor/gipfl/systemd/src/NotifySystemD.php:193
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: Stack trace:
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #0 /usr/share/icingaweb2/modules/director/library/Director/Daemon/BackgroundDaemon.php(74): gipfl\SystemD\NotifySystemD->setReady()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #1 /usr/share/icingaweb2/modules/director/library/Director/Daemon/BackgroundDaemon.php(52): Icinga\Module\Director\Daemon\BackgroundDaemon->initialize()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #2 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/Tick/FutureTickQueue.php(46): Icinga\Module\Director\Daemon\BackgroundDaemon->Icinga\Module\Director\Daemon\{closure}()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #3 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/StreamSelectLoop.php(182): React\EventLoop\Tick\FutureTickQueue->tick()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #4 /usr/share/icingaweb2/modules/director/library/Director/Daemon/BackgroundDaemon.php(55): React\EventLoop\StreamSelectLoop->run()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #5 /usr/share/icingaweb2/modules/director/application/clicommands/DaemonCommand.php(24): Icinga\Module\Director\Daemon\BackgroundDaemo in /usr/share/icingaweb2/modules/incubator/vendor/gipfl/systemd$
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: Fatal error: Uncaught Error: Call to undefined function posix_getpid() in /usr/share/icingaweb2/modules/incubator/vendor/gipfl/systemd/src/NotifySystemD.php:193
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: Stack trace:
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #0 /usr/share/icingaweb2/modules/director/library/Director/Daemon/BackgroundDaemon.php(74): gipfl\SystemD\NotifySystemD->setReady()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #1 /usr/share/icingaweb2/modules/director/library/Director/Daemon/BackgroundDaemon.php(52): Icinga\Module\Director\Daemon\BackgroundDaemon->initialize()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #2 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/Tick/FutureTickQueue.php(46): Icinga\Module\Director\Daemon\BackgroundDaemon->Icinga\Module\Director\Daemon\{closure}()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #3 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/StreamSelectLoop.php(182): React\EventLoop\Tick\FutureTickQueue->tick()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #4 /usr/share/icingaweb2/modules/director/library/Director/Daemon/BackgroundDaemon.php(55): React\EventLoop\StreamSelectLoop->run()
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private icingadirector[123659]: #5 /usr/share/icingaweb2/modules/director/application/clicommands/DaemonCommand.php(24): Icinga\Module\Director\Daemon\BackgroundDaemo in /usr/share/icingaweb2/modules/incubator/vendor/gipfl/systemd/
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private systemd[1]: icinga-director.service: main process exited, code=exited, status=255/n/a
    Dec 06 11:12:32 dhcp-guest-145.roadtech.private systemd[1]: Failed to start Icinga Director – Monitoring Configuration.

    This was fixed by:

    yum install rh-php73-php-process

    Now all works fine

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook