How to check HTTP response code in zabbix?

Sebbo picture Sebbo · Jul 23, 2015 · Viewed 17.9k times · Source

I have a Zabbix server 2.2 and a few linux hosts with websites. How can I get a notification from Zabbix, if the HTTP(s) response code is not 200?

I've tried those triggers without any success:

    {owncloud:web.test.rspcode[Availability of owncloud,owncloud availability].last(,10)}#200

    {owncloud:web.test.error[Availability of owncloud].count(10,200)}<1

    {owncloud:web.test.error[Availability of owncloud].last(#1,10)}=200

But nothing works. I never got an notification, that the code is not 200 anymore even it was 404, because I have renamed the index.php of owncloud to index2.php

Answer

Stefano picture Stefano · Oct 2, 2018

I configured the Application and the we the Web Scenario as followed: if you have already configured the host go to step 1

1) Select the host by Configuration-> Host groups -> select host (example server 1)

enter image description here

2) Go to Config > Hosts > [Host Created Above] > Applications and click on Create Application

enter image description here

3) Now you have to create the Web scenario with the status code check, in my case I checked status code 200. So go to Configuration > Hosts > [Host Created Above] > Web Scenarios and click on Create Web Scenario .

Remark: you have to select the previous application created at the step 2

enter image description here

4) After that without click on Add button go to Steps window and you have to configure the host and parameters for the chek. After that click on Add. In my cas e check the status code 200 response for the HTTP request.

enter image description here