Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Store Nagios monitoring information in MySQL

2025-04-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. NDOUtils installation requirements:

Nagios: installation method: http://www.linuxidc.com/Linux/2014-01/94658.htm

MySQL: source code installation method: http://www.linuxidc.com/Linux/2014-04/100758.htm

The installation methods for DBI and DBD-mysql are as follows:

Shell > perl-MCPAN-e shell

Cpan > install DBI

Cpan > install DBD::mysql

2. Associate the mysql header file and library:

Failure to associate may cause errors in config or make

Ln-s / app/mysql/include/* / usr/include/

Ln-s / app/mysql/lib/* / usr/lib/

Echo'/ usr/lib' > > / etc/ld.so.conf

Ldconfig-v

3. Install nodutils:

Tar zxvf ndoutils-1.4b7.tar.gz

Cd ndoutils-1.4b7

. / configure-prefix=/usr/local/nagios-enable-mysql-disable-pgsql LDFLAGS=-L/app/mysql/lib-with-mysql-inc=/app/mysql/include/mysql-with-mysql-lib=/app/mysql/lib/mysql

Make & & make install

4. Copy 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 the configuration file:

Cp. / config/ndo* / usr/local/nagios/etc/

Chown nagios:nagios / usr/local/nagios/etc/*

6. Create mysql database and users of ndo

CREATE DATABASE `nagios` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

GRANT select,insert,update,delete ON nagios.* TO nagios@localhost identified by 'nagios'

FLUSH PRIVILEGES

Import database structure

Cd. / db/

. / installdb-u root-p 123456-h localhost-d nagios

If the root does not have a password here, it needs to be modified.

VIII. Modify the configuration file

Vim / usr/local/nagios/etc/ndo2db.cfg

Db_user=nagios

Db_pass=nagios

Socket_type=tcp

Vim / usr/local/nagios/etc/nagios.cfg

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

Vim / usr/local/nagios/etc/ndomod.cfg

Output_type=file

Output=/usr/local/nagios/var/ndo.dat

9. Start ndo2db

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

10. Restart nagios

/ usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg

Service nagios restart

11. Check whether the installation is correct

Tail-f / usr/local/nagios/var/nagios.log

The error involved:

After starting ndo, it appears in the log: nagios ndo2db-3x: Error: mysql_query () failed for 'INSERT INTO nagios_configfilevariables SET instance_id='1', configfile_id='3', varname='cfg_file', varvalue='/usr/local/nagios//etc/objects/localhost\ .cfg solution is to use: mysql-uroot-- password= "canada"-h292.168.1.97-e "alter table nagios.nagios_configfilevariables drop key instance_id Alter table nagios.nagios_configfilevariables add index (instance_id, configfile_id, varname); table structure needs to be modified. Alter table nagios.nagios_configfilevariables drop key instance_id; alter table nagios.nagios_configfilevariables add index (instance_id, configfile_id, varname)

Tcp connects Mysql / usr/local/nagios/bin/file2sock-s / usr/local/nagios/var/ndo.dat-d localhost-t tcp-p 5668

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 272

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report