Nagios Configuration Overview

Source: Internet
Author: User
Tags rrdtool

The integration of pnp4nagios, ndoutils, and nconf provides a complete configuration solution for nagios.
The latest version of nagios3.3.1 in Centos5.5 is too ugly after it is installed. Therefore, I also use version 3.2.3 to install it.
First, prepare the compiling environment. Here we will install all the development libraries first.
Yum groupinstall "Development Libraries" "Development Tools" "Legacy Software Development" "X Software Development"-y
######################################## #################################
Naigos installation Configuration:
Install required software packages
Yum install mysql perl mysql-server perl-DBI perl-DBD-MySQL httpd gcc glibc-common gd-devel ruby ruby-devel2 ruby-devel mysql-devel
Yum install php53-* yum is installed with php version 5.1 by default, but the pnp4nagios-0.6.6 requires php version 5.2 or later, we will install 5.3 here
Wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
Wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
Useradd-m nagios
Groupadd nagcmd
Usermod-a-G nagcmd nagios
Usermod-a-G apache nagios
Tar zxf nagios-3.2.3.tar.gz
Cd nagios-3.2.3
./Configure -- with-command-group = nagcmd
Make all
Make install
Make install-init
Make install-commandmode
Make install-config
Make install-webconf
Htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin
Enter the password and remember it, because it is also the password to be entered when the webpage accesses nagios.
Chkconfig -- add nagios
Chkconfig nagios on
Chkconfig httpd on
Chkconfig mysqld on
Tar nagios-plugins-1.4.15.tar.gz
Cd nagios-plugins-1.4.15
./Configure -- with-nagios-user = nagios -- with-nagios-group = nagios
Make
Make install

Service nagios start
Service httpd start
Service mysqld start
Use http: // localhost/nagios/to access
######################################## ##################################
Install and configure pnp4nagios
Next we will configure pnp4nagios to plot the data captured by nagios into an image.
Rrdtool depends heavily. Here I choose to download the rrdtool rpm package.
Rrdtool-perl-1.4.4-1.el5.wrl.i386.rpm rrdtool-devel-1.4.4-1.el5.wrl.i386.rpm rrdtool-1.4.4-1.el5.wrl.i386.rpm
Rpm-ivh rrdtool -*
Tar-xvf pnp4nagios-0.6.6.tar.gz
Cd pnp4nagios-0.6.6
./Configure -- with-nagios-user = nagios -- with-nagios-group = nagcmd
Make all
Make install
Make install-webconf
Make install-config
Make isntall-init
Make fullinstall
Pnp4nagios provides three configuration methods.
Vi/usr/local/nagios/etc/nagios. cfg
Process_performance_data = 1

#
# Service performance data
#
Service_perfdata_file =/usr/local/pnp4nagios/var/service-perfdata
Response = DATATYPE: SERVICEPERFDATA \ tTIMET ::$ TIMET $ \ tHOSTNAME ::$ HOSTNAME $ \ tSERVICEDESC ::$ SERVICEDESC $ \ tSERVICEPERFDATA ::$ SERVICEPERFDATA $ \ tSERVICECHECKCOMMAND :: $ 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 performance data 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
Vi/usr/local/nagios/etc/objects/commands. cfg Modify the last two actions
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
}
Cd/usr/local/pnp4nagios/share
Mv install. php install. php. bak
Access test http: // localhost/pnp4nagios
Show the small Sun icon for nagios
Run the following command in the source code package of pnp4nagios.
Cp contrib/ssi/*/usr/local/nagios/share/ssi/
Then add action_url to the service or host definition.
Define service {
Use local-service; Name of service template to use
Host_name localhost
Service_description PING
Check_command check_ping! 100.0, 20%! 500.0, 60%
Action_url/pnp4nagios/index. php/graph? Host = $ HOSTNAME $ & srv = $ SERVICEDESC $ 'class = 'tids' rel = '/pnp4nagios/index. php/popup? Host = $ HOSTNAME $ & srv = $ SERVICEDESC $
}
Define host {
Use linux-server
Host_name localhost
Alias localhost
Address 127.0.0.1
Action_url/pnp4nagios/index. php/graph? Host = $ HOSTNAME $ & srv = _ HOST _ 'class = 'tids' rel = '/pnp4nagios/index. php/popup? Host = $ HOSTNAME $ & srv = _ HOST _
}
The effect is as follows:

######################################## ###################################
Install nconf to implement the graphical configuration of nagios
Tar-xvf nconf-1.2.6-0.tgz-C/var/www/html/
Chown-R apache: apache/var/www/html/nconf
Create a database for nconf
Mysql-u root-p
Create database nconf;
Grant all privileges on database name. * to 'username '@ 'localhost' identified by 'Password' with grant option;
Then access: http: // localhost/nconf through a browser

Follow the prompts to INSTALL and delete INSTALL/INSTALL. php UPDATE/UPDATE. php and refresh the page!
Here we use the database we just created


Use the default configuration here.

The following figure shows the page after installation.

######################################## ######################################
Install and configure ndoutils to import nagios data to the mysql database
Mysql-u root-p
Mysql> create database nagios;
Mysql> grant all on nagios. * TO nagios @ localhost identified by 'nagios 'authorize a nagios user with the password nagios
Mysql> flush privileges;
Wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz
Wget http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.4b9_light.patch
Tar-xvf ndoutils-1.4b9.tar.gz
Cd ndoutils
Patch-p1-N <../ndoutils1.4b9 _ light. patch
./Configure -- prefix =/usr/local/nagios/-- enable-mysql -- disable-pgsql \
-- With-ndo2db-user = nagios -- with-ndo2db-group = nagios
Make
Cd db
./Installdb./installdb-u root-p Database Password-d nagios
 
Mysql-u root-p
Mysql> USE nagios;
Mysql> show tables; the verification table has been generated.
Cd ndoutils-1.4b9
Cp./src/ndomod-3x.o/usr/local/nagios/bin/ndomod. o
Cp./src/ndo2db-3x/usr/local/nagios/bin/ndo2db
Cp./config/ndo2db. cfg-sample/usr/local/nagios/etc/ndo2db. cfg
Cp./config/ndomod. cfg-sample/usr/local/nagios/etc/ndomod. cfg
Chmod 774/usr/local/nagios/bin/ndo *
Chown nagios: nagios/usr/local/nagios/bin/ndo *
Chown nagios: nagios/usr/local/nagios/etc/ndo *
Vi ndo2db. cfg
Db_name = nagios
Db_user = nagios
Db_pass = nagios
Vi/usr/local/nagios/etc/nagios. cfg
Add the following two lines
Broker_module =/usr/local/nagios/bin/ndomod. o config_file =/usr/local/nagios/etc/ndomod. cfg
Modify
Event_broker_options =-1 // set it to 1. The test is also possible.
Cp./daemon-init/etc/init. d/ndo2db
Chmod + x/etc/init. d/ndo2db
Chkconfig -- add ndo2db
Service nagios restart
Service ndo2db start
Tail-f/usr/log/nagios/var/nagios. log

Author "full growth record"

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.