0
0

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.

PandoraFMS用URL監視プラグインモジュール自作(大したことしてない)

Posted at

こちらのURLを参考にしました。

参考URL内の設定は接続可否のチェックなので、Shellコマンドを以下のように変えて設定。

httpステータスを確認するcurlコマンド
$ curl -I -s https://example.org | head -1 | cut -d" " -f2

要点は以下の通り。

  • HTTPヘッダのみ表示。
  • プログレスメータは表示しない。
  • headコマンドに-1オプションを付けてHTTPヘッダの1行目だけ表示させる。
  • cutコマンドで2つ目のフィールドだけ取得する。

こいつを参考URLのプラグインコマンドプラグインパラメータに分解して組み込みます。

プラグインコマンド
/bin/sh
プラグインパラメータ
 -c 'curl -I -s _field1_ | head -1 | cut -d" " -f2'

これでHTTPステータスが取得できます。
パラメータマクロとして、_field1_にURLがマッピングされます。

モジュールコンポーネント設定は以下の通り。

+ 種類 Generic Numeric
+ 警告状態 最小:最大 400:499
+ 障害状態 最小:最大 500:599

400番台を警告、500番台を障害にしました。
その他設定も可能かもしれませんが、とりあえずやりたいことがこれで事足りるので
これでいいかな、ってな感じです。

簡単にHTTPステータスチェックのモジュール作成ができました。

PandoraFMS、結構楽ですよ。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?