Author Photo

Being a Linux Enthusiast and a Fan of Open Source Software, I created Ahmer’s SysAdmin Recipes blog to share my experiences with other System Administrators. The curiosity doesn’t let me stop; therefore, I am constantly trying to learn new software tools and techniques. Whereas I also have the passion and the patience to teach the others.

I am always ready to accept new challenges and wish to explore the areas, that I haven’t worked on. Please give me your feedback and help me improve this blog.

Monday, 12 September 2016

Install Lilac Configurator on Nagios Core over CentOS 7

lilac-reloaded-install-on-nagios-core-over-centos-6Nagios is an Industry Standard Server Monitoring Solution. It is very simple, lightweight and easy to configure. Its configurations are defined in plain text files by an Administrator (according to his Infrastructure) for each Host, Service, Command, Contact, etc. These configurations are not a big deal unless we are monitoring a large Infrastructure, where we have to frequently update definitions of devices, add new hosts, replace a faulty switch, etc. The task of maintaining configurations can be a nightmare, if we are not properly planned to organize our Nagios configurations.

Fortunately, there are some web-based configurators such as Fruity, Lilac Reloaded, NConf, etc. are available, that can ease the task of Nagios configuration management.

In this post, we will install the Lilac Reloaded Configurator on our Nagios Core Server over CentOS 7. Lilac Reloaded uses MySQL database as its backend, and it is written in PHP.

Before moving forward, it is required to have basic concepts of Nagios Core 4. Therefore, it is highly recommended that you should have Learning Nagios - Third Edition. It will be really helpful for you during your Nagios journey.

 

System Specification:

A working instance of Nagios monitoring Server on CentOS 7.

Hostname: nagios03.example.com
IP Address: 192.168.229.134/24
Nagios Version: Nagios Core 4.4

Read Also: Install & Configure Nagios Core 4.4 on CentOS 7
  Install & Configure Nagios Core 4.2 on CentOS 6

 

Install Lilac Reloaded Configurator on Nagios Core Server over CentOS 7:

Login to Nagios Monitoring Server using Putty and install MySQL Database Server.

[root@nagios03 ~]# yum install –y mariadb-server

Start and enable mariadb service.

[root@nagios03 ~]# systemctl start mariadb.service [root@nagios03 ~]# systemctl enable mariadb.service

Configure MySQL Server.

[root@nagios03 ~]# /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! [root@nagios03 ~]#

Create database and user for Lilac Reloaded.

[root@nagios03 ~]# mysql –u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database lilac; Query OK, 1 row affected (0.00 sec) mysql> create user 'lilac'@'localhost' identified by 'lilac'; Query OK, 0 rows affected (0.00 sec) mysql> grant all on lilac.* to 'lilac'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye [root@nagios03 ~]#

Verify PHP version.

[root@nagios03 ~]# php -v PHP 5.3.3 (cli) (built: Aug 11 2016 20:33:53) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies [root@nagios03 ~]#

Lilac Reloaded required PHP 5.5, therefore, to update PHP, I add the Webtatic yum repository to acquire PHP 5.5 packages.

[root@nagios03 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm Retrieving https://mirror.webtatic.com/yum/el6/latest.rpm warning: /var/tmp/rpm-tmp.NZFWFl: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY Preparing... ########################################### [100%] 1:webtatic-release ########################################### [100%] [root@nagios03 ~]#

Upgrade to PHP 5.5.

[root@nagios03 ~]# yum search php55 [root@nagios03 ~]# yum remove php php-common [root@nagios03 ~]# yum install php55w php55w-pear php55w-pdo php55w-mysql [root@nagios03 ~]# service httpd restart

Check PHP version Again.

[root@nagios03 ~]# php -v PHP 5.5.38 (cli) (built: Jul 21 2016 12:51:12) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies [root@nagios03 ~]#

Lilac required nmap for auto discovery of Network devices, therefore install it.

[root@nagios03 html]# yum install nmap

Download Lilac Reloaded from https://sourceforge.net/projects/lilac--reloaded/

[root@nagios03 ~]# cd /soft [root@nagios03 soft]# wget https://sourceforge.net/projects/lilac--reloaded/files/latest/download [root@nagios03 soft]# tar xvf download

Move the lilac-reloaded directory to /var/www/html and change ownership of directory.

[root@nagios03 soft]# mv lilac-reloaded/ /var/www/html/ [root@nagios03 soft]# chown -R apache.apache /var/www/html/lilac-reloaded/

Like Nagios, Lilac Reloaded also don’t have any User Authentication Method of its own, so enable Basic HTTP Authentication, and use the same htpassword file, that we used with our Nagios Server.

[root@nagios03 etc]# cat >> /etc/httpd/conf.d/lilac.conf << EOF > <directory "/var/www/html/lilac-reloaded"> > AuthType Basic > AuthName "Restricted Content" > AuthUserFile /usr/local/nagios/etc/htpasswd.users > Require valid-user > </directory> > EOF [root@nagios03 etc]# systemctl restart httpd.service

Browse to http://192.168.229.134/lilac-reloaded/

Lilac Configurator Dependency Check

If this page show any dependency error, pls resolve it and click on Continue to Configuration….

Lilac Configurator Database Settings

Define database and access credentials and click on Continue.

Lilac Configurator - Import Nagios Settings

Click on Import Nagios Settings to import the configurations in lilac database.

Lilac Configurator - Import Job

Create an import job and click on Begin Import.

Lilac Configurator - Import Job Status

Nagios configurations have been imported.

Lilac Reloaded Configurator for Nagios Core on CentOS 7 is ready for use now.

Install Lilac Configurator on Nagios Core over CentOS 7


YOU MIGHT ALSO LIKE:

3 comments:

  1. Great guide! Thank you so much!

    ReplyDelete
  2. hi Sir after adding host by lilac-reloaded but it is not reflect in nagios. please help & suggest

    ReplyDelete
    Replies
    1. Thanks for reading this article.
      You may restart nagios service and check again.

      Delete