Install nagios 4.0.8 on centos 6.5

Source: Internet
Author: User
Tags cairo rrdtool

Install nagios 4.0.8 on centos 6.5

Disable selinux

Setenforce 0

The permanent method is

Vi/etc/selinux/config

The status changes to disabled.

SELINUX = disabled

You need to restart the server.

Disable Firewall

/Etc/init. d/iptables stop

Delete firewall rules and restart Firewall

Mv/etc/sysconfig/iptables/opt

/Etc/init. d/iptables restart

Install the epel update source

Wgethttp: // dl.fedoraproject.org/pub/epel/6Server/x86_64/epel-release-6-8.noarch.rpm

Rpm ivhepel-release-6-8.noarch.rpm

Vi/etc/yum. repos. d/epel. repo

Replace all https with http

: % S/https/http/g

Yum-y installyum-fastestmirror

Rpm -- import/etc/pki/rpm-gpg/RPM *

Install components,Note:LAMPThe environment uses yumInstalled in the following command

Yum-y install httpdgettext mysql-server mysql-devel php-mysql php-pear php-mysql mysqlperl MySQL-server perl-DBI perl-DBD-mysql httpd gcc glibc-common gdgd-devel php gcc automake autoconf libtool make cairo-devel libxml2-develpango-devel pango libpng-devel freetype-devel libart_lgpl-devel php-gdmysql-connector-odbc libgd-devel libpng-devel libw.libw.jpeg-devel zlib-devel libxml2 libxml2-devel cairo * pango-devel * cairo-devel * perl-CPAN gruff ntp wget bc perl-Time-HiRes dejavu-lgc-sans-fonts mailxpatch

Clear Cache

Yum clean all

Create nagios users and groups

Useradd nagios

Usermod-s/sbin/nologinnagios

Groupadd nagcmd

Usermod-G nagcmd nagios

Usermod-G nagcmd apache

Install nagios

Tar zxvfnagios-4.0.8.tar.gz-C/usr/src/

Cd/usr/src/nagios-4.0.8/

Download patch files from the following page

Http://tracker.nagios.org/file_download.php? File_id = 205 & type = bug

Install patches. Otherwise, the message Log reports an error "wproc: Unknown job type: 10"

Patch-p1 <bogus_warnings.patch

. /Configure -- prefix =/usr/local/nagios -- with-nagios-user = nagios -- with-nagios-group = nagios -- with-command-group = nagcmd-with-gd- lib =/usr/lib64-with-gd-inc =/usr/include

Make all

Make install

Make install-init

Make install-commandmode

Make install-config

Make install-webconf

Cd/root/

Install the nagios plug-in package

Tar zxvfnagios-plugins-2.0.3.tar.gz-C/usr/src/

Cd/usr/src/nagios-plugins-2.0.3/

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

Make & make install

Cd/root/

Defines the password for accessing nagios

Htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin

Install the drawing plug-in

Tar zxvfrrdtool-1.4.7.tar.gz-C/usr/src/

Cd/usr/src/rrdtool-1.4.7/

./Configure -- prefix =/usr/local/rrdtool

Make & makeinstall

Cd/root

Edit the system environment variable configuration file

Vi/etc/profile

Add

PATH = $ PATH:/usr/local/rrdtool/bin

Reload the configuration file

Source/etc/profile

View rrdtool version information

Rrdtool-v

Install the drawing component

Tar zxvf pnp4nagios-0.6.25.tar.gz-C/usr/src/

Cd/usr/src/pnp4nagios-0.6.25/

. /Configure -- prefix =/usr/local/pnp4nagios -- with-rrdtool =/usr/local/rrdtool/bin/rrdtool -- with-nagios-user = nagios -- with-nagios-group = nagios -- with-perl_lib_path =/usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/

Make all

Make install

Make install-webconf

Make install-config

Make install-init

Make fullinstall

Copy the configuration file

Cd/usr/local/pnp4nagios/etc

Cp-pmisccommands. cfg-sample misccommands. cfg

Cfg-samplenagios.cfg. cp-p nagios.

Cfg-samplerra.cfg. cp-p rra.

Cd pages/

Cp-pweb_traffic.cfg-sample web_traffic.cfg

Cd ../check_commands/

Cp-p check_all_local_disks.cfg-samplecheck_all_local_disks.cfg

Cp-pcheck_nrpe.cfg-sample check_nrpe.cfg

Cp-pcheck_nwstat.cfg-sample check_nwstat.cfg

Compile the Nagios configuration file

Cd/usr/local/nagios/etc/

Cp nagios. cfgnagios. cfg. bak

Vi nagios. cfg

Process_performance_data = 1

Host_perfdata_command = process-host-perfdata

Service_perfdata_command = process-service-perfdata

Add the last line

Service_perfdata_file =/usr/local/pnp4nagios/var/service-perfdata

Response = DATATYPE: SERVICEPERFDATA \ tTIMET ::$ TIMET $ \ tHOSTNAME ::$ HOSTNAME $ \ tSERVICEDESC ::$ SERVICEDESC $ \ tSERVICEPERFDATA ::$ SERVICEPERFDATA $ \ tSERVICEC :heckcommand:: $ SERVICECHECKCOMMAND $ \ tHOSTSTATE: $ HOSTSTATE $ \ tHOSTSTATETYPE ::$ HOSTSTATETYPE $ \ tSERVICESTATE ::$ SERVICESTATE $ \ tSERVICESTATETYPE ::$ SERVICESTATETYPE $

Service_perfdata_file_mode =

Service_perfdata_file_processing_interval = 15

Service_perfdata_file_processing_command = process-service-perfdata-file

#

# Host performancedata starting with Nagios 3.0

#

Host_perfdata_file =/usr/local/pnp4nagios/var/host-perfdata

Host_perfdata_file_template = DATATYPE: HOSTPERFDATA \ tTIMET ::$ TIMET $ \ tHOSTNAME ::$ HOSTNAME $ \ tHOSTPERFDATA ::$ HOSTPERFDATA $ \ tHOSTCHECKCOMMAND ::$ HOSTCHECKCOMMAND $ \ tHOSTSTATE :: $ HOSTSTATE $ \ tHOSTSTATETYPE: $ HOSTSTATETYPE $

Host_perfdata_file_mode =

Host_perfdata_file_processing_interval = 15

Host_perfdata_file_processing_command = process-host-perfdata-file

Edit configuration file

Cd objects/

Cp commands. commancommands. cfg. bak

Add the last line

Vi commands. cfg

Define command {

Command_name process-service-perfdata-file

Command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl -- bulk =/usr/local/pnp4nagios/var/service-perfdata

}

Define command {

Command_name process-host-perfdata-file

Command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl -- bulk =/usr/local/pnp4nagios/var/host-perfdata

}

Edit Template File

Cp templates. templates. cfg. bak

Vi templates. cfg

Add the last line

Define host {

Name host-pnp

Action_url/pnp4nagios/index. php/graph? Host = $ HOSTNAME $ & srv = _ HOST _

Register 0

}

Define service {

Name srv-pnp

Action_url/pnp4nagios/index. php/graph? Host = $ HOSTNAME $ & srv = $ SERVICEDESC $

Register 0

}

Or Add the following sentence to the generic-service template:

Action_url/pnp4nagios/index. php/graph? Host = $ HOSTNAME $ & srv = $ SERVICEDESC $

Add the following sentence to the local-service template:

Action_url/pnp4nagios/index. php? Host = $ HOSTNAME $

Check Configuration

../Bin/nagios-v ../nagios. cfg

Start nagios

/Etc/init. d/nagios start

/Etc/init. d/httpd start

Edit webpage configuration file

Vi/etc/httpd/conf. d/nagios. conf

Add the last line

Alias/pnp4nagios "/usr/local/pnp4nagios/share"

<Directory "/usr/local/pnp4nagios/share">

AllowOverride None

Order allow, deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

AuthUserFile/usr/local/nagios/etc/htpasswd

Require valid-user

<IfModule mod_rewrite.c>

RewriteEngine On

Options FollowSymLinks

RewriteBase/pnp4nagios/

RewriteRule ^ (application | modules | system)-[F, L]

RewriteCond % {REQUEST_FILENAME }! -F

RewriteCond % {REQUEST_FILENAME }! -D

RewriteRule. * index. php/$0 [PT, L]

</IfModule>

</Directory>

Check http configuration

Apachectl-t

Restart service

/Etc/init. d/httpd restart

/Etc/init. d/nagiosrestart

Visit the naigos page and click the rrd drawing icon after Current Load.

The green font is displayed, indicating that the file is successfully renamed.

Rename the following files

Cd/usr/local/pnp4nagios/share

Mv install. phpinstall. php. bak

Refresh the page again.

If a red box is displayed, the font is not installed.

Yum install-y dejavu-lgc-sans-fonts

Refresh again.

If the prompt is displayed when an operation is performed on the webpage

Cocould not open command file/usr/local/nagios/var/rw/nagiosnand' for update

The solution is as follows:

Usermod-a-G nagiosapache

Chmod 666/usr/local/nagios/var/rw/nagiosNaNd

Chown nagios. nagcmd/usr/local/nagios/var/rw

Chmod u + rwx/usr/local/nagios/var/rw

Chmod g + rwx/usr/local/nagios/var/rw

Chmod g + s/usr/local/nagios/var/rw

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.