zabbix报警统计信息的dashboard

需求是这样的

       用zabbix来监控报警,那么时间久了、报警次数多了、人员忙了、这些情况会导致一些报警内容被忽略,所以需要一个报表来反应谁收到了什么样的报警信息,收到了多少条,从而来判断这些情况是否被处理及处理进度,以及可以更好的分配人力资源,防止工作都压到1个人身上。


需求分析假设

       1、用zabbix自带报表功能,但是这个东西存在局限性,还未发现有此功能;

               2、数据库中查找表的信息,从来进行二次判断进行结果展现。



进程:

   选用了第二种方法:数据库。

wKioL1MBe0WznLCqAAFF2pbfyeg318.jpg

   大概看了下zabbix数据库中的表,大概找出了下面3个表可能存在相应的关系:

wKiom1MBe9Hybm9EAAaZHYtcBn0331.jpg


其实,我这里的结果只使用了1表和3表2张表进行结果展现,其实结果呈现的方法很多种,可能最后还会需要“用户组”表,进行结果展现及组员管理。


我这里将结果展现成了下面的内容:(应用级监控邮件报警的历史发送情况)

wKiom1MBfV7xnSb3AAVoLXW5YJg592.jpg

1
2
邮件筛选sql:
select  userid,name,  sum ( case  when subject like  '%CPU systime%'  then  1 end) systime,  sum ( case  when subject like  '%CPU USE%'  then  1 end) cpuuse,  sum ( case  when subject like  '%Disk I%'  then  1 end) diskio,  sum ( case  when subject like  '%available memory%'  then  1 end) mem,  sum ( case  when subject like  '%is unreachable%'  then  1 end) downtime,  sum ( case  when subject like  '%restarted%'  then  1 end) restart,  sum ( case  when subject like  '%has been changed%'  then  1 end) passchange,  sum ( case  when subject like  '%Free disk%'  then  1 end) disk,  sum ( case  when subject not like  '%CPU%'  and subject not like  '%available memory%'  and subject not like  '%Disk%'  and subject not like  '%is unreachable%'  and subject not like  '%restart%'  and subject not like  '%has been changed%'  and subject not like  '%disk%'  then  1 end) other from ( select  a.userid,c.name,a.subject from alerts a, users  c where a.mediatypeid= '6'  and a.clock> '1392220800'  and a.clock< '1392307200'  and a.userid=c.userid and a.status= '1'  and a.subject not like  '%OK%' ) at group by userid;



1
2
短信筛选sql:
select  userid,name,  sum ( case  when subject like  '%CPU systime%'  then  1 end) systime,  sum ( case  when subject like  '%CPU USE%'  then  1 end) cpuuse,  sum ( case  when subject like  '%Disk I%'  then  1 end) diskio,  sum ( case  when subject like  '%available memory%'  then  1 end) mem,  sum ( case  when subject like  '%is unreachable%'  then  1 end) downtime,  sum ( case  when subject like  '%restarted%'  then  1 end) restart,  sum ( case  when subject like  '%has been changed%'  then  1 end) passchange,  sum ( case  when subject like  '%Free disk%'  then  1 end) disk,  sum ( case  when subject not like  '%CPU%'  and subject not like  '%available memory%'  and subject not like  '%Disk%'  and subject not like  '%is unreachable%'  and subject not like  '%restart%'  and subject not like  '%has been changed%'  and subject not like  '%disk%'  then  1 end) other from ( select  a.userid,c.name,a.subject from alerts a, users  c where a.mediatypeid= '3'  and a.clock> '1392220800'  and a.clock< '1392307200'  and a.userid=c.userid and a.status= '1'  and a.subject not like  '%OK%' ) at group by userid;



其中sql的条件可以更改。


需要特别注意的是

clock字段是 unix的时间戳,需要的筛选条件可以进行转换进行获得。










本文转自 陈延宗 51CTO博客,原文链接:http://blog.51cto.com/407711169/1359724,如需转载请自行联系原作者
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值