【ZabbixServer構築#8】ZabbixデータベースにTimescleDBを設定する

概要

ZabbixデータベースにTimescaleDBを設定します。 TimescaleDBによって、履歴データのテーブルをパーティション管理することで、過去データの削除処理(ハウスキーピング処理)を劇的に軽減できます。 また、データ圧縮によりディスク容量1/10程度まで節約できます。

TimeScaleDBの設定

TimescaleDB拡張を有効にする

# echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u zabbix psql zabbix
WARNING:  
WELCOME TO
 _____ _                               _     ____________  
|_   _(_)                             | |    |  _  \ ___ \ 
  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / 
  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ 
  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
               Running version 2.5.0
For more information on TimescaleDB, please visit the following links:

 1. Getting started: https://docs.timescale.com/timescaledb/latest/getting-started
 2. API reference documentation: https://docs.timescale.com/api/latest
 3. How TimescaleDB is designed: https://docs.timescale.com/timescaledb/latest/overview/core-concepts

Note: TimescaleDB collects anonymous reports to better understand and assist our users.
For more information and how to disable, please see our docs https://docs.timescale.com/timescaledb/latest/how-to-guides/configuration/telemetry.

CREATE EXTENSION

スキーマ設定

# cat /usr/share/doc/zabbix-sql-scripts/postgresql/timescaledb.sql | sudo -u zabbix psql zabbix

確認

管理 → 一般設定 → データの保存期間の設定が以下のようになっていれば完了です。 f:id:infrablogger:20211107160749p:plain