ZabbixでVarnish監視

Zabbixで簡単なVarnish監視。


今回はUserParameterを使うので監視対象側に設定入れます。

Varnishの統計情報はvarnishstatコマンドで取れます

[root@varnish ~]# varnishstat -1
client_conn         547948146       292.57 Client connections accepted
client_drop                 0         0.00 Connection dropped, no sess/wrk
client_req          781263354       417.15 Client requests received
cache_hit           369642153       197.37 Cache hits
cache_hitpass               0         0.00 Cache hits for pass
cache_miss           41671113        22.25 Cache misses
backend_conn           513266         0.27 Backend conn. success
backend_unhealthy           29         0.00 Backend conn. not attempted
...
[root@varnish ~]# varnishstat -1 -f cache_miss
cache_miss           41673833        22.25 Cache misses

エージェントに設定いれて再起動

[root@varnish ~]# vi /etc/zabbix/zabbix_agentd.conf
...
UserParameter=varnish.stat[*],varnishstat -1 -f $1 | awk '{print $ 2}'
[root@varnish ~]# /etc/init.d/zabbix-agent restart

サーバ側のアイテム設定

こんな感じで設定していきます。

ホスト Template_App_Varnish
説明 キャッシュヒット / Sec
タイプ Zabbixエージェント
キー varnish.stat[cache_hit]
データ型 数値(浮動小数
単位
乗数を使用 使用しない
更新間隔(秒) 300
ヒストリの保存期間(日) 90
トレンドの保存期間(日) 365
ステータス 有効
保存時の計算 差分/時間
アプリケーション Varnish


キャッシュヒット率は計算アイテム使いましょう

ホスト Template_App_Varnish
説明 キャッシュヒット率
タイプ 計算
キー varnish.cache_hit_rate
条件式 last("varnish.stat[cache_hit]")/
(last("varnish.stat[cache_hit]")+
last("varnish.stat[cache_miss]"))
データ型 数値(浮動小数
単位 %
乗数を使用 100
更新間隔(秒) 300
ヒストリの保存期間(日) 90
トレンドの保存期間(日) 365
ステータス 有効
保存時の計算 なし
アプリケーション Varnish


これも後日テンプレ公開します。