CloudForecastを使っていて、EC2インスタンスに構築したRedisサーバのメトリクスを可視化しています。 CloudForecastには、既存のRedisモジュールがあるのですが、他に取得したいメトリクスがあったので拡張しました。 本家のモジュールを元に追加しただけです。
使い方は簡単で、以下のようにすればすぐ使えます。
- Redisextend.pmを
<CloudForecast Root path>/site-lib/CloudForecast/Dataに置く - CloudForecastの設定を以下のように行う
# host_config/redis.yaml
component_config:
resources:
- redisextend:6379
# server_list.yaml
servers:
- config: redis.yaml
- xxx.xxx.xxx.xxx redis server
取得できるメトリクスは以下のとおりです。
| メトリクス | 説明 |
|---|---|
| Keys | キーの数。infoコマンドのdb0:keys=<Keys>から取得 |
| Total Command | 処理されたコマンド総数。infoコマンドのtotal_commands_processedから取得 |
| Get Command | getがつく、すべてのコマンド総数。info commandstatsから算出 |
| Set Command | setがつく、すべてのコマンド総数。info commandstatsから算出 |
| Del Command | delがつく、すべてのコマンド総数。info commandstatsから算出 |
| Connections(Received) | Redisサーバが受けつけたコネクション総数。infoコマンドのtotal_connections_receivedから取得 |
| Connections(Clients) | クライアントからのコネクション数。infoコマンドのconnected_clientsから取得 |
| Connections(Slaves) | スレーブからのコネクション数。infoコマンドのconnected_slavesから取得 |
| Memory Usage(Used) | Redisサーバに割り当てられたメモリ容量。infoコマンドのused_memoryから取得 |
| CacheHits | 検索に成功したキー数。infoコマンドのkeyspace_hitsから取得 |
| CacheMisses | 検索に失敗したキー数。infoコマンドのkeyspace_missesから取得 |
| Evicted Keys | maxmemoryの制限のため排除されたキーの数。infoコマンドのevicted_keysから取得 |
| Fragmentation Ratio | フラグメンテーション率。infoコマンドのmem_fragmentation_ratioから取得 |
| Pub/Sub Channels | Pub/Subで通知を送った数。infoコマンドのpubsub_channelsから取得 |
| Slowlog | スローログの数。slowlog lenコマンドから取得 |