4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Buffaloの無線LAN APのCPU使用率をZabbixに記録する

Last updated at Posted at 2018-03-22

環境

  • 無線AP: Buffalo社製 WAPS-APG600H
  • Zabbix 3.4.7

Zabbix設定

外部チェックスクリプト

Zabbixサーバに以下の外部チェックスクリプトを配置し、
chmod +x baffalo_ap_cpuload.shで実行権限を付与。
管理ユーザ名とパスワードは環境に合わせて書き換えてください。

baffalo_ap_cpuload.sh
# !/bin/bash

HOST=$1
USER=(管理ユーザ名)
PASS=(パスワード)

wget --http-user=${USER} --http-password=${PASS} http://${HOST}/cpu_load -O - 2>/dev/null \
 | tr '\n' ' ' | tr ':' ' ' | awk '{print 100 * ($4 - $2) / ($3 - $1)}'
wget --http-user=${USER} --http-password=${PASS} http://${HOST}/logout.html -O - 1>/dev/null 2>&1

このスクリプトでは以下のことをやっている。

  • APのWeb管理画面の「CPUモニター」でajaxで取得されるURL(cpu_load)にwgetでアクセスして取得
  • awkを使って管理画面のJavaScriptと同じ計算でCPU使用率を求める
  • 最後にlogout.htmlにアクセスしてログアウト(これをしないと他の端末からWeb管理画面にアクセスできなくなる)

ちなみに、cpu_loadにアクセスすると、以下のようなテキストが返ってくる。

392992993:6957133
392991917:6957005
392990844:6956976
392989772:6956959
392988697:6956938
392987624:6956920
392986551:6956905
392985477:6956891
392984405:6956873
392983330:6956859
392982256:6956843
392981183:6956823

単位はわからないが、各行のコロンの左側がシステム時刻、右側がCPU使用時間を表していると思われる。

Item登録

Zabbixの管理画面から「Configuration」「Templates」で無線LANのAP用のテンプレートを選択し、「Item」「Create Item」からItemを作成する。

  • Type: External check
  • Key: baffalo_ap_cpuload.sh["{HOST.CONN}"]
  • Type of information: Numeric (float)

image.png

Graph登録

上記で追加したItemを「Create Graph」からGraphにする。

image.png

結果

1時間ほど取得した結果はこんな感じ。

image.png

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?