Code Monkey home page Code Monkey logo

zbx-templates-mstdn's Introduction

zbx-templates-mstdn

Zabbix Templates for Mastodon

Mastodonインスタンスを監視するための、Zabbixテンプレート。 Redis/Sidekiqを監視します。

インストールガイド

Zabbixのインストール

このガイドではZabbixのインストールについては説明しません。Zabbixについては他のガイドをご覧ください。

  • Zabbixサーバは設定済みと仮定しています。Mastodonインスタンスと同一ホストである必要はありません
  • Zabbixエージェントはインストール済みで、Zabbixサーバと連携済みと仮定しています。  - /etc/zabbix に設定ファイルが集約されていると仮定しています。
  • Mastodonはインストール済みで、redisが動作しているホストと仮定しています。redis-cliは動作しているものとします。  - 複数サーバ構成になっている場合、redisが動作しているサーバを対象として作業してください。

Redisの監視

このテンプレートでは、redis-cliの出力を分析します。そのためにまず、redis-cliを定期的に起動し、出力をファイルに保存します。 redis-cliは次のような情報を出力します。

# redis-cli info
# Server
redis_version:3.0.6
redis_git_sha1:00000000
redis_git_dirty:0
:
:

まず、/etc/zabbix/redisディレクトリを作成します。

# mkdir -p /etc/zabbix/redis

ここに、ファイルredis-latency.shを置き、実行ビットを立てます。

# chmod +x redis-latency.sh

次にcronを設定します。redis-cronを/etc/cron.dに設置します。 cronが正しく動作し始めると、/etc/zabbix/redisに2つのファイルredis-inforedis-latencyが作成され、更新されるようになります。

# ls -l
total 12
-rw-r--r-- 1 root root 2056 Jun  6 13:04 redis-info
-rw-r--r-- 1 root root    2 Jun  6 13:04 redis-latency
-rwxr-xr-x 1 root root  207 May  6 17:37 redis-latency.sh

次に/etc/zabbix/zabbix_agentd.dディレクトリに、userparameter_redis.confを設置します。 このファイルはZabbixエージェントが上記のファイルを読み込んでパラメータをZabbixサーバに返すためのスクリプトを定義します。

最後に、ZabbixサーバでTemplate_App_Redis.xmlをインポートし、さらに対象サーバにTemplate App Redisを適用します。 これでRedisの各種パラメータが監視できるようになります。

Sidekiq Statusの監視

Sidekiqは2つのテンプレート、StatusとProcessを使って監視します。まずStatusから説明します。 StatusはSidekiqの処理状態と、キューの状態を表すパラメータを監視します。Sidekiq::Statsをコールして得られる値を整理しています。

まずディレクトリ/etc/cron.dにsidekiq-cronを設置します。 cronは1分おきに、/var/tmp/sidekiq-infoファイルを作成し、更新するようになります。

次に/etc/zabbix/zabbix_agentd.dディレクトリにuserparameter_sidekiq.confを設置します。 このファイルはZabbixエージェントが上記のファイルを読み込んでパラメータをZabbixサーバに返すためのスクリプトを定義します。

最後にZabbixサーバでTemplate_App_Sidekiq_Status.xmlをインポートし、対象サーバにTemplate App Sidekiq Statusを適用します。

もし大規模Mastodonを運用していて、Sidekiqサーバが複数に分かれている場合、Sidekiq Statusは1台のサーバだけを対象にインストールしてください。 Sidekiq::StatsはすべてのSidekiqの状態を一括して返すので、1台のサーバに問い合わせるだけで十分間に合います。

Sidekiq Processの監視

Sidekiq Processはシンプルな監視テンプレートで、sidekiqプロセスが存在しているか否かをチェックします。 ZabbixサーバでTemplate_AppSidekiq_Process.xmlをインポートし、対象サーバにTemplate App Sidekiq Processを適用します。

zbx-templates-mstdn's People

Contributors

ken-washikita avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.