Nagios Installation Configuration instructions (i)

Source: Internet
Author: User

NagiosInstallation Configuration Instructions
    • Modify the Yum source for the domestic Sohu site;

[Email protected] ~]# cd/etc/yum.repos.d/

[[email protected] yum.repos.d]# ls

Centos-base.repo Centos-debuginfo.repo Centos-media.repo Centos-vault.repo

[Email protected] yum.repos.d]# Mvcentos-base.repo centos-base.repo.backup

[Email protected] yum.repos.d]# Wgethttp://mirrors.sohu.com/help/centos-base-sohu.repo

--2014-06-08 22:34:38--Http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

Resolving mirrors.sohu.com...119.188.36.70

Connecting tomirrors.sohu.com|119.188.36.70|:80 ... Connected.

HTTP request sent, awaitingresponse ... OK

length:2299 (2.2K) [Application/octet-stream]

Saving to: ' Centos-base-sohu.repo '

100%[===================================================================================>]2,299--.-K/s in 0.1s

2014-06-08 22:34:43 (20.6 kb/s)-' Centos-base-sohu.repo ' saved [2299/2299]

[[email protected] yum.repos.d]# ls

Centos-base-sohu.repo centos-base.repo.backup Centos-debuginfo.repo Centos-media.repo CentOS-Vault.repo

[Email protected] yum.repos.d]# MV Centos-base-sohu.repocentos-base.repo

    • Solve Perl compilation problems;

[[email protected] ~]# echo ' exportlc_all=c ' >>/etc/profile

[Email protected] ~]# Tail-1/etc/profile

Export Lc_all=c

[Email protected] ~]# Source/etc/profile

[Email protected] ~]# echo $LC _all

C

    • Close the iptables firewall;

[[email protected] ~]#/etc/init.d/iptables stop

[Email protected] ~]#/etc/init.d/iptables status

Iptables:firewall is notrunning.

[[email protected] ~]# chkconfigiptables off

[Email protected] ~]# Chkconfig--list|grep iptables

Iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off

    • Turn off SELinux;

[Email protected] ~]# Cat/etc/selinux/config

# This file controls the Stateof SELinux on the system.

# selinux= can take one Ofthese three values:

# Enforcing-selinux Security Policy isenforced.

# Permissive-selinux Prints Warningsinstead of enforcing.

# disabled-no SELinux policy is loaded.

Selinux=enforcing

# selinuxtype= can take one ofthese the values:

# targeted-targeted Processes areprotected,

# Mls-multi level Security protection.

selinuxtype=targeted

[Email protected] ~]# sed-i ' s#selinux=enforcing#selinux=disabled#g '/etc/selinux/config

[Email protected] ~]# Cat/etc/selinux/config

# This file controls the Stateof SELinux on the system.

# selinux= can take one Ofthese three values:

# Enforcing-selinux security policy is enforced.

# Permissive-selinux Prints Warningsinstead of enforcing.

# disabled-no SELinux policy is loaded.

Selinux=disabled

# selinuxtype= can take one ofthese the values:

# targeted-targeted Processes areprotected,

# Mls-multi level Security protection.

selinuxtype=targeted

[Email protected] ~]# Setenforce 0

[Email protected] ~]# Getenforce

Disabled

V. Solve the problem of time synchronization;

[Email protected] ~]#/usr/sbin/ntpdate pool.net.org #更新当前时间

8 June 22:55:22 ntpdate[2165]: No serversuitable for synchronization found

[[email protected] ~]# echo ' #timesync by Jerry @ 20140131 ' >>/var/spool/cron/root

[Email protected] ~]# echo ' */10 * * */usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1 ' >>/var/spool/cron /root

[Email protected] ~]# crontab-l

#time sync by Jerry at 20140131

*/10 * * * */usr/sbin/ntpdatepool.ntp.org >/dev/null 2>&1

VI. Install the basic package required for Nagios;

[email protected] ~]# Yum installgcc glibc glibc-common gd gd-devel mysql* httpd php php-gd–y

VII. create users and groups;

[Email protected] ~]# Useradd Nagios

[Email protected] ~]# Groupaddnagcmd

[Email protected] ~]# usermod-a-gnagcmd Nagios

[Email protected] ~]# usermod-a-gnagcmd Apache

Eight, create software storage folder and download related software;

[[email protected] tools] #mkdir –p/home/jerry/tools

[[email protected] tools] #cd/home/jerry/tools

Nine, decompression and installation Nagios;

[Email protected] tools]# tar zxfnagios-3.5.0-1374045102000.tar.gz

[[email protected] tools]# ls

Nagios nagios-3.5.0-1374045102000.tar.gz nagios-plugins-1.5.tar.gz

[[Email protected] tools]# CD Nagios

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

[[email protected] nagios]# make all

[Email protected] nagios]# Makeinstall

[Email protected] nagios]# Makeinstall-init

[Email protected] nagios]# Makeinstall-config

[Email protected] nagios]# Makeinstall-commandmode

Ten, install Nagios Web configuration file and create login user;

[Email protected] nagios]# makeinstall-webconf

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

Nagios/apache conf fileinstalled * * *

[Email protected] nagios]# grep-v "#"/etc/httpd/conf.d/nagios.conf

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

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

Options execcgi

AllowOverride None

Order Allow,deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

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

Require Valid-user

</Directory>

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

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

Options None

AllowOverride None

Order Allow,deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

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

Require Valid-user

</Directory>

[Email protected] nagios]# htpasswd-c/usr/local/nagios/etc/htpasswd.users nagiosadmin

New Password:

Re-type New Password:

Adding Password for usernagiosadmin

Xi. Add the receiving email address of the monitoring alarm;

[Email protected] nagios]# vim/usr/local/nagios/etc/objects/contacts.cfg +35

email [email protected]

Change to

email [email protected]

1. Too long time to start sendmail Please check the hostname is consistent

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

Starting SendMail: ^c

[Email protected] nagios]# cat/etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4localhost4.localdomain4

:: 1 localhost localhost.localdomainlocalhost6 localhost6.localdomain6

[Email protected] nagios]# uname-n

Nagios

Modified to:

[Email protected] nagios]# cat/etc/hosts

127.0.0.1 Nagios localhost.localdomain localhost4 localhost4.localdomain4

:: 1 localhost localhost.localdomainlocalhost6 localhost6.localdomain6

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

Starting sendmail: [OK]

Starting sm-client: [OK]

[Email protected] nagios]# lsof-i:25

COMMAND PID USER FD TYPE DEVICE size/off NODENAME

Master 1771 Root 12u IPv4 11293 0t0 TCP nagios:smtp (LISTEN)

Master 1771 Root 13u IPv6 11295 0t0 TCP localhost:smtp (LISTEN)

[Email protected] nagios]# Chkconfigsendmail on

[Email protected] nagios]# Chkconfig--list|grep SendMail

SendMail 0:off 1:off 2:on 3:on 4:on 5:on 6:off

2. Launch Apache;

[Email protected] nagios]# Netstat-lnt|grep 80

TCP 0 0::: +:::* LISTEN

[Email protected] nagios]# Chkconfig--list|grep httpd

httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[Email protected] nagios]# chkconfighttpd on

[Email protected] nagios]# Chkconfig--list|grep httpd

httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Open the browser input Http://server-ip/nagios will have a user name Password prompt window, enter the user name password previously created to enter the Nagios system page.


This article from the "Youth _ Future" blog, please be sure to keep this source http://stone880117.blog.51cto.com/1664014/1423763

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.