zabbix5.0 使用elasticsearch7.6存储历史数据
作者:互联网
个人学习笔记,谢绝转载!!!
原文:https://www.cnblogs.com/wshenjin/p/15023628.html
zabbix5.0和elasticsearch7.6的安装忽略
创建ES mapping
Elasticsearch 支持 Zabbix 的监控项类型:uint,dbl,str,log,text,对应如下:
Zabbix 监控项数据类型 | 对应 Zabbix 表 | 对应 Elasticsearch 类型 |
---|---|---|
Numeric(unsigned)(无符号整型) | history_uint | uint |
Numeric(float)(浮点型) | history | dbl |
Character(字符) | history_str | str |
Log(日志) | history_log | log |
Text | history_text | text |
创建ES中的映射:
[root@ ~]# curl -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:9200/uint' -d '
> {
> "settings":{
> "number_of_replicas":1,
> "number_of_shards":5
> },
> "mappings":{
> "properties":{
> "itemid":{
> "type":"long"
> },
> "clock":{
> "format":"epoch_second",
> "type":"date"
> },
> "value":{
> "type":"long"
> }
> }
> }
> }'
{"acknowledged":true,"shards_acknowledged":true,"index":"uint"}
[root@ ~]# curl -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:9200/dbl' -d '
> {
> "settings":{
> "number_of_replicas":1,
> "number_of_shards":5
> },
> "mappings":{
> "properties":{
> "itemid":{
> "type":"long"
> },
> "clock":{
> "format":"epoch_second",
> "type":"date"
> },
> "value":{
> "type":"double"
> }
> }
> }
> }'
{"acknowledged":true,"shards_acknowledged":true,"index":"dbl"}
[root@ ~]# curl -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:9200/log' -d '
> {
> "settings":{
> "number_of_replicas":1,
> "number_of_shards":5
> },
> "mappings":{
> "properties":{
> "itemid":{
> "type":"long"
> },
> "clock":{
> "format":"epoch_second",
> "type":"date"
> },
> "value":{
> "fields":{
> "analyzed":{
> "index":true,
> "type":"text",
> "analyzer":"standard"
> }
> },
> "index":false,
> "type":"text"
> }
> }
> }
> }'
{"acknowledged":true,"shards_acknowledged":true,"index":"log"}
[root@ ~]# curl -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:9200/text' -d '
> {
> "settings":{
> "number_of_replicas":1,
> "number_of_shards":5
> },
> "mappings":{
> "properties":{
> "itemid":{
> "type":"long"
> },
> "clock":{
> "format":"epoch_second",
> "type":"date"
> },
> "value":{
> "fields":{
> "analyzed":{
> "index":true,
> "type":"text",
> "analyzer":"standard"
> }
> },
> "index":false,
> "type":"text"
> }
> }
> }
> }'
{"acknowledged":true,"shards_acknowledged":true,"index":"text"}
[root@ ~]# curl -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:9200/str' -d '
> {
> "settings":{
> "number_of_replicas":1,
> "number_of_shards":5
> },
> "mappings":{
> "properties":{
> "itemid":{
> "type":"long"
> },
> "clock":{
> "format":"epoch_second",
> "type":"date"
> },
> "value":{
> "fields":{
> "analyzed":{
> "index":true,
> "type":"text",
> "analyzer":"standard"
> }
> },
> "index":false,
> "type":"text"
> }
> }
> }
> }'
标签:index,zabbix5.0,elasticsearch7.6,text,number,shards,true,历史数据,type 来源: https://www.cnblogs.com/wshenjin/p/15023628.html