차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
zabbix-elasticsearch [2024/04/26 13:23] 14.63.160.16 이전 판으로 되돌림 (2023/11/30 07:20) |
zabbix-elasticsearch [2024/05/22 23:10] 127.0.0.1 이전 판으로 되돌림 (2021/10/27 04:47) |
||
---|---|---|---|
줄 1: | 줄 1: | ||
+ | ======= How to configure elasticsearch in zabbix ====== | ||
+ | |||
+ | * Elasticsearch version: 7.3 | ||
+ | * Zabbix-server version: 4.2 | ||
+ | * Officlal documentation: | ||
+ | |||
+ | ===== Zabbix server and frontend ===== | ||
+ | |||
+ | ==== Zabbix server ==== | ||
+ | |||
+ | File: / | ||
+ | |||
+ | < | ||
+ | ### Option: HistoryStorageURL | ||
+ | # History storage HTTP[S] URL. | ||
+ | # | ||
+ | # Mandatory: no | ||
+ | # Default: | ||
+ | # HistoryStorageURL= | ||
+ | ### Option: HistoryStorageTypes | ||
+ | # Comma separated list of value types to be sent to the history storage. | ||
+ | # | ||
+ | # Mandatory: no | ||
+ | # Default: | ||
+ | # HistoryStorageTypes=uint, | ||
+ | </ | ||
+ | |||
+ | For example (on elasticsearch 7.3, only `dbl` working): | ||
+ | |||
+ | < | ||
+ | HistoryStorageURL=http:// | ||
+ | HistoryStorageTypes=dbl, | ||
+ | </ | ||
+ | |||
+ | ==== Zabbix frontend ==== | ||
+ | |||
+ | File: / | ||
+ | |||
+ | < | ||
+ | // Elasticsearch url (can be string if same url is used for all types). | ||
+ | $HISTORY[' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ]; | ||
+ | // Value types stored in Elasticsearch. | ||
+ | $HISTORY[' | ||
+ | </ | ||
+ | |||
+ | and modify `global' | ||
+ | |||
+ | < | ||
+ | // Zabbix GUI configuration file. | ||
+ | global $DB, $HISTORY; | ||
+ | </ | ||
+ | |||
+ | For example: | ||
+ | |||
+ | < | ||
+ | // Zabbix GUI configuration file. | ||
+ | global $DB, $HISTORY; | ||
+ | |||
+ | (skip) | ||
+ | |||
+ | $HISTORY[' | ||
+ | $HISTORY[' | ||
+ | </ | ||
+ | |||
+ | ===== Creating mapping to Elasticsearch ===== | ||
+ | |||
+ | ==== What difference between offical document and this? (troubleshooting) ==== | ||
+ | |||
+ | The `mapping types` was removed on elasticsearch 7.0 and higher. It is cause to occur mapping error. details is [[https:// | ||
+ | |||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | So, you have to following this sentence: | ||
+ | |||
+ | ==== Creating indices and templates === | ||
+ | |||
+ | step 1 | ||
+ | |||
+ | < | ||
+ | curl -X PUT \ | ||
+ | | ||
+ | -H ' | ||
+ | -d '{ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }' | ||
+ | </ | ||
+ | |||
+ | step 2 | ||
+ | |||
+ | < | ||
+ | curl -X PUT \ | ||
+ | | ||
+ | -H ' | ||
+ | -d '{ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }' | ||
+ | </ | ||
+ | |||
+ | step 3 | ||
+ | |||
+ | < | ||
+ | curl -X PUT \ | ||
+ | | ||
+ | -H ' | ||
+ | -d '{ | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }' | ||
+ | </ | ||
+ | |||
+ | ===== Creating date-based indices on Elasticsearch (Optional) ===== | ||
+ | |||
+ | Devide indices by each date when creating index. 0 is diable. 1 is enable. | ||
+ | |||
+ | < | ||
+ | ### 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=0 | ||
+ | </ | ||
+ | |||
+ | ===== Restart zabbix service ===== | ||
+ | |||
+ | Do execute command `service zabbix-server restart` or systemd, systemctl, etc. | ||
+ | |||
+ | ==== Troubleshooting: | ||
+ | < | ||
+ | 7426: | ||
+ | 7426: | ||
+ | 7426: | ||
+ | 7426: | ||
+ | 7426: | ||
+ | 7424: | ||
+ | 7424: | ||
+ | 7424: | ||
+ | 7424: | ||
+ | </ | ||
+ | |||
+ | you have to check / | ||