当前位置:网站首页>将Nagios监控信息存入MySQL
将Nagios监控信息存入MySQL
2022-06-30 21:55:00 【星哥玩云】
一、NDOUtils安装需求:
Nagios:安装方法:http://www.linuxidc.com/Linux/2014-01/94658.htm
MySQL:源码安装方法:http://www.linuxidc.com/Linux/2014-04/100758.htm
DBI和DBD-mysql安装方法如下:
shell> perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql二、关联mysql头文件和库:
不做关联可能在config或make时出错
ln -s /app/mysql/include/* /usr/include/
ln -s /app/mysql/lib/* /usr/lib/
echo '/usr/lib' >> /etc/ld.so.conf
ldconfig -v三、安装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四、拷贝文件:
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/*五、拷贝配置文件:
cp ./config/ndo* /usr/local/nagios/etc/
chown nagios:nagios /usr/local/nagios/etc/*六、创建ndo的mysql数据库及用户
CREATE DATABASE `nagios` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT select,insert,update,delete ON nagios.* TO [email protected] identified by 'nagios';
FLUSH PRIVILEGES ;七、导入数据库结构
cd ./db/
./installdb -u root -p 123456 -h localhost -d nagios如果这里root没有密码的话需要进行修改。 八、修改配置文件
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九、启动ndo2db
/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg十、重启nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart十一、检查安装是否正确
tail -f /usr/local/nagios/var/nagios.log
涉及的错误:
启动ndo后在日志中出现: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 解决办法是使用:mysql -uroot --password="canada" -h192.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); 需要修改表结构。 alter table nagios.nagios_configfilevariables drop key instance_id; alter table nagios.nagios_configfilevariables add index (instance_id, configfile_id, varname);
tcp连接Mysql /usr/local/nagios/bin/file2sock -s /usr/local/nagios/var/ndo.dat -d localhost -t tcp -p 5668
边栏推荐
- 微服務鏈路風險分析
- Usbcan analyzer's supporting can and canfd comprehensive test software lkmaster software solves engineers' can bus test problems
- USBCAN分析仪的配套CAN和CANFD综合测试软件LKMaster软件解决工程师CAN总线测试难题
- Anfulai embedded weekly report no. 270: June 13, 2022 to June 19, 2022
- [untitled] first time to participate in CSDN activities
- 【回溯】全排列 II leetcode47
- Microservice link risk analysis
- 看阿里云 CIPU 的 10 大能力
- 周少剑,很少见
- Niubi | the tools I have treasured for many years have made me free to fish with pay
猜你喜欢

jupyterbook 清空控制台输出

Akk bacteria - the next generation of beneficial bacteria

Installing jupyter notebook under Anaconda

Rethink healthy diet based on intestinal microbiome

Study summary of dynamic routing between capsules

Uniapp routing uni simple router

Development techniques - import files using easyexcel (simple example)

模板方法模式介绍与示例

用yml文件进行conda迁移环境时的报错小结

Summary of errors reported when using YML file to migrate CONDA environment
随机推荐
Zhoushaojian, rare
吴恩达的机器学习适合入门吗?
Analyse des risques liés aux liaisons de microservices
Pytorch quantitative practice (2)
Bloom filter
Introduce an online platform for multi omics integration and network visual analysis
从PG15 XID64再次跳票说起
A comprehensive understanding of gout: symptoms, risk factors, pathogenesis and management
On several key issues of digital transformation
Anaconda下安装Jupyter notebook
1-11 create online file service
Some problems when SSH default port is not 22
Installing jupyter notebook under Anaconda
Pytorch quantitative perception training (qat) steps
Go Web 编程入门: 一探优秀测试库 GoConvey
Uniapp rich text editor
JD and Tencent renewed the three-year strategic cooperation agreement; The starting salary rose to 260000 yuan, and Samsung sk of South Korea scrambled for a raise to retain semiconductor talents; Fir
Modify the name of the launched applet
Ml & DL: Introduction à l’optimisation des hyperparamètres, indice d’évaluation, phénomène de surajustement et introduction détaillée aux méthodes d’optimisation des paramètres couramment utilisées da
【BSP视频教程】BSP视频教程第19期:单片机BootLoader的AES加密实战,含上位机和下位机代码全开源(2022-06-26)