This section presents a step-by-step real-life example of how web monitoring can be used.
Let's use Zabbix Web monitoring to monitor the web interface of Zabbix. We want to know if it is available, provides the right content and how quickly it works. To do that we also must log in with our user name and password.
Add a new web scenario.
We will add a scenario to monitor the web interface of Zabbix. The scenario will execute a number of steps.
Go to Configuration → Hosts, pick a host and click on Web in the row of that host. Then click on Create scenario.
In the new scenario form we will name the scenario as Zabbix frontend and create a new Zabbix frontend application for it.
Note that we will also create two macros, {user} and {password}.
Define steps for the scenario.
Click on Add button in the Steps tab to add individual steps.
Web scenario step 1
We start by checking that the first page responds correctly, returns with HTTP response code 200 and contains text "Zabbix SIA".
When done configuring the step, click on Add.
Web scenario step 2
We continue by logging in to the Zabbix frontend, and we do so by reusing the macros (variables) we defined on the scenario level, {user} and {password}.
Note that Zabbix frontend uses JavaScript redirect when logging in, thus first we must log in, and only in further steps we may check for logged-in features. Additionally, the login step must use full URL to index.php file.
All the post variables must be on a single line and concatenated with & symbol. Example string for logging into Zabbix frontend:
If using the macros as in this example, login string becomes:
Take note also of how we are getting the content of {sid}
variable (session ID), which will be required in step 4.
Web scenario step 3
Being logged in, we should now verify the fact. To do so, we check for a string that is only visible when logged in - for example, Administration.
Web scenario step 4
Now that we have verified that frontend is accessible and we can log in and retrieve logged-in content, we should also log out - otherwise Zabbix database will become polluted with lots and lots of open session records.
Web scenario step 5
We can also check that we have logged out by looking for the Username string.
Complete configuration of steps
A complete configuration of web scenario steps should look like this:
Save the finished web monitoring scenario.
The scenario will appear in Monitoring → Web:
Click on the scenario name to see more detailed statistics: