2

I need to configure a Zabbix check which will check access to a certain internet page. The page can return http status 200 (ok) or 500 (internal server error). I want to get a Zabbix notification when ever a 500 status error arises twice, is that possible?

Edit #1: @Tero Kilkanen: This is the error I get when I try to create the trigger:

Incorrect trigger expression. Check expression part starting from "{Mobit engine health check:web.test.rspcode[Check engine,engine health check].count(10,"500 (internal server error)","eq")".

Edit #2: I've created the web scenario as follows: enter image description here And the single step: enter image description here I've created the next trigger: enter image description here And here's the Lastest Data from the Zabbix server: enter image description here But then I have two questions:

1. How can I check that the trigger works if it is not displayed in `Latest Data` in the Zabbix server?
2. How do I edit the trigger to reflect the needed configuration? which is to raise and alert when http status returns `500 Internal server error` twice?

Thanks!

shgnInc
  • 1,804
  • 3
  • 22
  • 29
Itai Ganot
  • 10,644
  • 29
  • 93
  • 146

2 Answers2

4

Yes, that is possible.

First you need to create a web check with instructions at https://www.zabbix.com/documentation/2.0/manual/web_monitoring

Then, after making the test, you get new items, which you can use in a trigger. In your case, you want to check the HTTP error code, so the trigger would be like:

{HOST:web.test.error[TESTNAME].count(10,500)}>1

Here, HOST means the host which is configured to make the web check. TESTNAME is the name given to the web check scenario.

The first argument 10 to coint() means that it counts events happening in last ten seconds. The second argument contains the error code to compare against. The trigger launches if there are more than 1 instance of 500 errors in last 10 seconds.

For further information on count syntax, look at https://www.zabbix.com/documentation/2.0/manual/appendix/triggers/functions .

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • Thanks for your answer, how do I create the correct Item as well? – Itai Ganot Jul 15 '14 at 10:51
  • You need to implement a web check, https://www.zabbix.com/documentation/2.0/manual/web_monitoring has good instructions for doing that. After creating the web check, you will have an item `web.test.error`, which is the HTTP status code. – Tero Kilkanen Jul 15 '14 at 11:57
  • But this web check describes a scenario... i need only to access a web page and get it's status code... is that the only way to do it? by creating a scenario? – Itai Ganot Jul 15 '14 at 12:00
  • Yes, you need to create a one-step web check scenario. – Tero Kilkanen Jul 15 '14 at 12:03
  • I updated the answer for completeness. I think you were checking for the wrong value in the web check scenario. – Tero Kilkanen Jul 15 '14 at 14:03
  • Use the trigger in my answer, you have made some other trigger here. You also have configured the step incorrectly, you require `200` status code that indicates the web check works correctly. – Tero Kilkanen Jul 16 '14 at 11:43
  • I just did, and I get this error: Incorrect item key "web.test.error[check engine http status 500,check engine http status,resp]" provided for trigger expression on "HOSTNAME". while unable to save the trigger... – Itai Ganot Jul 16 '14 at 11:49
0

It's possible do it. Create the trigger below:

{HOST:web.test.rspcode[SCENARIO,STEP].diff(200)}

Good luck!

Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • Not a good idea, cause e.g. `301` doesn't mean an error. Most time it's just a desired redirect `http->https` or smth like this – vladkras Oct 13 '16 at 04:58
  • How do you tell to send the alert only after it is returning 500 for a consecutive 5 requests? – zeroweb Dec 19 '17 at 18:06