How to deploy the Icinga server and the Icinga Server

Source: Internet
Author: User

How to deploy the Icinga server and the Icinga Server

Icinga is a variant of Nagios. It is configured in almost the same way and fully compatible with the Nagios plug-in. Therefore, the following deployment scheme is also used for Nagios.

It also introduced two Chinese versions, icinga-cn original and icinga-pnp4nagios-cn, the former and Nagios almost identical, but the interface is Chinese, while the latter is integrated with the php4 drawing function, displays system monitoring information in a graphical manner, similar to Cacti.

The Icinga server generally refers to its kernel. It provides only a framework and cannot monitor specific resources, such as CPU, memory, and processes. These monitoring functions are implemented through the Icinga plug-in.

There are two methods to monitor remote Linux Hosts:

1. check_by_ssh plug-in

For example, to view the disk space usage of a remote Linux host,

#/Usr/local/icinga/libexec/check_by_ssh-H 192.168.244.134-C 'df-H'

root@192.168.244.134's password: Filesystem            Size  Used Avail Use% Mounted on/dev/sda2             7.7G  5.8G  1.6G  79% /tmpfs                 850M     0  850M   0% /dev/shm/dev/sda1             194M   27M  158M  15% /boot/dev/sda4             9.9G  7.2G  2.3G  77% /u01

This plug-in can achieve secure transmission. Using SSH will be more secure than the NRPE plug-in. In this way, no software is required to be deployed on the remote monitored host, however, this causes the CPU load on the remote host and monitoring host to be too high. If many hosts are monitored, this will become a problem. Therefore, many O & M administrators choose the NRPE plug-in, which will reduce the CPU load.

2. NRPE plug-in

The principle of the NRPE plug-in is to allow Icinga to execute the Nagios plug-in on a remote host, so as to monitor local resources on the remote host, such as CPU, memory, system resources that are not exposed to external machines, such as SWAP.

The principle is as follows:

Therefore, this solution implements the Icinga kernel + Nagios plug-in + NRPE plug-in. In addition, IDOUtils is used in this solution. In this way, the configuration information and monitoring data of icinga can be saved to the database.

1. Install the dependency package

Install the following packages:

ApacheGCC compilerC/C++ development librariesGD development librarieslibdbi/libdbi-drivers, database like MySQL or PostgreSQL

InFedora/RHEL/CentOSIn the system, the details are as follows:

# Yum install httpd gcc glibc-common gd-devel

# Yum install libjpeg-devel libpng-devel

Install MySQL and Its Development Kit

# Yum install mysql-server libdbi-devel libdbi-drivers libdbi-dbd-mysql

 

Ii. Create an account

#/Usr/sbin/useradd-m icinga

# Passwd icinga

If you want to send commands to Icinga from the WEB interface, you also need to configure a group and add web users and icinga users to the group.

#/Usr/sbin/groupadd icinga-cmd

#/Usr/sbin/usermod-a-G icinga-cmd icinga

#/Usr/sbin/usermod-a-G icinga-cmd apache

 

3. Download Icinga and its plug-in packages

Icinga cultural project: http://sourceforge.net/projects/icinga-cn/files/, here, download icinga-cn-1.12.2.tar. xz icinga-cndirectory.

Icinga plugins: plugin.

For icinga nrpe.

 

4. Install the Icinga Kernel

That is, icinga-cn-1.12.2.tar. xz.

# Cd/usr/src/

# Tar xvf/root/icinga-cn-1.12.2.tar.xz

# Cd icinga-cn-1.12.2/

Compile

#./Configure -- with-command-group = icinga-cmd -- enable-idoutils

If there is no compilation problem, the output is as follows:

 Web Interface Options: ------------------------                 HTML URL:  http://localhost/icinga/                  CGI URL:  http://localhost/icinga/cgi-bin/                 Main URL:  http://localhost/icinga/cgi-bin/status.cgi?allunhandledproblems                 UI THEME: ui_theme=ui-smoothnessReview the options above for accuracy.  If they look okay,type 'make all' to compile the main program and CGIs.!!! Please take care about the upgrade documentation !!!

# Make all

# Make fullinstall

# Make install-config

 

V. Create MySQL Data and IDOUtils

# Mysql-u root-p

mysql> CREATE DATABASE icinga;Query OK, 1 row affected (0.00 sec)mysql>  GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';Query OK, 0 rows affected (0.00 sec)mysql> quit

# Cd/usr/src/icinga-cn-1.12.2/module/idoutils/db/mysql/

# Mysql-u root-p icinga <mysql. SQL

Modify the configuration file of IDOUtils

# Vim/usr/local/icinga/etc/ido2db. cfg

db_servertype=mysqldb_port=3306db_user=icingadb_pass=icinga

In fact, this is the default way.

 

Vi. Configure the classic WEB Interface

# Cd/usr/src/icinga-cn-1.12.2/

# Make cgis

# Make install-cgis

# Make install-html

# Make install-webconf

Set the logon user and password on the Icinga WEB Interface

# Htpasswd-c/usr/local/icinga/etc/htpasswd. users icingaadmin

To change the password, run the following command:

# Htpasswd/usr/local/icinga/etc/htpasswd. users icingaadmin

Restart the Apache service to make the preceding settings take effect.

# Service httpd restart

 

VII. Compile and install the Icinga plug-in

# Cd/usr/src/

# Tar xvf/root/nagios-cn-plugins-2.0.3.tar.xz

# Cd nagios-cn-plugins-2.0.3/

#./Configure -- prefix =/usr/local/icinga -- with-cgiurl =/icinga/cgi-bin -- with-nagios-user = icinga -- with-nagios-group = icinga

# Make

# Make install

 

8. Compile and install the NRPE plug-in

# Cd/usr/src/

# Tar xvf/root/icinga-nrpe-2.14.tar.gz

# Cd icinga-nrpe-2.14/

#./Configure

# Make

# Make install

# Make install-plugin

# Make install-init

# Make install-xinetd

# Make install-daemon-config

In fact, make install-plugin, make install-init, make install-xinetd, and make install-daemon-config can also be left empty. After you finish executing make, you are advised to execute all the commands.

 

9. Adjust SELinux policies

The simplest thing is to close it directly.

Temporarily disable: # setenforce 0

Permanently disable: # vim/etc/sysconfig/selinux

SELINUX=disabled

 

10. Enable the IDOUtils and Icinga services

Start the IDOUtils Service

# Service ido2db start

Verify the configuration file of Icinga

#/Usr/local/icinga/bin/icinga-v/usr/local/icinga/etc/icinga. cfg

The output is as follows:

Icinga 1.12.2Copyright (c) 2009-2015 Icinga Development Team (http://www.icinga.org) Copyright (c) 2009-2013 Nagios Core Development Team and Community ContributorsCopyright (c) 2009-2014 icinga-cn culture group Copyright (c) 1999-2009 Ethan GalstadLast Modified: 02-14-2015License: GPL read configuration data... alert: Unknown 'event _ profiling_enabled 'configuration settings. remove it from configuration! Read main config file okay... processing object config directory '/usr/local/icinga/etc/conf. d '... processing object config file '/usr/local/icinga/etc/objects/commands. cfg '... processing object config file '/usr/local/icinga/etc/objects/contacts. cfg '... processing object config file '/usr/local/icinga/etc/objects/notifications. cfg '... processing object config file '/usr/local/icinga/etc/objects/timeperiods. cfg '... processing object config file '/usr/local/icinga/etc/objects/templates. cfg '... processing object config file '/usr/local/icinga/etc/objects/localhost. cfg '... processing object config file '/usr/local/icinga/etc/objects/linux. cfg '... processing object config directory '/usr/local/icinga/etc/Les '... processing object config file '/usr/local/icinga/etc/modules/idoutils. cfg '... read object config files okay... running pre-flight check on configuration data... checking services... check 17 services. check the host... check 2 hosts. check the Host group... check the two host groups. check the Service Group... 2 service groups have been checked. check contacts... 1 contact has been checked. check the Contact Group... 1 Contact Group checked. check service upgrade... 0 service upgrades have been checked. check service dependencies... the 0 service dependency has been checked. check host upgrade... check that 0 hosts are upgraded. check the host dependency... the 0 host dependency has been checked. check the command... check 36 commands. check time period... 6 time periods have been checked. check the module... check Module 1. check the circuit between hosts... check the dependency of the loop host and service... check global event processing... check the forcible Processing Command... check miscellaneous settings... total alert s: 0 total error: 0 Things look okay-No serious problems were detected during the pre-flight check

Start Icinga Service

# Service icinga start

Set auto-start

# Chkconfig ido2db on

# Chkconfig icinga on

 

11. log on to the WEB page to test

Logon address: http: // 192.168.244.145/icinga/

The logon username is icingaadmin.

The logon password is the password set by using the htpasswd command in Step 6.

 

Summary:

1. In the above scheme, IDOUtils and NRPE are not necessary. If you only need to build a simple Icinga server, you only need the Icinga kernel and Nagios plug-in. For details, refer:

Http://docs.icinga.org/latest/en/quickstart-icinga.html

2. when an icinga database is created in MySQL, the official deployment documentation does not specify the character set. The default character set is latin1, which causes garbled Chinese output, default Character Set of the database to be explicitly executed.

 

Refer:

1. http://docs.icinga.org/latest/en/quickstart-idoutils.html

2. Control-building a Linux Nagios Monitoring Server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.