Construction of Nagios+rrdtool+pnp4nagios monitoring environment under Linux system

Source: Internet
Author: User
Tags rrdtool

Software versions in the environment >>>>>>>>>>>>>>>>>>
Nagios version: 3.5.1
RRDtool version: 1.3.8
Pnp4nagios version: 0.6.21

Part One: Deployment installation of Nagios services

(1) Dependencies required to install the Nagios service

[[Email Protected]_server ~]#Yum Install Yum Install GCC  Make-Y//Nagios source installation requires[[Email Protected]_server ~]#Yum InstallGLIBC glibc-common-y//Both packages are installed on a system that minimizes installation[[Email Protected]_server ~]#Yum Installhttpd php-y [[Email Protected]_server~]#Yum InstallGD Gd-devel-y//PHP required for the GD library, do not install will affect the map function on the home page

(2), create Nagios user, Nagcmd Group,
Adding Nagios and Apache users to the Nagcmd group

~]# usermod-a-~]# usermod-a-G nagcmd Apache

(3) Source installation Nagios

[[Email Protected]_server ~]#TarXF nagios-3.5.1.Tar. Gz[[email Protected]_server~]# cd nagios[[email protected]_server nagios]#./configure--with-command-group=nagcmd[[email protected]_server nagios]# MakeAll//compile all the source code[[Email Protected]_server nagios]# Make Install               //Install main program, CGIs, Web file, will produce bin, libexec, Sbin, share, var directory[[Email Protected]_server nagios]# Make Install-config//Install etc configuration Directory[[Email Protected]_server nagios]# Make Install-init//Installing the Nagios startup script[[Email Protected]_server nagios]# Make Install-webconf//Install the httpd profile for the Nagios Web site[[Email Protected]_server nagios]# Make Install-commandmode//the external command accesses the Nagios profile permissions, sets 0775 permissions for the./VAR/RW, and changes the owning group to Nagcmd

(4) Unzip the Nagios plug-in package, then enter its directory, execute the following command to compile the installation

[Email protected]_server nagios-plugins-2.0. 3] #./configure--with-nagios-user=nagiosc--with-nagios-group=nagcmd[[email protected]_server nagios- plugins-2.0. 3  Make  Make Install    // Compiling the installation

(5) Start the httpd and Nagios service and then set the password for the Nagios website home page

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

Depending on the prompt you will be asked to enter and determine the password, the above command nagiosadmin as the user name, as shown in:

Part II: Installation of the Rrdtool+pnp4nagios

Pnp4nagios is a small open source software package that is based on PHP and Perl, using RRDtool to chart the data captured by Nagios.

(1) Where for RRDtool, we can directly use the Yum method, where we also install Pnp4nagios the required dependencies

Yum Install Perl perl-time-hires rrdtool-perl -y

(2) Unzip the Pnp4nagios, enter the pnp4nagios-0.6.21 directory to execute the following command

[Email protected]_server pnp4nagios-0.6. +] #./--prefix=/usr/local/--with-rrdtool=/usr/bin/--with-nagios-user=-- With-nagios-group=nagios
[Email protected]_server pnp4nagios-0.6.  +  make all           // compile all source code [[Email protected]_server pnp4nagios-0.6.   make Fullinstall   // Install all

(3) Configure the Pnp4nagios software, you need to modify the directory under Pnp4nagios/etc, and its pages, check_commands directory file suffix

 [[Email protected]_server pnp4nagios-0.6 . ]# cd/usr/local/pnp4nagios/etc[[email protected]_server etc]#  MV  misccommands.cfg-sample misccommands.cfg[[ Email protected]_server etc]#  MV  nagios.cfg-sample nagios.cfg[[email protected]_server etc]#  MV  rra.cfg-< Span style= "color: #000000;" >sample rra.cfg[[email protected]_server etc]#  MV  pages/web_ Traffic.cfg-sample pages/web_traffic.cfg 
[Email protected]_server etc]# cd check_commands/mv check_all_local_disks.cfg-MV check_nrpe.cfg-mv check_nwstat.cfg-sample check_nwstat.cfg

(4) Start NPCD service

[[Email protected]_server check_commands]#/etc/init.d/npcd Restart      // start NPCD

(5) Restart the httpd service by HTTP://IP address/pnp4nagios Verify the success of Pnp4nagios, if the installation is successful, follow the prompts to delete the following files

RM -rf/usr/local/pnp4nagios/share/install. php

Part III: The combination of Nagios and Pnp4nagios

(1) Define commands, Process-host-perfdata and process-service-perfdata that need to be commented out
Edit the /usr/local/nagios/etc/objects/commands.cfg file to add the following:

define command{        command_name    process    -host-perfdatacommand_line/usr/bin/  Perl /usr/local/pnp4nagios/libexec/process_perfdata.pl-d hostperfdata        }define command{        command_ Name    process-service-perfdata        command_line    /usr/bin/perl /usr/local/ pnp4nagios/libexec/process_perfdata.pl        }

(2) define the template , edit the /usr/local/nagios/etc/objects/templates.cfg, add the following content:

Define host {        name       hosts-pnp        Register      0        action_url    /pnp4nagios/index.php/graph? host= $HOSTNAME $&srv=_host_           process_perf_data               1        }
Define Service { name srv-PNP Register 0 action_url/pnp4nagios/index.php/graph?host= $HOSTNAME $ &srv=$SERVICEDESC $ process_perf_data 1 }

(3) Modifying Nagios configuration file /usr/local/nagios/etc/nagios.cfg

Process_performance_data=1                          // default is 0host_perfdata_command=process-host-perfdata         // default preceded by comment #Service_perfdata_command=process-service-perfdata   // The default is preceded by a comment #

(4) Next is the template reference , only need to use the diagram to refer to the service on the Srv-pnp can also be referenced on the host that need the diagram HOSTS-PNP , you can see the following effects as a reference:

Construction of Nagios+rrdtool+pnp4nagios monitoring environment under Linux system

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.