Cacti and Nagios integration

Source: Internet
Author: User

Required installation package http://down.51cto.com/data/1877296

Integrated Cacti+nagios
integrating cacti and Nagios is a plug- in nagiosfor cacti that leverages cacti, and it works by passing Nagios data ndo2db Import into the MySQL database (cacti 's library), and then cacti Read the database information will be Nagios

Results are shown.

1, install php-json extension, because NPC uses ExtJS, such as the extension NPC interface without JSON can not come out.

# Tar XF php-json-ext-1.2.1.tar.gz

# CD php-json-ext-1.2.1

# phpize

If you don't have a command, install the following package

# rpm-ihv/media/centos/php-devel-5.1.6-27.el5.i386.rpm

# sh Configure && make &&make install

2. New file, add information as follows:

# Vim/etc/php.d/json.ini

Extension=json.so

after the installation is completed, if the first verification, you can write a index.php page to see, there is JSON information, as follows:

[[Email protected]~]# vim/var/www/html/index.php

<?php

Phpinfo ();

?>

Visit http://localhost/index.php

Json

JSON support

Enabled

JSON version

1.2.1

3, install the ndoutils, need to install Mysql-devel Front has been installed here will not have to pretend

# tar XVF ndoutils-1.5.2.tar.gz

# CD ndoutils-1.5.2

./configure--prefix=/usr/local/nagios--with-ssl--with-ssl-lib--enable-mysql--enable-ssl

Make

No make install

4. Copy files (if nagios and cacti are not on a single machine, copy to the corresponding directory on the Nagios host)

# CP src/{ndomod-3x.o,ndo2db-3x,log2ndo,file2sock}/usr/local/nagios/bin/

# CP Config/ndo2db.cfg-sample/usr/local/nagios/etc/ndo2db.cfg

# CP Config/ndomod.cfg-sample/usr/local/nagios/etc/ndomod.cfg

# chmod 644/usr/local/nagios/etc/ndo*

Chown Nagios:nagios ndo*

5 , repair profile information, connect to database

# vim/usr/local/nagios/etc/ndo2db.cfg

Lock_file=/usr/local/nagios/var/ndo2db.lock

Ndo2db_user=nagios

Ndo2db_group=nagios

db_host=192.168.11.185 (Nagios in this machine do not change )

SOCKET_TYPE=TCP// to remove this line #, #socket_type the =unix with the# number

Socket_name=/usr/local/nagios/var/ndo.sock

DB_NAME=CACTI// name of the database created

Db_prefix=npc_

DB_USER=CACTI//cacti Database login user name

db_pass=123//cacti Database login Password

Debug_file=/usr/local/nagios/var/ndo2db.debug

# vim/usr/local/nagios/etc/ndomod.cfg

Output_type=tcpsocket// to remove this line #, #output_type the =unixsocket with the# number

output=127.0.0.1(Nagios does not change on this machine) // Leave this line # removed,#output =/usr/local/nagios//var/ Ndo.sock Front plus #

Buffer_file=/usr/local/nagios/var/ndomod.tmp

6. Start ndo2db

#/usr/local/nagios/bin/ndo2db-3x-c/usr/local/nagios/etc/ndo2db.cfg

# ps–elf |grep ndo2db

7. Install NPC

#wget http://www.constructaegis.com/downloads/npc-2.0.4.tar.gz

# tar XVF npc-2.0.4.tar.gz-c/var/www/html/cacti/plugins

8. Modify Nagios to add information:

# Vim/usr/local/nagios/etc/nagios.cfg// Add the following line at the end

Broker_module=/usr/local/nagios/bin/ndomod-3x.oconfig_file=/usr/local/nagios/etc/ndomod.cfg

Process_performance_data=1//Find the # number in front of this line

9. Start nagios:

# Service Nagios Restart

if open cacti no NPC Plugin, please modify the following line

# vim/var/www/html/cacti/include/config.php

$plugins []= ' NPC ';

Cacti inside Add NPC

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4A/72/wKioL1QlJLXitM-AAAQHwVunOKY759.jpg "title=" Image001.png "alt=" Wkiol1qljlxitm-aaaqhwvunoky759.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4A/70/wKiom1QlJLjA4pf6AABiqr40lBM869.jpg "title=" Image003.png "alt=" Wkiom1qljlja4pf6aabiqr40lbm869.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4A/70/wKiom1QlJMuCfehvAABRmU2PXKo748.jpg "title=" Image004.jpg "alt=" Wkiom1qljmucfehvaabrmu2pxko748.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4A/72/wKioL1QlJVHA69SDAAB2a2x0MfU410.jpg "title=" Image006.jpg "alt=" Wkiol1qljvha69sdaab2a2x0mfu410.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/4A/72/wKioL1QlJW3CsZfMAAa92CJEWlg287.jpg "title=" Image007.png "alt=" Wkiol1qljw3cszfmaaa92cjewlg287.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/4A/70/wKiom1QlJYyx-tKqAADuRxJ_MEY749.jpg "title=" Image010.jpg "alt=" Wkiom1qljyyx-tkqaadurxj_mey749.jpg "/>

but see the NPC found blank, no data, because PHP does not have pdo_mysql support, so install Pdo_mysql

Check the index.php Web page to see if Pdo-mysql is installed , and if not, perform the following installation

Tar zxvf pdo_mysql-1.0.2.tgz

# CD pdo_mysql-1.0.2

#/usr/local/php/bin/phpize

#./configure--with-php-config=/usr/bin/php-config

#make

#make Install

Installing Shared extensions:/usr/lib64/php/modules/

Phpize belongs to Php-devel if not installed Yuminstall php-devel–y

To modify the database structure:

# mysql-u Root–p

mysql> usr cacti; copy and paste the following content

ALTER TABLE npc_eventhandlers add long_outputtext not NULL default ';

ALTER TABLE npc_hostchecks add long_outputtext not NULL default ';

ALTER TABLE Npc_hoststatus add long_outputtext not NULL default ';

ALTER TABLE npc_notifications addlong_output TEXT not NULL default ';

ALTER TABLE Npc_servicechecks addlong_output TEXT not NULL default ';

ALTER TABLE Npc_servicestatus addlong_output TEXT not NULL default ';

ALTER TABLE npc_statehistory addlong_output TEXT not NULL default ';

ALTER TABLE Npc_systemcommands addlong_output TEXT not NULL default ';

Restart the service:

# Service httpd Restart

# Service Mysqld Restart

# Service Nagios Restart

We can see the data.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4A/72/wKioL1QlJdLxs2ZVAAE69F3g9E4737.jpg "title=" Image012.jpg "alt=" Wkiol1qljdlxs2zvaae69f3g9e4737.jpg "/>

when you view the/var/log/message file, the following error occurs, also add the database

Nov 14:47:30 localhost ndo2db-3x:error:mysql_query () failed for ' INSERT to npc_servicechecks SET instance_id= ' 0 ', se Rvice_object_id= ' 0 ', check_type= ' 0 ',


Cacti and Nagios integration

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.