nemunemu_zzzの日記

備忘録的な何かになればいいな

Zabbix で KEA DHCP のアドレスの払い出し状況を監視する

環境

ubuntu 18.04

Zabbix 4.4

mariadb 15.1

 

KEAが動いているサーバで下記コマンドを実行すると, データベースにアクセスしてvlan 10についての払い出しているIPの数がわかる

$ mysql -u {myuser} -p{mypassword} -n kea -e "select count(subnet_id) from lease4 where subnet_id = 10;" | sed -n 2p

 

これをZabbix agentのリモートコマンドを設定して取得する。

zabbix_agent2.conf

### Option: Plugins.SystemRun.EnableRemoteCommands
# Whether remote commands from Zabbix server are allowed.
# 0 - not allowed
# 1 - allowed
#
# Mandatory: no
# Default:
# Plugins.SystemRun.EnableRemoteCommands=0 <- ここを1にしてコメントアウトを外す

 

設定を読み込むために再起動する

$ sudo systemctl restart zabbix-agent2

 

次にZabbix server のWeb画面にてアイテムを登録する

f:id:nemunemu_zzz:20191210143530p:plain

キーはsystem.runを用いる

commandにIP数を取得するコマンドを記入する