zabbix value type导致的断图一例

简介:

 最近老毕在加hbase的监控,发现生成的graph有断图的情况。。因为之前有次zabbix断图定位到了是proxy的性能问题,通过调整相应的参数解决掉了。。再看这次的情况,发现有些item的graph是ok的,也就排除了proxy性能问题。。看来还是和item相关。

wKiom1MjSHLio75iAAPPbmJtYYM095.jpg

整个数据链路是agent---proxy(db)----server(db),从上游数据库开始入手:

1.找出正常的和断图的item做对比

1
2
3
4
5
6
7
select  i.itemid,h.host  from  items i,hosts h  where  i.hostid=h.hostid  and  h.host= 'xxxx'  and  i. name  in  ( 'regionserver writeRequestsCount' , 'regionserver requests' );
+ --------+----------------------------------------------+
| itemid | host                                         |
+ --------+----------------------------------------------+
|  53855 | xxxx |
|  53895 | xxxx |
+ --------+----------------------------------------------+

2.首先看server端和proxy端item的interval同步的情况(都是60s),没有异常。。

3.在server端的数据库中查看item的lastvalue的同步时间,发现出问题的item lastclock存在些问题,有问题的item有时候会很长时间都不会更新。

1
2
3
4
5
6
7
8
9
10
11
12
13
select  current_timestamp ();
+ ---------------------+
current_timestamp () |
+ ---------------------+
| 2014-03-14 11:22:23 |
+ ---------------------+
  select  itemid,key_,delay,lastvalue,from_unixtime(lastclock, '%Y%m%d %H:%i:%S' from  items  where  itemid  in  ( '53855' , '53895' );
+ --------+-----------------------------------------------+-------+-----------+--------------------------------------------+
| itemid | key_                                          | delay | lastvalue | from_unixtime(lastclock, '%Y%m%d %H:%i:%S' ) |
+ --------+-----------------------------------------------+-------+-----------+--------------------------------------------+
|  53855 | hadoop_stats[regionserver,requests]           |    60 | 0         | 20140314 11:15:19                          |
|  53895 | hadoop_stats[regionserver,writeRequestsCount] |    60 | 291       | 20140314 11:21:52                          |
+ --------+-----------------------------------------------+-------+-----------+--------------------------------------------+

4.在server的history相应的表查看断图的item一段时间值的分布情况,发现不是一分钟一条数据。

1
2
3
4
5
6
7
8
9
10
11
select  from_unixtime(clock, '%Y%m%d %H:%i:%S' ),value  from  history_uint  where  itemid  in  ( '53855' );
| 20140314 11:12:02                      |     0 |
| 20140314 11:26:10                      |     0 |
| 20140314 11:27:11                      |     0 |
| 20140314 11:28:12                      |     0 |
| 20140314 11:29:13                      |    10 |
| 20140314 11:30:28                      |     0 |
| 20140314 11:31:29                      |     0 |
| 20140314 11:32:29                      |     0 |
| 20140314 11:33:30                      |     0 |
| 20140314 11:34:46                      |     0 |

5.proxy相对应的history_proxy表中查看相关数据,发现在value字段有Received value xxx isnotsuitable forvalue type的信息,看来和数据的类型有关系。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
select  id,from_unixtime(clock, '%Y%m%d %H:%i:%S' ),value  from  proxy_history  where  itemid  in  ( '53855' );   
+ ------------+----------------------------------------+--------------------------------------------------------------------------------------------------------+
| id         | from_unixtime(clock, '%Y%m%d %H:%i:%S' ) | value                                                                                                  |
+ ------------+----------------------------------------+--------------------------------------------------------------------------------------------------------+
| 4792921942 | 20140314 11:12:02                      | 0                                                                                                      |
| 4792948233 | 20140314 11:13:19                      | Received value [283.33334]  is  not  suitable  for  value type [ Numeric  (unsigned)]  and  data type [ Decimal ] |
| 4792967862 | 20140314 11:14:19                      | Received value [266.33334]  is  not  suitable  for  value type [ Numeric  (unsigned)]  and  data type [ Decimal ] |
| 4792987031 | 20140314 11:15:19                      | Received value [315.33334]  is  not  suitable  for  value type [ Numeric  (unsigned)]  and  data type [ Decimal ] |
| 4793199599 | 20140314 11:26:10                      | 0                                                                                                      |
| 4793219166 | 20140314 11:27:11                      | 0                                                                                                      |
| 4793239212 | 20140314 11:28:12                      | 0                                                                                                      |
| 4793258721 | 20140314 11:29:13                      | 10                                                                                                     |
| 4793283508 | 20140314 11:30:28                      | 0                                                                                                      |
| 4793303560 | 20140314 11:31:29                      | 0                                                                                                      |
| 4793322826 | 20140314 11:32:29                      | 0                                                                                                      |
| 4793342173 | 20140314 11:33:30                      | 0                                                                                                      |
+ ------------+----------------------------------------+--------------------------------------------------------------------------------------------------------+

6.查看item的设置,发现value type设置的是Numeric(unsigned)的,而item的值会产生float类型的值,proxy_history的value字段是longtext类型的,而server端history_uint表的字段是bigint类型的。在类型转换存储的时候就会造成数据的丢失。其实在item表中有个error的信息字段,是记录了item获取值存在的错误的。。可以通过这个直接定位到问题。

问题rc找到了,为了方便可以直接通过update 数据库来fix这个问题。

1
update  items  set  value_type=0  where  value_type=3  and  (key_  like  'hadoop_stats[regionserver%'  or  key_  like  'hadoop_stats[hmaster%' );

不过发现一个比较奇怪的问题,在value type不正确的时候,agent数据获取并不是根据interval来的,有时候会间隔10min左右。。这样也加剧了history表中数据丢失的严重性,不知道是不知zabbix agent内部的机制,有时间需要看看代码才行。

agent端对应日志:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
7964:20140314:111202.800  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:111319.053  For  key  [hadoop_stats[regionserver,requests]] received value [283.33334]
7964:20140314:111419.454  For  key  [hadoop_stats[regionserver,requests]] received value [266.33334]
7964:20140314:111519.532  For  key  [hadoop_stats[regionserver,requests]] received value [315.33334]
#中间10分钟左右没有值产生
7964:20140314:112610.705  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:112711.308  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:112812.375  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:112913.086  For  key  [hadoop_stats[regionserver,requests]] received value [10.0]
7964:20140314:113028.703  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:113129.180  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:113229.941  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:113330.568  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:113446.343  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]
7964:20140314:113546.977  For  key  [hadoop_stats[regionserver,requests]] received value [0.0]

最后贴下更新后的graph情况:

wKiom1MjVEbwQjR3AAPAbZ1hj2w655.jpg

再附一个value type和history的对应关系:

wKioL1MjU9azRA2DAADJd7--sI4759.jpg



本文转自菜菜光 51CTO博客,原文链接:http://blog.51cto.com/caiguangguang/1377089,如需转载请自行联系原作者

相关文章
|
4月前
|
监控 应用服务中间件 nginx
基于Zabbix的SLA监控体系构建与实践
本文由Zabbix社区专家褚凤彬分享,详解SLA在Zabbix中的应用。通过Trigger与Service联动,构建Web应用的多层级监控体系,并介绍SLA计算规则、维护期处理及升级注意事项,助力企业精准掌控服务可用性。
491 36
|
10月前
|
运维 监控 安全
【案例分享】中国通号卡斯柯公司:ZABBIX如何破解轨道交通监控难题
本文根据2023上海峰会上朱林贤的演讲整理,聚焦中国通号卡斯柯公司如何借助Zabbix实现轨道交通信号系统的智能化管理。作为中外合资企业,卡斯柯通过统一平台整合设备监控,大幅降低成本并提升灵活性,成功应用于国内外项目。文章探讨了传统监控系统的痛点、研发维护经验及国产化与开源技术挑战,为行业转型提供了宝贵启示。未来,开放协作将是推动轨道交通智能化发展的关键。
523 8
|
监控 安全 Linux
在Linux中,zabbix如何监控脑裂?
在Linux中,zabbix如何监控脑裂?
|
存储 缓存 监控
|
监控 Java 应用服务中间件
tomcat相关概念与部署tomcat多实例-zabbix监控(docker部署)
通过上述步骤,您可以在Ubuntu系统上成功编译并安装OpenCV 4.8。这种方法不仅使您能够定制OpenCV的功能,还可以优化性能以满足特定需求。确保按照每一步进行操作,以避免常见的编译问题。
195 23
|
监控 Java 应用服务中间件
tomcat相关概念与部署tomcat多实例-zabbix监控(docker部署)
通过上述步骤,您可以在Ubuntu系统上成功编译并安装OpenCV 4.8。这种方法不仅使您能够定制OpenCV的功能,还可以优化性能以满足特定需求。确保按照每一步进行操作,以避免常见的编译问题。
324 25

推荐镜像

更多