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 Availability of zabbix and create a new Web checks 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}.
All the post variables must be on a single line and concatenated with & symbol. Example string for logging into Zabbix frontend:
name=Admin&password=zabbix&enter=Sign in
If using the macros as in this example, login string becomes:
name={user}&password={password}&enter=Sign in
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, Profile link appears in the upper right corner.
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.
Complete configuration of steps
A complete configuration of web scenario steps should look like this: