网站首页 > 资源文章 正文
被监控MySQL主机
在需要监控的MySQL服务器上新建一个nagios库、并授权给192.168.1.10来登录
[root@juny-18 ~]# mysql -uroot -pwoDEmiMA01!
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database nagios; #创建nagios数据库
Query OK, 1 row affected (0.05 sec)
mysql> grant select on nagios.* to nagios@'192.168.1.10' identified by 'Nagios01!'; #创建授权并设置密码
Query OK, 0 rows affected, 1 warning (0.07 sec)
mysql>
mysql> flush privileges; #刷新权限表
Query OK, 0 rows affected (0.06 sec)
nagios监控主机
回到192.168.1.10 上去做配置
增加两行配置
增加
写hosts配置文件
[root@juny-10 nagios]# vim etc/objects/hosts.cfg
define host{
use linux-server
host_name juny-18
address 192.168.1.18
}
写service.cfg 配置文件
[root@juny-10 nagios]# vim etc/objects/service.cfg
define service{
use local-service
host_name juny-18
service_description MySqlSev
check_command check_mysql
}
增加配置文件
[root@juny-10 nagios]# vim etc/objects/commands.cfg
define command{
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$ -unagios -pNagios01! -d nagios
}
手动测试
[root@juny-10 nagios]# cd libexec/
[root@juny-10 libexec]# ./check_mysql -H 192.168.1.18 -unagios -pNagios01! -d nagios
Uptime: 3996 Threads: 1 Questions: 11 Slow queries: 0 Opens: 114 Flush tables: 1 Open tables: 107 Queries per second avg: 0.002|Connections=6c;;; Open_files=22;;; Open_tables=108;;; Qcache_free_memory=1031832;;; Qcache_hits=0c;;; Qcache_inserts=0c;;; Qcache_lowmem_prunes=0c;;; Qcache_not_cached=2c;;; Qcache_queries_in_cache=0;;; Queries=12c;;; Questions=9c;;; Table_locks_waited=0c;;; Threads_connected=1;;; Threads_running=1;;; Uptime=3996c;;;
[root@juny-10 libexec]#
看到上面的信息,说明连接没有问题
网页测试
可以看到MySQL服务被成功的监控到
我们的nagios库也被检测到了
测试下 、在MySQL主机把MySQL停止
[root@juny-18 ~]# systemctl stop mysqld.service
[root@juny-18 ~]#
可以看到马上就检测到了
开启试试、是不是被监控到的
[root@juny-18 ~]# systemctl start mysqld.service
下节介绍nagios监控web服务
评论
有什么不懂或者疑问的地方请关注留言,评论
猜你喜欢
- 2024-09-23 Ubuntu 在终端界面打广告,引发用户不满
- 2024-09-23 Linux机架-Nagios监控与Cacti趋势分析-D9-趋势分析
- 2024-09-23 新思科技发现Nagios XI存在三个漏洞
- 2024-09-23 一大波你可能不知道的 Linux 网络工具,快快来收藏
- 2024-09-23 Linux机架-Nagios监控与Cacti趋势分析-D5-Nagios插件
- 2024-09-23 陈俊勇:带你搭建nagios监控web服务、非常简单
- 2024-09-23 使用Nagios监控网络、服务器(三)使用check_nt监控windows资源
- 2024-09-23 陈俊勇:带你部署Nagios 第一篇(nagios官网)
- 2024-09-23 五大超强开源的网络监控工具盘点,你一定需要
- 2024-09-23 主流监控系统超硬核总结!含Zabbix、Prometheus、Nagios等教程
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 电脑显示器花屏 (79)
- 403 forbidden (65)
- linux怎么查看系统版本 (54)
- 补码运算 (63)
- 缓存服务器 (61)
- 定时重启 (59)
- plsql developer (73)
- 对话框打开时命令无法执行 (61)
- excel数据透视表 (72)
- oracle认证 (56)
- 网页不能复制 (84)
- photoshop外挂滤镜 (58)
- 网页无法复制粘贴 (55)
- vmware workstation 7 1 3 (78)
- jdk 64位下载 (65)
- phpstudy 2013 (66)
- 卡通形象生成 (55)
- psd模板免费下载 (67)
- shift (58)
- localhost打不开 (58)
- 检测代理服务器设置 (55)
- frequency (66)
- indesign教程 (55)
- 运行命令大全 (61)
- ping exe (64)
本文暂时没有评论,来添加一个吧(●'◡'●)