In Pandora FMS, the Web Server works in a separate server, the Network server. This system operates on the principle of web transaction, where each completed transaction against one or more WEB pages is defined by one or more consecutive steps, which must be completed successfully in order to consider the transaction as successfully completed.
Pandora FMS では、ウェブサーバは ネットワークサーバ 内で動作します。このシステムは Web トランザクション の原理に基づいて動作します。つまり、1 つ以上の Web ページに対する各トランザクションは、1 つ以上の連続したステップによって定義され、トランザクションが正常に完了したとみなされるには、これらのステップが正常に完了している必要があります。
The Network Server is enabled by default. Depending on the number of requests you may have to increase the number of threads and the default timeout:
ネットワークサーバはデフォルトで有効になっています。リクエスト数に応じて、スレッド数とデフォルトのタイムアウト値を増やす必要がある場合があります。
web_threads 1 web_timeout 60 # Use curl or LWP web_engine curl
Pandora FMS has protection against CSRF and when debugging web checks you could get this message:
Cannot verify the origin of the request
Take into account this protection to consider the use of “WUX monitoring”.
Pandora FMS には CSRF に対する保護機能があり、Web チェックをデバッグするときに次のメッセージが表示される場合があります:
Cannot verify the origin of the request
この保護機能を考慮して、“WUX モニタリング” の使用を検討してください。
To remotely monitor a web page, once the agent has been created, click on the top tab of the modules (Modules). In there, select Create a new web module and click Create:
ウェブページをリモート監視するには、エージェントを作成したら、モジュールのトップタブ(モジュール(Modules))をクリックします。そこで、ウェブモジュールの新規作成(Create a new web module)を選択し、作成(Create)をクリックします。
Select the type of WEB check:
ウェブチェックのタイプを選択します:
OK ) or 0 ( CRITICAL ) as a result of checking the whole transaction. If there are several attempts, but at least one of them fails, the test as a whole is considered to fail as well. Precisely, the number of attempts is sometimes used to avoid false positives, for that purpose use the retries field in advanced fields.web_engine curl configuration token, HTTP headers may be returned.web_engine curl の設定トークンで curl ツールの利用を有効化すると、HTTPヘッダーを返すことができます。
Web checks: This essential field defines the WEB check to be performed. It is defined in one or more steps, or simple requests. The checks start with the task_begin tag and end with the task_end tag.
ウェブチェック: この必須フィールドは、実行するウェブチェックを定義します。これは、1つ以上のステップ、または単純なリクエストで定義されます。チェックは task_begin タグで始まり、task_end タグで終了します。
Several additional variables are available for form testing:
フォームのテストには、いくつかの追加変数を使用できます。
簡単なトランザクションの例を以下に示します。
task_begin head http://apache.org/ task_end
コマンドを追加した別の例:
task_begin get http://apache.org/ cookie 0 resource 0 check_string Apache Software Foundation task_end
この基本的な例では、ウェブページに文字列があるかどうかをチェックしています。これは変数 check_string があるためです。 この変数では、HTML 自体をチェックすることはできません。テキストのサブストリングのみを検索します。 私たちは、Webサイト <http://apache.org> で “Apache Software Foundation” を探しています。 その文字列が存在する場合、チェックは OK を返します(サーバーの応答を確認するリモート HTTP モジュールの場合)
文字列が Web ページに存在しないことを確認するには、'check_not_string' を利用できます。
check_not_string Section 3
In some cases of domain redirection, checks may not work. One way to solve this is to modify the module pointing to the final domain, e.g. curl -L.
ドメインリダイレクトの場合、チェックが機能しないことがあります。これを解決する一つの方法は、最終的なドメインを指すようにモジュールを変更することです。例: curl -L
To check the response time or latency of a web page, select the module type Remote HTTP module to check latency. Example:
ウェブの応答時間をチェックしたい場合は、モジュールタイプ Remote HTTP module to check latency を選択します。例:
task_begin get https://pandorafms.com task_end
resource 1 must be added in a line before task_end.task_end の前の行に resource 1 を追加する必要があります。The web download time is not the time it takes to display a website in a browser, as this is usually dependent on the JavaScript load time.
ウェブサイトのダウンロード時間は、ブラウザで Web サイトを表示するのにかかる時間ではありません。通常、これはJavaScriptの読み込み時間に依存し、JavaScriptをダウンロードしますが、実行しません。
A form check is much more complex than simply checking text on a web page. In order to perform this type of check, you must have the necessary credentials. In addition, you need to go to the page and get the HTML code to get the variable names, and then you need to have minimal knowledge of HTML to enter the query for the Network Server.
フォームチェックは、Webページ上のテキストを単純にチェックするよりもはるかに複雑です。この種のチェックを実行するには、必要な認証情報が必要です。さらに、ページにアクセスしてHTMLコードを取得し、変数名を取得する必要があります。さらに、ネットワークサーバへのクエリを入力するには、最低限のHTMLの知識が必要です。
The practical method to design a WEB transactional test with several steps is to test them one by one in debugging mode.
複数のステップを含む WEB トランザクションテストを設計する実用的な方法は、デバッグモードでステップを 1 つずつテストすることです。
Pandora コンソールのログイン URL が以下であると仮定します。
http://192.168.70.116/pandora_console/
HTML コードを確認すると、ログインフォームの変数は次の通りです。
nick> ユーザ名pass> パスワード
フォームの認証を通すためには、変数 variable_name および variable_value の両方が必要です。Pandora FMS コンソールのデフォルトは、admin および pandora です。
最初のステップはフォームへのアクセスです。次に、ユーザとパスワードを送り認証します。(認証の成功を 2つ目のステップで確認します)
task_begin post http://192.168.70.116/pandora_console/index.php?login=1 variable_name nick variable_value admin variable_name pass variable_value pandora cookie 1 resource 1 task_end
上記の設定で、ウェブページにアクセスし認証することができます。これにより、認証した状態でのウェブページ上の何らかのチェックを実行できます。cookie 1 トークンを使用して、前の手順で取得した cookie の永続性を維持します。 それらがなければ、セッションを再現することはできません。
2つ目のステップでは、ユーザーの詳細ページにアクセスし電話番号を探します。ユーザ “admin” のデフォルトは、555-555-555 です。 コンソールに正しくログインできているかどうかがわかります。
task_begin get http://192.168.70.116/pandora_console/index.php?sec=workspace&sec2=operation/users/user_edit cookie 1 resource 1 check_string 555-555-5555 task_end
最後にコンソールからログアウトし、ログアウトメッセージを探します。
task_begin get http://192.168.70.116/pandora_console/index.php?bye=bye cookie 1 resource 1 check_string Logged out task_end
To check the server status code of a website, select the type of module Remote HTTP module to check server status code:
ウェブサイトのサーバステータスコードを確認するには、モジュールの種類を選択します Remote HTTP module to check server status code:
task_begin head https://pandorafms.com task_end
head parameter to obtain the status code.curl must be typed in.head パラメータを使用することが重要です。curl と入力する必要があります。
Some pages may require simple HTTP authentication. It is generally used as a quick check, a minimal security greeting that allows access to more advanced security checks (encryption, data persistence, etc.).
一部のページでは、シンプルなHTTP認証が必要となる場合があります。これは通常、より高度なセキュリティチェック(暗号化、データの永続化など)へのアクセスを可能にする、最低限のセキュリティチェックとして使用されます。
http_auth_pass is not supported.http_auth_pass に指定するパスワードではクォーテーションには対応していません。 ' の利用は避けてください。
Pandora FMS と Goliat webチェックにて、REST APIを監視することができます。ただし、SOAP や XML-RPC を用いた API は監視できません。
例えば、動作しているときに数値(0からn)で返すような特定の Web API を監視したい場合、次のようなコードで、Pandora は何も応答が無い場合に障害と認識します。
task_begin get http://artica.es/integria/include/api.php?user=my_user&pass=my_pass&op=get_stats&ms=opened,,1 check_string \n[0-9]+ task_end
実際の応答は次の通りです。
HTTP/1.1 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: close Date: Mon, 13 May 2013 15:39:27 GMT Pragma: no-cache Server: Apache Vary: Accept-Encoding Content-Type: text/html Expires: Thu, 19 Nov 1981 08:52:00 GMT Client-Date: Mon, 13 May 2013 15:39:27 GMT Client-Peer: 64.90.57.215:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Set-Cookie: a81d4c5e530ad73e256b7729246d3d2c=pcasWqI6pZzT2x2AuWo602; path=/ 0
正規表現で出力を確認することにより、全体が正しく動作しているかを確認できます。より複雑な出力の場合は、それに合わせた正規表現を用います。データ部分だけでなく、応答内容全体をチェックすることに注意してください。そのため、HTTP ヘッダーにもマッチさせることができます。
別の例:
task_begin get https://swapi.dev/api/planets/1/ get_content Tatooine task_end
この場合、モジュールが監視を実行できるようにするデータのタイプは、'Remote HTTP module to retrieve string data (web_content_string)' である必要があります。
task_begin get https://pokeapi.co/api/v2/pokemon/ditto/ get_content imposter task_end
上記のモジュールと同様に、モジュールが正しく機能するには、定義されたデータのタイプが Remote HTTP module to retrieve string data (web_content_string)' である必要があります。
get_content_advanced でモジュールを作成することもできます。
task_begin get https://api.hillbillysoftware.com/Awards/ByYear/1990 get_content_advanced "Nominee":"([A-Za-z]]+)","Year":"1990" task_end
この呼び出しは以下を返します。
Pandora FMS は、次のように結果を表示します。
header オプションで、HTTP ヘッダのカスタマイズしたり追加したりできます。たとえば、Host HTTP ヘッダーを変更するには次のようにします。
task_begin get http://192.168.1.5/index.php header Host 192.168.1.1 task_end
ウェブチェックをデバッグしたい場合は、debug <ログファイル> オプションを追加します。ログファイル.req および ログファイル.res というファイルが作成され、HTTP リクエストと応答が記録されます。たとえば次のようにします。
task_begin get http://192.168.1.5/index.php debug /tmp/request.log task_end
LWP は、複数スレッドで HTTPS リクエストを実行するとクラッシュすることがあります(OpenSSL の制約による)。代替としては curl ツール を利用することです。この問題を解決するためには、/etc/pandora/pandora_server.conf を編集し、次の行を加えます。
web_engine curl
Pandora FMS サーバを再起動すると、ウェブチェックに LWP の代わりに Curl バイナリが利用されます。
In addition to the feature offered by PFMS Web server, there is another way to perform transactional monitoring: the WEB User Experience Monitoring (WUX).
PFMS ウェブサーバが提供する機能に加えて、トランザクション監視を実行する別の方法があります: WEB ユーザエクスペリエンス監視 (WUX)。
ウェブチェックは、プロキシ経由でも行うことができます。プロキシを設定するには、拡張オプション(Advanced options) をクリックすると表示される、プロキシURL(Proxy URL) フィールドにプロキシの URL を設定する必要があります。
例えば、URL は次のようになります。
http://proxy.domain.com:8080
認証が必要なプロキシの場合は、次のように my-user にユーザ名、my_pwd にパスワードを指定します。
http://my_user:my_pwd@proxy.domain.com:8080
Sometimes monitoring does not consist of finding out whether a specific Web site is working or how long it takes, but to get a real time value, such as the total number of modules registered in the same PFMS server through the API. For this example a module called Remote HTTP module to retrieve numeric data will be used with the appropriate regular expression:
特定の Web サイトが稼動しているか、どれくらい時間がかかっているかを知りたいわけではなく、API を通してPandora FMS サーバに登録されたモジュール数などのコンテンツの内容を確認したい場合もあります。そのためには、適切な正規表現で Remote HTTP module to retrieve numeric data モジュールを利用します。
task_begin get http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=internal_API&pass=1234&op=get&op2=total_modules&id=0 get_content \d+ task_end
出力は次のようになります。
It is also possible to specify a more complex regular expression for collecting data from more complex HTTP responses with the get_content_advanced configuration token. In this didactic example, the year is obtained in the footer of Pandora FMS official documentation (and stored in a string data type, Remote HTTP module to retrieve string data):
また、より複雑な HTTP 応答からのデータを収集するための正規表現を設定トークン get_content_advanced で指定することもできます。この実践的な例では、Pandora FMS 公式ドキュメントのフッターから年を取得します(また、文字列データタイプ Remote HTTP module to retrieve string data で保存します:
task_begin get https://pandorafms.com/manual/ get_content_advanced \(c\) ([\d]+) Pandora FMS\(tm\) </span> task_end
Note that the inverse interval has been used: if a string other than 2022 is received, the module will go into critical.
しきい値の反転が使用されていることに注意してください。2022 以外の文字列を受信すると、モジュールは障害状態になります。
get_content_advanced must be enclosed in brackets.\.get_content_advanced に定義する正規表現は、カッコでくくらなければいけません。\ を使用して文字をエスケープする必要があります。To configure the thresholds that will trigger warning or critical status, use the module configuration to verify that the received string matches what is expected.
警告または障害状態のしきい値を設定するには、モジュールの設定を使用して、受信した文字列が期待どおりのものであることを確認します。
拡張プロパティのフィールドは他のタイプのモジュールのフィールドと似ていますが、WEB チェックではいくつかの異なるフィールドがあります。
タイムアウト(Timeout)
これはリクエストのタイムアウトです。この時間を超えるとリクエストは破棄されます。
エージェントブラウザID(Agent browser id)
これは、特定のページが一部の Web ブラウザのみを受け入れる場合に使用する Web ブラウザの識別子です。(詳細は、https://www.zytrax.com/tech/web/browser_ids.htm を参照してください)
リクエスト(Requests)
Pandora FMS は、このパラメータで示された回数だけチェックを繰り返します。 チェックの 1つが失敗した場合、障害とみなされます。モジュール内のチェックの数に応じて、一定数のページが取得されます。 つまり、モジュールが 3つのチェックで構成されている場合は、3ページがダウンロードされ、リクエストフィールドに値が設定されている場合は、ダウンロード数はその数を掛け合わせた数になります。 モジュールが処理を完了するのにかかる合計時間を把握するには、これを覚えておくことが重要です。
リトライ(Retries)
成功するまで リクエスト(Request) を実行する数です。例:
Goliat は HTTP と HTTPS の両方をチェックできます。 HTTPS を利用しているセキュリティで保護されたウェブサイトのチェックを行うには、その URL にプロトコルを組み込むだけです。
task_begin get https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=zpwhtygjntrz&ss=1&scc=1<mpl=default<mplcache=2 cookie 1 resource 0 check_string Google task_end