首页 > 其他 > 详细

zabbix 历史数据存入elasticsearch

时间:2020-04-23 11:55:04      阅读:122      评论:0      收藏:0      [点我收藏+]

应用版本信息:

zabbix 版本:4.4.3
elasticsearch 版本:6.8.5
kibana 版本: 6.8.5
系统版本:Centos: 7.7

服务分布:

elasticsearch   192.168.1.105   端口:9500,9100
kibana          192.168.1.105   端口:5601
zabbix_server   192.168.1.103   端口:80

zabbix elasticsearch、kibana安装这里不阐述

配置:

zabbix 配置支持elasticsearch

elasticsearch支持的监控项类型:uint,dbl,str,log,text

监控项数据类型|数据库表|对应elasticsearch类型:
技术分享图片

修改zabbix_server.conf

# Mandatory: no
# Default:
HistoryStorageURL=http://192.168.1.105:9500

### Option: HistoryStorageTypes
#       Comma separated list of value types to be sent to the history storage.
#
# Mandatory: no
# Default:
HistoryStorageTypes=uint,dbl,str,log,text

### Option: HistoryStorageDateIndex
#       Enable preprocessing of history values in history storage to store values in different indices based on date.
#       0 - disable
#       1 - enable
#
# Mandatory: no
# Default:
HistoryStorageDateIndex=1

修改 zabbix.conf.php配置文件,增加以下参数:

$HISTORY[‘url‘] = ‘http://192.168.1.105:9500‘;
$HISTORY[‘types‘] = [‘uint‘, ‘text‘, ‘log‘, ‘str‘, ‘dbl‘];

保存并启动zabbix_server

添加Elasticsearch mapping

curl -H "Content-Type:application/json" -XPUT http://192.168.1.105:9500/uint -d ‘ { "settings" : { "index" : { "number_of_replicas" : 1, "number_of_shards" : 5 } }, "mappings" : { "values" : { "properties" : { "itemid" : { "type" : "long" }, "clock" : { "format" : "epoch_second", "type" : "date" }, "value" : { "type" : "long" } } } } } ‘

curl -H "Content-Type:application/json" -XPUT http://192.168.1.105:9500/dbl -d ‘ { "settings" : { "index" : { "number_of_replicas" : 1, "number_of_shards" : 5 } }, "mappings" : { "values" : { "properties" : { "itemid" : { "type" : "long" }, "clock" : { "format" : "epoch_second", "type" : "date" }, "value" : { "type" : "double" } } } } } ‘



curl -H "Content-Type:application/json" -XPUT http://192.168.1.105:9500/log -d ‘ { "settings" : { "index" : { "number_of_replicas" : 1, "number_of_shards" : 5 } }, "mappings" : { "values" : { "properties" : { "itemid" : { "type" : "long" }, "clock" : { "format" : "epoch_second", "type" : "date" }, "value" : { "fields" : { "analyzed" : { "index" : true, "type" : "text", "analyzer" : "standard" } }, "index" : false, "type" : "text" } } } } } ‘

curl -H "Content-Type:application/json" -XPUT http://192.168.1.105:9500/text -d ‘ { "settings" : { "index" : { "number_of_replicas" : 1, "number_of_shards" : 5 } }, "mappings" : { "values" : { "properties" : { "itemid" : { "type" : "long" }, "clock" : { "format" : "epoch_second", "type" : "date" }, "value" : { "fields" : { "analyzed" : { "index" : true, "type" : "text", "analyzer" : "standard" } }, "index" : false, "type" : "text" } } } } } ‘


curl -H "Content-Type:application/json" -XPUT http://192.168.1.105:9500/str -d ‘ { "settings" : { "index" : { "number_of_replicas" : 1, "number_of_shards" : 5 } }, "mappings" : { "values" : { "properties" : { "itemid" : { "type" : "long" }, "clock" : { "format" : "epoch_second", "type" : "date" }, "value" : { "fields" : { "analyzed" : { "index" : true, "type" : "text", "analyzer" : "standard" } }, "index" : false, "type" : "text" } } } } } ‘

打开kibana或elasticsearch 验证索引:

http:/192.168.1.105:9500

技术分享图片

zabbix 历史数据存入elasticsearch

原文:https://www.cnblogs.com/ArchitecTang/p/12759323.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!