I really haven't got the time to do that. Finally when I got the time I realized that online guides for that are missing too. Being a CentOS supporter, I decided that during that process i could write a tutorial for CentOS 7.
This is the part 1 of the tutorial where I'll be going through the steps for preparing the server and setting up the Icinga2 service. In part two I'll be going through the steps for installing and setting up the Icingaweb2 web service which basically is one of the several available Incinga2 front-end applications.
First things first let's prepare our server.
Make sure you are logged in as root. If you are using another account with administrative privileges than make sure you append sudo before each of these commands
Step 1: Prepare your system for installation
Enable the EPEL repo and also add the Icinga repo:
# yum install epel-release
# rpm --import http://packages.icinga.org/icinga.key
# curl -o /etc/yum.repos.d/ICINGA-release.repo http://packages.icinga.org/epel/ICINGA-release.repo
Now update the yum cache:
# yum makecache
I prefer to install some other tools on my CentOS 7 minimal installation so that I can ease some of the management tasks later in life:
# yum -y install vim htop wget net-tools
Because this is a tutorial I will disable the Firewall and the SELinux on my system. If you are in production environment than you have to make sure that you will set up your server according to your organizational standards.
# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Using your favorite editor edit the SELinux config file:
# vim /etc/selinux/config
Locate this line:
SELINUX=enforcing
Change it to:
SELINUX=disabled
Reboot your system.
Step 2: Install the LAMP stack
Install Apache
# yum -y install httpd
After that start and enable the service so that it starts again when you reboot your server:
# systemctl start httpd.service && systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Verify that this is successful by opening a browser using your computer IP address (mine is 192.168.10.25):
http://192.168.10.25
The result should be the Apache2 default start page displaying Testing 123 message:
Install MySQL (MariaDB)
# yum -y install mariadb-server mariadb
Start and enable the daemons:
# systemctl start mariadb.service && systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
Now start and complete the MySQL configuration wizzard:
# mysql_secure_installation
Use whatever options you like, however remember and store the mysql root password.
Finally install PHP. This is the most important step as we have to be careful to also install the appropriate modules and update the PHP configuration files. I will return on this and give you a hint later on part 2 when we will be installing and configuring the Icingaweb2 web interface.
# yum -y install php php-mysql
Now we get to install the PHP LDAP module. This is important as the Icingaweb2 has the option to integrate with an LDAP server (read Active Directory server). It will also display an error message on installation if this is not installed:
# yum -y install php-ldap.x86_64
After this restart the Apache service:
# systemctl restart httpd
Now to check that everythig is OK, create the PHP info file and put it into the Apache2 web directory:
# vim /var/www/html/info.php
... and put the folowing text inside:
<?php phpinfo(); ?>
Open up a browser from your server IP address where you should see your PHP Info page.
http://192.168.10.25/info.php
Step 3: If everything is good so far we may proceed with installing the Icinga2 server.
# yum -y install icinga2
# systemctl enable icinga2 && systemctl start icinga2
As the per the official documentation:
The default installation will enable three features required for a basic Icinga 2 installation: checker, notification, and mainlog. Verify that these features are enabled:
# icinga2 feature list
Disabled features: api command compatlog debuglog gelf graphite icingastatus livestatus opentsdb perfdata statusdata syslog
Enabled features: checker mainlog notification
For the CentOS 7 system the important directories for Icinga2 are as follows:
Icinga2 config files:
/etc/icinga2
Icinga startup script that becomes available once you enable the service with the systemctl command:
/etc/systemd/system/multi-user.target.wants/icinga2.service
The Icinga2 binary:
/usr/sbin/icinga2
The Icinga2 logs:
/var/log/icinga2
Note: I am trying to keep the things here as simple as possible, but in the same time understandable for the users which is why I am telling you the above things. For more information on this you should consult with the official Icinga2 documentation. Things change over time anyway.
Step 4: Setup check plugins for Icinga2
These plugins are from the EPEL repository. You want to instal the nagios-plugins-all package.
# yum -y install nagios-plugins-all
Restart Icinga2 service afterwards
# systemctl restart icinga2
Now you have to verify that the Icinga2 constants config file has the correct location of the plugins. The Icinga2 constants config file is located in the /etc/icinga2/constants.conf and the plugins are located in /usr/lib64/nagios/plugins/. Edit the constants.conf file and make sure the paths are correct:
# vim /etc/icinga2/constants.conf
Make sure that
const PluginDir = "/usr/lib64/nagios/plugins"
... is updated with the location of the nagios plugins dir. That location will vary if you have x32 or x64 bit system. I am using a x64 bit kernel so the above location is correct. I may assume that if you have x32 bit CentOS system (which is highly unlikely) your location will be: /usr/lib/nagios/plugins .
Remember to restart the Icinga2 service if you have updated your plugins directory.
This is all for the Part 1. In Part 2 I will be going through the steps of installing the Icingaweb2 web interface which will actually give us the way to log into our system and monitor our infrastructure.
Articles used to put all of the above together:
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc
Hi Tom, I need some help, i get an error message in my installation, i am new to linux and icinga...hence unable to comprehend the error
ReplyDeleteUser Group Backend configuration has been successfully written to: /etc/icingaweb2/groups.ini
Unable to create user group "Administrators". An error occured:
ERROR: Zend_Db_Adapter_Exception in /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php:139 with message: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
Nice one Thanks bro...
ReplyDeleteThank you for sharing valuable information. Nice post. I enjoyed reading this post. -
ReplyDeleteโกเด้นสล็อต
Amazing! I'll try this with cloud backup solutions for small business
ReplyDelete