zuntan02のはてなブログ

備忘録的なものです。時々職場の技術者ブログにも転記してますが、メインはこちらで。

【zabbix】supervisorでデーモン化したサービスの監視

zabbix-supervisorでの監視

zuntan02.hateblo.jp
上記で立てた検証環境についてzabbixから監視する

【参照】

https://share.zabbix.com/cat-app/process-managers/zabbix-supervisor
https://github.com/rterzi/zabbix-supervisor

■README.md

zabbix-supervisor
Very simple monitoring of Supervisor with Zabbix Agent

Instructions
Place userparameter_supervisord.conf file into /etc/zabbix/zabbix_agentd.d/ directory and restart Zabbix Agent
Place zabbix file into /etc/sudoers.d/ directory
Import zabbix_supervisor_v3_template.xml template via Zabbix Web
Add hosts to Template App Supervisor template
Tested with: Zabbix Server 3.0.14, Supervisor 3.0, Debian 8 & Ubuntu 16

監視対象サーバで以下を実施する

supervisord監視パラメータ追加

sudo wget https://raw.githubusercontent.com/rterzi/zabbix-supervisor/master/userparameter_supervisord.conf -O /etc/zabbix/zabbix_agentd.d/userparameter_supervisord.conf

zabbixファイルをsudoers.dに配置

sudo wget https://raw.githubusercontent.com/rterzi/zabbix-supervisor/master/zabbix -O /etc/sudoers.d/zabbix

zabbixサーバでzabbix_supervisor_v3_template.xmlをインポート

[設定]-[テンプレート]-[インポート]




監視パラメータのコマンド確認

sudo supervisorctl status|grep -v 'RUNNING'|awk '{print $1":"$2}'

監視対象でプロセスを停止してみる

supervisorctl stop hello

監視パラメータを手でたたいてみる

sudo supervisorctl status|grep -v 'RUNNING'|awk '{print $1":"$2}'

→hello:STOPPED
→Zabbixからもアラートが飛ぶことを確認できた

(そのほか)
■Template App Supervisor
https://github.com/Lelik13a/Zabbix-Supervisor-Check
→3年前のセット。やや古いのと追加モジュールが多いっぽいのでやめた