Second, Installation:
1 , MySQL install (if not installed)
# apt-get Install mysql-servermysql-client
2.DBI
installation (if not installed)
# cd/usr/local
# wget
http://www.cpan.org/modules/by-module/DBI/DBI-1.625.tar.gz
#tar ZXVF dbi-1.625.tar.gz
# CD DBI-1.625
# Perl makefile.pl
#make
# Make Test
# make install
3.DBD
installation (if not installed)
# cd/usr/local
# wgethttp://www.cpan.org/modules/by-module/dbd/dbd-mysql-4.023.tar.gz
#tar-ZXVF dbd-mysql-4.023.tar.gz
# CD dbd-mysql-4.023
# perlmakefile.pl
Suppose this is an error. mysql_configis not found , install
libmysqlclient-devfirst
. Enter the following line command:
# apt-get Installlibmysqlclient-dev
Then
run
#perl makefile.pl
# make
# Make install# perl makefile.pl
4
,
ndoutils
installation
# cd/usr/local
# wgethttp://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.4b7/ndoutils-1.4b7.tar.gz
# TARZXVF ndoutils-1.4b7.tar.gz
# CD Ndoutils -1.4b7
# ./configure--prefix=/usr/local/nagios--enable-mysql--disable-pgsqlldflags=-l/opt/mysql/lib-- With-mysql-inc=/opt/mysql/include/mysql--with-mysql-lib=/opt/mysql/lib/mysql
# Make
Copying files
Cp./src/ndomod-3x.o/usr/local/nagios/bin
Cp./src/ndo2db-3x/usr/local/nagios/bin
Cp./src/log2ndo/usr/local/nagios/bin
Cp./src/file2sock/usr/local/nagios/bin
Chown nagios:nagios/usr/local/nagios/bin/*
Copy configuration file
cp./config/ndo*/usr/local/nagios/etc/
Chown nagios:nagios/usr/local/nagios/etc/*
5 , for ndoutils Create a database
#mysql-U root-p
Enter Password: Enter login password here: root
Mysql>create Database Nagios;
Mysql> Grantselect,insert,update,delete on nagios.* to [email protected] by ' 123456 ';
Mysql> flush Privileges;
Mysql>\q
generate ndoutils required Database
#
CD db
#./installdb-u root-p Root-h localhost-d nagios
prompt for done . Log in to MySQL to see a table. :
#mysql-U root-p
enterpassword
root
mysql>use Nagios
readingtable information for completion of table and column names
Youcan turn off this feature to get a quicker startup With-a
databasechanged
mysql>show tables;
(
0.00 sec) (correct installation)
6, edit the configuration file
Select, INSERT, update. Delete the number of nagios Database user rights .
# vi/usr/local/nagios/etc/ndo2db.cfg
// the user and user group of the database that was prompted when the installation was complete. # stands for gaze.
Ndo2db_user=nagios
Ndo2db_group=nagios
#socket_type =unix
socket_type=tcp
db_user=root // in front of #./installdb-u root-p root-h localhost-d nagios specified in the
Db_pass=root
# vi/usr/local/nagios/etc/nagios.cfg
# Copy the following paste to #broker_module= ... Following.
# Note that broker_module= and config_file are on one line
broker_module=/usr/local/nagios/bin/ndomod-3x.oconfig_file=/usr/local/nagios/etc/ndomod.cfg
in addition. Make sure that the following lines appear in the /usr/local/nagios/etc/nagios.cfg for example. Otherwise, please join yourself
event_broker_options=-1// open eventbroker for Nagios
# vi/usr/local/nagios/etc/ndomod.cfg
#output_type =file
Output_type=tcpsocket
#output_type =unixsocket
#output =/usr/local/nagios/var/ndo.dat
output=127.0.0.1
#output =/usr/local/nagios/var/ndo.sock
7
. Start
ndo2db
Start ndo2db
#/usr/local/nagios/bin/ndo2db-3x-c/usr/local/nagios/etc/ndo2db.cfg
Suppose you are prompted couldnot bind socket:address already in use to delete the
ndo.sock :
Rm/usr/local/nagios/var/ndo.sock
set boot up ()
vim/etc/rc.local
Add the following before exit0 :
/usr/local/nagios/bin/ndo2db-3x-c/usr/local/nagios/etc/ndo2db.cfg
To restart the ndo2db method:
Psaux |grep ndo2db Find the process
nagios17539 0.0 0.0 10308 592?
Ss 15:52 0:00/usr/local/nagios/bin/ndo2db-3x-c/usr/local/nagios/etc/ndo2db.cfg
Nagios 17585 0.6 0.2 19528 1560? S 15:52 0:17/usr/local/nagios/bin/ndo2db-3x-c/usr/local/nagios/etc/ndo2db.cfg
Nagios 17586 0.1 0.2 19528 1560? S 15:52 0:05/usr/local/nagios/bin/ndo2db-3x-c/usr/local/nagios/etc/ndo2db.cfg
Root 18436 0.0 0.1 4588 pts/3s+ 16:39 0:00 grep--color=auto ndo2db
Kill PID numbers such as 17539 and 17585
8.Restart ActionNagios
Check configuration file correctness
#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
Restart Nagios
#service nagios Restart
Normal situation to this has been completed installation, to go to the database to see if the record has been added
9 , check that the installation is correct
#Tail-20/usr/local/nagios/var/nagios.log
[1227766166 "Ndomod:ndomod1.4b7 (10-31-2007) Copyright (c) 2005-2007 Ethan Galstad ( [email protected] )
[1227766166] ndomod:successfully connected to data sink. 0 Queued Items Toflush.
[1227766166] Event broker module '/USR/LOCAL/NAGIOS/BIN/NDOMOD-3X.O ' initializedsuccessfully.
[1227766166] finished daemonizing ... (newpid=18848)
indicates normal.
Suppose there is a problem. Once resolved, restart ndo2db and nagiosevery time.
Nagios installation and configuration (including Nrpe end) All (two)