Ad Widget

Collapse

zabbix-agent "web.page.get[]" that returns only the body

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iyuvalk
    Junior Member
    • Feb 2015
    • 4

    #1

    zabbix-agent "web.page.get[]" that returns only the body

    Hi,

    I'm trying to monitor a REST API service of some system here and in order to do that I need to get the value (a number that returns from a call to a given URL) and compare it to a threshold. I tried to use the web.page.get[] command of the zabbix-agent but as it turned out it returns the raw response from the server including all the HTTP headers.

    Is there a way to tell the zabbix agent to return only the response body? I don't want to use system.run[curl ...] or an external command both for security and performance reasons...

    Just to clarify things a bit more - if I run curl with the given URL i simply get the numeric response back.

    T.I.A,
    Yuval.
  • iyuvalk
    Junior Member
    • Feb 2015
    • 4

    #2
    I'll go and answer my own question... Just in case someone else needs it too

    Hi,

    I found that the solution to this issue would be to use web.page.regexp[] instead.

    For example - if your REST service responds to this url 'http://x.y.z:8080/api/method1' with the following result:
    res:1

    you can use the following syntax in Zabbix:
    web.page.regexp[x.y.z,api/method1,8080,"^res.*)",,\1]

    Such an item will return (from the above query) the value of 1

    Happy Zabbixing...
    Last edited by iyuvalk; 26-01-2017, 11:41. Reason: Accidental smiley...

    Comment

    Working...