Step 5 – checking logout

We will check whether there's a string that we only expect to see on the login page. Logging out could have failed invisibly otherwise. Let's add a string to check for in our item:

If everything looks good, click on the Add button at the bottom of the page to save this scenario. We could let the scenario run for a while and discuss some of the step parameters we didn't use:

We could have used a user macro for part or all of the URL—that way, we would only define it once and then reference it in each step. We discussed user macros in Chapter 8, Simplifying Complex Configurations with Templates.

After the scenario has had some time to run, let's go to Monitoring | Web page. Choose Linux servers in the Group drop-down and click on Zabbix frontend in the Name column:

The scenario seems to be running correctly—the login and logout seem to have worked properly. Note that, if it fails for you, the failure could actually be in the previous step. For example, if it fails on Step 3 – checking login, the actual fault is likely to be in Step 2 – logging in, that is, the login failed.

The approach we took, with five steps, was not the simplest one. While it allowed us to split each action into its own steps (and provided nice graphs with five values), we could have used a much simpler approach. To check the login and logout, the simplest approach and the minimum number of steps would have been these:

As an extra exercise, create a new scenario that achieves the same goal in two steps.