监控工具mysql管理工具
批量监控linux 下mysql db层的工具相对匮乏,用ssis diy 了下.
使用 ssis 包 读取配置表信息来实现监控mysql并根据实际情况由邮件反馈给dba
1 整理个全局信息表包括ip以及监控维度等.
498)this.width=498;>
建表语句如下:
create table [dbo].[all_host_info]( [ip] [varchar](20) null, [isactive] [tinyint] null, [ishost] [tinyint] null, [isslave] [tinyint] null, [isjob] [tinyint] null, [isobject] [tinyint] null, [isprivileges] [tinyint] null ) on [primary]
2 新建ssis 包 命名为 mysqlmonitor 并创建如下变量
498)this.width=498;>
3 在控制流中创建 tsql_slave sql task 组件
建立oledb链接到 all_host_info 所在的sql 服务器,在sqlsourcetype 里面输入如下代码
select count(1) as j from all_host_info where isslave=1;
并在 result set 选择单行
498)this.width=498;>
在结果结果集中 输入如下结果名称 并指定到变量 j
498)this.width=498;>
4 新建tsql_slave_id tsql task 组件
并链接至 tsql_slave 组件所用的 ole链接
498)this.width=498;>
5 新建个script 组件 内容如下
498)this.width=498;>
498)this.width=498;>
6 新建个 for 循环 内容如下
498)this.width=498;>
7 在for 循环里面拖入个数据流内容如下把 读取的ip信息写入到 object 变量里面
498)this.width=498;>
8在for 组件里 拖入个 foreach_var foreach 组件 内容如下 用来拆分 object 变量 在变量映射里面选择 ip
498)this.width=498;>
9 拖入个数据流组件
498)this.width=498;>
10 发邮件
498)this.width=498;>
11 包最终组件如下
498)this.width=498;>
12 把包加载到job里面 一小时发次邮件 其他维度的监控同原理。
498)this.width=498;>
练一技,修百艺,而成于自然.