Nagios Server-side installation

Source: Internet
Author: User
Tags php mysql install perl

System environment:

[Email protected]_server ~]# cat/etc/redhat-release

CentOS Release 6.9 (Final)


1. Update the Yum source

Mv/etc/yum.repos.d/centos-base.repo/etc/yum.repos.d/centos-base.repo.backup

Wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-6.repo


2. Adjusting the character set

echo ' Export lc_all=c ' >>/etc/profile

Source/etc/profile


3. Close Iptables and SELinux


4. Update the system time

/usr/sbin/ntpdate pool.ntp.org

Then put in a timed task


5. Installing GCC and lamp

Yum install gcc glibc glibc-common gd gd-devel php-gd httpd php mysql* unzip-y


6. Add Users

[Email protected] tools]# useradd-m Nagios

[Email protected] tools]# Useradd Apache

[Email protected] tools]# Groupadd nagcmd

[Email protected] tools]# usermod-a-G nagcmd Nagios

[Email protected] tools]# usermod-a-G nagcmd Apache


7. Download and install Nagios

[Email protected] tools]# Unzip Oldboy_training_nagios_soft.zip

Archive:oldboy_training_nagios_soft.zip

inflating:check_memory.pl #内存监控插件

Inflating:check_mysql #mysql监控插件

Inflating:class-accessor-0.31.tar.gz

Extracting:config-tiny-2.12.tar.gz

Inflating:libart_lgpl-2.3.17.tar.gz

Inflating:math-calc-units-1.07.tar.gz

Inflating:nagios-plugin-0.34.tar.gz

Inflating:nrpe-2.12.tar.gz #客户端的nrpe守护进程

Inflating:params-validate-0.91.tar.gz

Inflating:pnp-0.4.14.tar.gz #nagios的web图形展示程序

Inflating:regexp-common-2010010201.tar.gz

Inflating:rrdtool-1.2.14.tar.gz #nagios的画图工具

Inflating:check_iostat #io监控插件

Inflating:nagios-3.5.1.tar.gz #nagios主程序

Inflating:nagios-plugins-1.4.16.tar.gz #nagios插件

[Email protected] tools]# Tar XF nagios-3.5.1.tar.gz

[[Email protected] tools]# CD Nagios

[Email protected] nagios]#/configure--with-command-group=nagcmd

[[email protected] nagios]# make all

[[email protected] nagios]# make install

。。。。。。。。。。。。。。。。。。。。。。。。

Make Install-init

-This installs the Init script IN/ETC/RC.D/INIT.D


Make Install-commandmode

-This installs and configures permissions on the

Directory for holding the external command file


Make Install-config

-This installs sample config files in/usr/local/nagios/etc


MAKE[1]: Leaving directory '/root/tools/nagios '


[email protected] nagios]# make Install-init

/usr/bin/install-c-M 755-d-o root-g root/etc/rc.d/init.d

/usr/bin/install-c-M 755-o root-g root Daemon-init/etc/rc.d/init.d/nagios


Init Script Installed * * *


[email protected] nagios]# make Install-commandmode

/usr/bin/install-c-M 775-o nagios-g nagcmd-d/USR/LOCAL/NAGIOS/VAR/RW

chmod G+S/USR/LOCAL/NAGIOS/VAR/RW


External Command Directory configured * * *


[email protected] nagios]# make Install-config

/usr/bin/install-c-M 775-o nagios-g nagios-d/usr/local/nagios/etc

/usr/bin/install-c-M 775-o nagios-g nagios-d/usr/local/nagios/etc/objects

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/nagios.cfg/usr/local/nagios/etc/nagios.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/cgi.cfg/usr/local/nagios/etc/cgi.cfg

/usr/bin/install-c-b-m 660-o nagios-g nagios sample-config/resource.cfg/usr/local/nagios/etc/resource.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/templates.cfg/usr/local/nagios/etc/ Objects/templates.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/commands.cfg/usr/local/nagios/etc/ Objects/commands.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/contacts.cfg/usr/local/nagios/etc/ Objects/contacts.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/timeperiods.cfg/usr/local/nagios/etc/ Objects/timeperiods.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/localhost.cfg/usr/local/nagios/etc/ Objects/localhost.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/windows.cfg/usr/local/nagios/etc/ Objects/windows.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/printer.cfg/usr/local/nagios/etc/ Objects/printer.cfg

/usr/bin/install-c-b-m 664-o nagios-g nagios sample-config/template-object/switch.cfg/usr/local/nagios/etc/objects /switch.cfg


Config Files Installed * * *


Remember, these is *sample* config files. You ' ll need to read

The documentation for more information in how to actually define

Services, hosts, etc to fit your particular needs.


[email protected] nagios]# make install-webconf

/usr/bin/install-c-M 644 sample-config/httpd.conf/etc/httpd/conf.d/nagios.conf


Nagios/apache conf File Installed * * *


8. Configure Web Authentication

[Email protected] nagios]# vi/etc/httpd/conf.d/nagios.conf

# SAMPLE CONFIG SNIPPETS for APACHE WEB SERVER

# Last Modified:11-26-2005

#

# This file contains examples of entries that need

# to is incorporated into your Apache Web server

# configuration file. Customize the paths, etc. as

# needed to fit your system.


Scriptalias/nagios/cgi-bin "/usr/local/nagios/sbin"


<directory "/usr/local/nagios/sbin" >

# Sslrequiressl

Options execcgi

AllowOverride None

Order Allow,deny

Allow from all

# Order Deny,allow

# Deny from all

# Allow from 127.0.0.1

AuthName "Nagios Access"

AuthType Basic

Authuserfile/usr/local/nagios/etc/htpasswd.users

Require Valid-user

</Directory>


Alias/nagios "/usr/local/nagios/share"

[Email protected] nagios]# htpasswd-cb/usr/local/nagios/etc/htpasswd.users Oldboy 123456 #创建登录nagios的web用户名和密码

Adding Password for user Oldboy


9. Installing the Nagios Plugin

[Email protected] tools]# yum-y install Perl-devel

[Email protected] tools]# Tar XF nagios-plugins-1.4.16.tar.gz

[Email protected] tools]# CD nagios-plugins-1.4.16

[Email protected] nagios-plugins-1.4.16]#/configure--with-nagios-user=nagios--with-nagios-group=nagios-- Enable-perl-modules

[[email protected] nagios-plugins-1.4.16]# make && make install

[Email protected] nagios-plugins-1.4.16]# ll/usr/local/nagios/libexec/|wc-l

#此处为60-Around 61

[Email protected] nagios-plugins-1.4.16]# CD. /


10. Installing Nrpe

[Email protected] tools]# Tar XF nrpe-2.12.tar.gz

[Email protected] tools]# CD nrpe-2.12

[Email protected] nrpe-2.12]#./configure

[[email protected] nrpe-2.12]# make all

[email protected] nrpe-2.12]# make Install-plugin

[email protected] nrpe-2.12]# make Install-daemon

[email protected] nrpe-2.12]# make Install-daemon-config


11. Start the service and check

[[email protected] tools]#/etc/init.d/nagios start

Starting Nagios:done.

[[email protected] tools]#/etc/init.d/httpd start

Starting httpd: [OK]

[Email protected] tools]# Netstat-tunlp|grep 80

TCP 0 0::: +:::* LISTEN 7853/httpd

[Email protected] tools]# Ps-ef|grep Nagios

Nagios 7841 1 0 16:31? 00:00:00/usr/local/nagios/bin/nagios-d/usr/local/nagios/etc/nagios.cfg

Root 7871 53845 0 16:32 pts/0 00:00:00 grep nagios


Final results diagram:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/9C/C2/wKioL1l1s-nD7WJOAAIoNnLbrLc379.png-wh_500x0-wm_ 3-wmp_4-s_941230149.png "title=" Nagios.png "alt=" Wkiol1l1s-nd7wjoaaionnlbrlc379.png-wh_50 "/>

Nagios Server-side installation

Related Article

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.