Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:documentation:03_monitoring:06_web_monitoring [2021/06/21 16:19] jimmy.olano [Advanced Transactional Monitoring] Enlaces internos corregidos. |
en:documentation:03_monitoring:06_web_monitoring [2021/11/05 12:05] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Monitoring WEB ====== | ||
- | {{indexmenu_n> | ||
- | |||
- | [[en: | ||
- | |||
- | ===== Classic Web Monitoring ===== | ||
- | |||
- | ==== Introduction ==== | ||
- | In the Enterprise version{{wiki: | ||
- | |||
- | {{ wiki: GoliatLogo 2.jpg?200}} | ||
- | |||
- | This feature comes from an old project of the founder of Pandora FMS: Goliat F.I.S.T. It was an open source project to perform dynamic load audits on web services. You can still find the [[https:// | ||
- | |||
- | In Pandora FMS, it works as an independent server, similar to the [[en: | ||
- | This system operates under the principle of //web transaction//, | ||
- | |||
- | Any failure at any point in the process would result in a checking failure. The complete transaction includes the downloading of all resources (graphics, animations, etc.) that the actual navigation includes. In addition to performing response time and performance checks, it is possible to extract values from the web pages and then process them. | ||
- | |||
- | Goliat is able to monitor both HTTP and HTTPS in a transparent way for the user, supports session management through cookies, parameter passage, and of course, downloading the resources associated with each page. It also has **important limitations such as the dynamic management of javascript at runtime**. For more complex web transactions, | ||
- | |||
- | ==== Installation and Configuration ==== | ||
- | To be able to use Goliat, [[en: | ||
- | |||
- | webserver 1 | ||
- | |||
- | Depending on the number of requests you want to make, you may have to increase the number of threads and the default timeout: | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | There is an advanced configuration token that will allow you to change the type of library you use under Goliat, LWP or CURL. CURL is used by default, but you can change it at any time: | ||
- | |||
- | web_engine curl | ||
- | |||
- | ==== Creating Web Modules ==== | ||
- | To monitor a web page remotely, once the agent is created, click on the **modules** tab. Then, select **Create a new webserver module** and click on **Create**: | ||
- | |||
- | {{ wiki: | ||
- | |||
- | Click on **Create** to see a form where to fill out the appropriate fields to monitor a web page. | ||
- | |||
- | {{ wiki: | ||
- | |||
- | There are several check types to choose from: | ||
- | |||
- | * **Remote HTTP module to check latency**: It obtains the total time that elapses from the first request until the last one is checked (in a WEB test there are one or more intermediate requests that complete the transaction). If it is defined in the check definition that the transaction must be carried out more than once, the average time of each request is used. | ||
- | |||
- | * **Remote HTTP module to check server response**: It shows the values 1 ( '' | ||
- | |||
- | * **Remote HTTP module to retrieve numeric data**: It retrieves a numeric value from an HTTP response using a regular expression. | ||
- | |||
- | * **Remote HTTP module to retrieve string data**: It retrieves a string from an HTTP response using a regular expression. | ||
- | |||
- | * **Remote HTTP module to check server status code:**: By means of the **curl** tool properly enabled with the '' | ||
- | |||
- | **Web Checks**: This essential field defines the WEB check to be performed. This is defined in one or more steps, or simple requests. These simple requests must be written in a special format in the Web checks field. Checks start with the tab page '' | ||
- | |||
- | A complete example of a simple transaction would be the following: | ||
- | |||
- | < | ||
- | | ||
- | head http:// | ||
- | | ||
- | </ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | After saving, you can force the execution of the Module and visualize its result: | ||
- | |||
- | {{ wiki: | ||
- | |||
- | Another example with more commands: | ||
- | |||
- | < | ||
- | | ||
- | get http:// | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | In this basic example, it is being checked whether there is a string in a web page. To that end, there is the variable '' | ||
- | |||
- | To ensure that a string does not exist on a web page, you can use the variable '' | ||
- | |||
- | check_not_string Section 3 | ||
- | |||
- | The arguments taken by the '' | ||
- | |||
- | There are several extra variables to check forms: | ||
- | |||
- | * **resource (1 or 0)**: It downloads all the web resources (images, videos, etc). | ||
- | * **cookie (1 or 0)**: It keeps a cookie or an open session for later checks. | ||
- | * **variable_name**: | ||
- | * **variable_value**: | ||
- | |||
- | By using these variables, it is possible to send data to forms and check whether they work appropriately or not. | ||
- | |||
- | <WRAP center round important 60%> | ||
- | In some specific cases, the domain redirection may **not** work. To solve this problem, create a module that uses the final domain address after all redirections are completed. | ||
- | </ | ||
- | |||
- | For the previous case, the **curl** command has the parameter '' | ||
- | |||
- | {{ wiki: | ||
- | |||
- | At the moment of creating the Module, it is inactive and you will be able to make use of it after you have done the first check, which you can force to run to save time. | ||
- | |||
- | When you modify this Module, click on the **Debug** button and you can enter debug mode to edit the **Query**: | ||
- | |||
- | {{ wiki: | ||
- | |||
- | You can execute the query that the module has with the button **Execute query** as well as modify and re-execute it with other values until you get the desired result. | ||
- | |||
- | {{ wiki: | ||
- | |||
- | ==== Checking website loading time ==== | ||
- | If you want to check the latency of a website, select the module type named **Remote HTTP module to check latency**. If you want to find out the latency of the < | ||
- | |||
- | < | ||
- | | ||
- | get https:// | ||
- | | ||
- | </ | ||
- | |||
- | Add the '' | ||
- | |||
- | |||
- | <WRAP center round tip 60%> | ||
- | The download time of the website is NOT the time it takes to see a web site in a browser, as this usually depends on the loading time of Javascript, and Goliat downloads the javascript, but does not run it. | ||
- | </ | ||
- | |||
- | ==== Website Checks through a Proxy ==== | ||
- | You can also carry out website checks by using a proxy. To configure the proxy, add the proxy URL in the 'Proxy URL' field which is located under **Advanced options**: | ||
- | |||
- | |||
- | An example of the URL could be: | ||
- | |||
- | http:// | ||
- | |||
- | If the proxy requires an authentication, | ||
- | |||
- | http:// | ||
- | |||
- | {{ wiki: | ||
- | |||
- | ==== Retrieving data from a website ==== | ||
- | 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 Google' | ||
- | |||
- | < | ||
- | | ||
- | get http:// | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | The output will look like this: | ||
- | |||
- | {{ wiki: | ||
- | |||
- | |||
- | It is also possible to specify a more complex regular expression for collecting data from more complex HTTP responses with the '' | ||
- | |||
- | < | ||
- | | ||
- | get http:// | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | The part of the regular expression defined in '' | ||
- | </ | ||
- | |||
- | 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. | ||
- | |||
- | ==== Website form checking ==== | ||
- | Web form checking is much more complex than simply checking a text on a website. This example check will use Pandora FMS Console, log in, and verify that it has been able to do it. It verifies a text in the **workspace** section where it shows the data of the user who has logged in. If it is a default console, the admin user contains the description "Admin Pandora" | ||
- | |||
- | To be able to perform this type of checks, you must have the necessary credentials. In addition, go to the page and get the HTML code to be able to see the names of the variables. Then, it is necessary to have a basic knowledge of HTML to understand how Goliat works. | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | The ideal procedure when designing a WEB transactional test with several steps is to test it step by step, in case something was missed in one of the steps. | ||
- | </ | ||
- | |||
- | The example Console is: | ||
- | |||
- | http:// | ||
- | |||
- | Analyzing the HTML code, it is observed that the variables of the login form are: | ||
- | |||
- | * '' | ||
- | * '' | ||
- | |||
- | The variables '' | ||
- | |||
- | Firstly, access the form, send the user and password and authenticate (determining the success of that authentication will be seen in the following step). | ||
- | |||
- | < | ||
- | | ||
- | post http:// | ||
- | login =1 | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | The //token// '' | ||
- | |||
- | < | ||
- | | ||
- | get http:// | ||
- | sec = workspace& | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | And finally, log out from the Console and look for the logout message '' | ||
- | |||
- | < | ||
- | | ||
- | get http:// | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | Total //script// check: | ||
- | |||
- | {{ wiki: | ||
- | |||
- | ==== WEB query performance ==== | ||
- | The fields of the advanced properties are similar to those of other types of modules, although there are some different and specific fields of WEB checks: | ||
- | |||
- | **Timeout** | ||
- | |||
- | This is the expiry time during the request. If it is exceeded, the request for verification will be discarded. | ||
- | |||
- | **Agent browser id** | ||
- | |||
- | This is the web browser identifier to be used, since certain pages only accept some web browsers (see https:// | ||
- | |||
- | **Requests** | ||
- | |||
- | | ||
- | |||
- | **Retries** | ||
- | |||
- | The number of times it does a **Request** until getting a successful result. Examples: | ||
- | * retries = 2 and Requests = 1: If the first test fails, it will retry once more and if the second one works, the check is valid. | ||
- | * Retries = 1 and Requests = 2: It performs two checks, but if any of them fails, it will result in a failed check. | ||
- | |||
- | ==== Simple HTTP Authentication ==== | ||
- | |||
- | Some websites might require [[wp> | ||
- | |||
- | {{: | ||
- | |||
- | It can be configured in the advanced check options (or directly in the WEB task definition) with the following configuration tokens: | ||
- | |||
- | **Check type** | ||
- | |||
- | HTTP server check type. ;http auth (login): HTTP user. ;http auth (password): Password. **Proxy auth realm** | ||
- | |||
- | Auth realm' | ||
- | |||
- | Proxy server url. ;Proxy auth (login): Proxy connection user. ;Proxy auth (pass): Proxy connection password. | ||
- | |||
- | Full example: | ||
- | < | ||
- | |||
- | | ||
- | get http:// | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | |||
- | ==== Webservice and API Monitoring ==== | ||
- | |||
- | With Pandora FMS and Goliat you may [[https:// | ||
- | < | ||
- | |||
- | task_begin | ||
- | get http:// | ||
- | check_string \n[0-9]+ | ||
- | task_end | ||
- | |||
- | </ | ||
- | |||
- | This will return a reply similar to this one: | ||
- | |||
- | < | ||
- | HTTP/1.1 200 OK | ||
- | Cache-Control: | ||
- | Connection: close | ||
- | Date: Mon, 13 May 2013 15:39:27 GMT | ||
- | Pragma: no-cache | ||
- | Server: Apache | ||
- | Vary: Accept-Encoding | ||
- | Content-Type: | ||
- | Expires: Thu, 19 Nov 1981 08:52:00 GMT | ||
- | Client-Date: | ||
- | Client-Peer: | ||
- | Client-Response-Num: | ||
- | Client-Transfer-Encoding: | ||
- | Set-Cookie: a81d4c5e530ad73e256b7729246d3d2c=pcasWqI6pZzT2x2AuWo602; | ||
- | |||
- | 0 | ||
- | |||
- | </ | ||
- | |||
- | By checking the output with a regular expression, you may verify that everything works properly. For more complex answers, use other regular expressions accordingly. | ||
- | |||
- | More examples: | ||
- | |||
- | < | ||
- | | ||
- | get https:// | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | In this case, the module created to show data must be **Remote HTTP module to retrieve string data (web_content_string)**. | ||
- | < | ||
- | | ||
- | get https:// | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | Just like the previous module, the type of data defined needs to be ' | ||
- | |||
- | You may perform calls with **get_content_advanced**: | ||
- | < | ||
- | task_begin | ||
- | get https:// | ||
- | get_content_advanced " | ||
- | task_end | ||
- | |||
- | </ | ||
- | |||
- | Result: | ||
- | |||
- | {{ : | ||
- | |||
- | In Pandora FMS the result would be displayed as follows: | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> It is important to properly define the capture groups within the parentheses so that the call is executed correctly. </ | ||
- | |||
- | <WRAP center round important 60%> When creating API calls, it is important to know if the destination API has the right permissions to allow calls. </ | ||
- | |||
- | |||
- | ==== HTTPS Monitoring ==== | ||
- | |||
- | Goliat is able to check both HTTP and HTTPS. To carry out checks on secured websites which use HTTPS, incorporate the protocol into its URL, e.g.: | ||
- | |||
- | < | ||
- | task_begin | ||
- | get https:// | ||
- | cookie 1 | ||
- | resource 0 | ||
- | check_string Google | ||
- | task_end | ||
- | |||
- | </ | ||
- | |||
- | |||
- | ==== Advanced Options ==== | ||
- | === Modifying HTTP Headers === | ||
- | |||
- | With the //header// option, you are able to modify HTTP headers or create your own. The example below changes the //Host// HTTP header: | ||
- | < | ||
- | | ||
- | get http:// | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | |||
- | === Debugging Web checks === | ||
- | |||
- | If you want to debug Web checks, add the '' | ||
- | < | ||
- | | ||
- | get http:// | ||
- | debug / | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | |||
- | === Using CURL instead of LWP === | ||
- | |||
- | LWP library sometimes crashes when multiple threads issue HTTPS requests simultaneously (due to an OpenSSL constraint). The alternative is to use the [[https:// | ||
- | < | ||
- | |||
- | web_engine curl | ||
- | |||
- | </ | ||
- | |||
- | Restart Pandora FMS Server, and the CURL binary will be used to perform web checks instead of LWP. | ||
- | |||
- | |||
- | ===== Advanced Transactional Monitoring ===== | ||
- | |||
- | In addition to the feature offered by Goliath, there are other ways to carry out web transactional monitoring. | ||
- | |||
- | * [[: | ||
- | * In a centralized way (WUX) | ||
- | |||
- | [[: | ||
- | |||