Nagios Installation and Configuration

Source: Internet
Author: User

Prepare to check the environment before installation

Iptables-f

Setenforce 0


#gcc环境 the lamp environment and some other Nagios dependency packages

Yum-y Install gcc* yum-y install httpd mysql mysql-server mysql-devel php php-server glibc glibc-common *gd*


#添加nagios运行所需要的用户和组

Groupadd Nagcmd

Useradd-g Nagcmd Nagios

Usermod-g Nagcmd Apache


#编译安装nagios

Mkdir/cdrom

Cp-a/cdrom/*.

TAR-XF nagios-3.3.1. tar.gz


CD Nagios

./configure--with-commadn-group=nagcmd--enable-event-broker


Make all && make install && make install-init make Install-commandmode make Install-config && make Install-webconf


2. Generate a password file

Htpasswd-c/usr/local/nagios/etc/htpasswd.user Nagiosadmin



Service httpd Restart


View effects in the browser enter a user name and password


Installing the plug-In manager nagios-plugins


Unzip the compilation


TAR-XF nagios-plugins-1.4.14.tar.gz


cd/root/nagios-plugins-1.4.14


./configure--with-nagios-user=nagios--wtih-nagios-group=nagios--with-mysql--enable-perl-modules


Make && make install


Configure and start Nagios


Chkconfig--add Nagios


Chkconfig Nagios on


/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg

#此命令用来检测语法


Service Nagios Start



Monitoring of Windows hosts

Install Nsclient + +

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/97/7C/wKioL1kuvLWgiiQmAAHnwrnGzfg551.png-wh_500x0-wm_ 3-wmp_4-s_343906951.png "title=" image 1.png "alt=" Wkiol1kuvlwgiiqmaahnwrngzfg551.png-wh_50 "/>

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/97/7B/wKiom1kuvM2xUXtxAAFafFzoA8k079.png-wh_500x0-wm_ 3-wmp_4-s_11602377.png "title=" image 2.png "alt=" Wkiom1kuvm2xuxtxaafaffzoa8k079.png-wh_50 "/>


Server-side settings Windows monitoring

Cd/usr/local/nagios


CD etc/


CD objects/

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/97/7C/wKioL1kuvRaQPLddAAA6D4TSrZs878.png-wh_500x0-wm_ 3-wmp_4-s_4116598372.png "title=" image 3.png "alt=" Wkiol1kuvraqplddaaa6d4tsrzs878.png-wh_50 "/>

#进入nagios主目录, enabling Windows-enabled support


Vim NAGIOS.CF


Vim/usr/local/nagios/etc/objects/contacts.cfg


#39 cfg_file=/usr/local/nagios/etc/objects/windows.cfg


Vim/usr/local/nagios/etc/objects/contacts.cfg


#35 email [email protected] Alarm mailbox According to the actual change to find a software best then use QQ mailbox and then associated QQ number then you can know the alarm


Detect and start the Nagios service


/usr/local/nagios/bin/nagios-v/usr/local/ngios/etc/nagios.cfg


Service Nagios Restart


Monitoring of Linux


Installing Gcc,openssl Openssl-devel

Yum-y Install OpenSSL Openssl-devel



Installing the plug-In manager nagios-plugins


Create a Nagios user, or you will get an error


Useradd Nagios


Cd/root

TAR-XF nagios-plugins-1.4.14.tar.gz


CD nagios-plugins-1.4.14


./configure--with-nagios-user=nagios--with-nagios-group=nagios


Make a && make install


Install Nrpe ensure Openssl,openss-devel is installed


TAR-XF nrpe-2.8.1.tar.gz


CD nrpe-2.8.1


./configure--enable-ssl--with-ssl-lib=/usr/lib


Make all


Make Install-plugin


Make Install-daemon


Make Install-daemon-config


Vim/usr/local/nagios/etc/nrpe.cfg


allowed_hosts=192.168.121.1 127.0.0.1


/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d



Service-Loaded

Nagios-plugins


./configure--enable-ssl--with-ssl-lib=/usr/lib


Make all


Make Install-plugin


cd/usr/local/nagios/etc/


CD objects/


Ls


Vim Linux.cfg


650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/97/7C/wKioL1kuv66yyK0gAABpH1pOC84026.png-wh_500x0-wm_ 3-wmp_4-s_2250905106.png "title=" image 4.png "alt=" Wkiol1kuv66yyk0gaabph1poc84026.png-wh_50 "/>


Vim Cmmands.cfg


650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/97/7B/wKiom1kuv8-zkdD7AABlpWdUUzQ292.png-wh_500x0-wm_ 3-wmp_4-s_1400176457.png "title=" image 5.png "alt=" Wkiom1kuv8-zkdd7aablpwduuzq292.png-wh_50 "/>

To enable a custom liunx.cfg file


Vim/usr/local/nagios/etc/nagios.cfg


31# cfg_file=/usr/local/nagios/etc/objects/linux.cfg



Detect and enable

/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg


Service Nagios Restart


Monitoring of services

Client


Yum-y install MySQL Mysql-server


Service mysqld Start


Mysqladmin-uroot password ' 123123 '


Mysql-uroot-p


Create DATABASE Nagios;


Grant Selcet on nagios.* to [e-mail protected] '% ' identifed by ' 123123 ';


Select User,password,host from Mysql.user;


Server check to see if you can connect to the database


/usr/local/nagios/libexec/check_mysql-h 192.168.121.1-u nagios-d nagios-p 123123


Vim mysql.cfg650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/97/7D/wKioL1kuwQuxjc2_ Aabkkoqbdec647.png-wh_500x0-wm_3-wmp_4-s_3447235062.png "title=" image 6.png "alt=" wkiol1kuwquxjc2_ Aabkkoqbdec647.png-wh_50 "/>



Startup configuration

Vim/usr/local/nagios/etc/nagios.cfg

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/97/7D/wKioL1kuwTyAAWYCAAB272MIMzY711.png-wh_500x0-wm_ 3-wmp_4-s_4234417854.png "title=" image 7.png "alt=" Wkiol1kuwtyaawycaab272mimzy711.png-wh_50 "/>


Vim Commadns.cfg

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/97/7C/wKiom1kuwV3zwblhAABrBhiWuEo149.png-wh_500x0-wm_ 3-wmp_4-s_3465004235.png "title=" image 8.png "alt=" Wkiom1kuwv3zwblhaabrbhiwueo149.png-wh_50 "/>

Detect Start Nagios

/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg


Service Nagios Restart


View in Browser



Nagios Installation and Configuration

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.