1
3

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.

NETGEAR アンマネージプラス・スイッチ向けPrometheus Exporter

Posted at

はじめに

NETGEARのスイッチには普通のアンマネージスイッチにVLANなどいくつかの機能を追加したアンマネージプラスというカテゴリがあります。
ただ残念ながらSNMPは追加されていないので、そのままではPrometheusで監視することはできません。
しかし、同社製のProSAFE Plusというユーティリティソフトを使うとポート毎の送受信データ量などが取れるので、同じプロトコルをしゃべるPrometheus Exporterを実装してみました。

ちなみにProSAFE PlusのプロトコルはProSafeLinuxを参考に実装しました。こちらはPython製のコマンドラインツールで、すでに開発停止状態ですが、たいだいの機能は網羅されているようです。

使い方

prosafe_exporter

上記サイトのリリースページからバイナリをダウンロードできます。
Exporter側の設定は待ち受けポート設定だけで、デフォルトのままなら引数不要です。

$ prosafe_exporter --web.listen-address=":9493"

接続するスイッチの設定はSNMP exporterと同様に、Prometheusサーバ側の設定で行います。

prometheus.yml
- job_name: 'prosafe'
  static_configs:
      - targets: ['switch1:eth0', '192.128.0.100:enp1s0'] # 対象スイッチ (形式は 'hostname:NIC名')
  metrics_path: /probe
  relabel_configs:
    - source_labels: [__address__]
      target_label: __param_target
    - source_labels: [__param_target]
      target_label: instance
    - target_label: __address__
      replacement: 127.0.0.1:9493 # prosafe_exporterのhostname:port

少し変わっているのがtargets設定で、hostname:NIC名という形式です。これは「ProSAFE Plusが接続に使うNICはスイッチと同一サブネットになければならない」という制限がある(と思われる)ためです。そのため接続先のホスト名(あるいはIPアドレス)と接続に使うNIC名というペアで指定するようにしています。
スイッチのIPアドレスがわからない場合はProSAFE Plusユーティリティで設定しましょう。

メトリクス

現時点では以下のメトリクスを実装しています。

metric description labels
prosafe_up The last query is successful
prosafe_receive_bytes_total Incoming transfer in bytes port
prosafe_transmit_bytes_total Outgoing transfer in bytes port
prosafe_error_packets_total Transfer error in packets port
prosafe_link_speed Link speed in Mbps port
prosafe_build_info prosafe_exporter Build information version, revision, rustversion

動作確認

以下のスイッチで確認しています。

  • XS708E
  • GS108Ev3
  • GS105Ev2

リンク速度は10Gbpsまで対応していますが、2.5Gbpsや5Gbpsは実機がないので未実装(リンク速度0扱い)です。

1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?