Ad Widget

Collapse

How to monitor a URL from host?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shlomia
    Member
    • Jul 2020
    • 38

    #1

    How to monitor a URL from host?

    Hi, I'm trying to monitor a url from a specific host I have in my zabbix.
    I have a Windows VM I'm monitoring and I would like to add a "check url" item that for example I will monitor http://google.com for the response code.
    I managed to create a HTTP Agent item ( https://www.zabbix.com/documentation...itemtypes/http )
    but it seems like it's monitoring the URL from the zabbix server it self and not from the host I created the item on.
    Can you someone put some light on that for me? Thanks
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Couldn't read more than the first paragraph? :- ) The second paragraph says:
    HTTP item check is executed by Zabbix server. However, when hosts are monitored by a Zabbix proxy, HTTP item checks are executed by the proxy.

    Comment

    • shlomia
      Member
      • Jul 2020
      • 38

      #3
      Originally posted by Hamardaban
      Couldn't read more than the first paragraph? :- ) The second paragraph says:
      lol, Thanks :P

      Comment

      • Shafina Loi
        Junior Member
        • Dec 2022
        • 11

        #4
        Hi, so apart from using the three standard Zabbix agent items—web.page.get, web.page.perf, and web.page.regexp—is there any other way to monitor a URL from a Linux host? I'm looking for additional options to track more metrics beyond what's documented in here https://www.zabbix.com/documentation...s/zabbix_agent. Any suggestions on alternative methods or best practices for deeper URL monitoring in Zabbix?

        Comment

        • Shafina Loi
          Junior Member
          • Dec 2022
          • 11

          #5
          Im using system.run to run curl command on the url monitored under my linux host. it works!

          something like this. Depend on what items you require


          system.run["curl -s -H 'Accept-Encoding: gzip' -o /tmp/compressed.gz -w "DNS Lookup: %{time_namelookup}\nTCP Handshake: %{time_connect}\nSSL Handshake: %{time_appconnect}\nTTFB: %{time_starttransfer}\nTotal Load Time: %{time_total}\nResource Load Event Time: %{time_pretransfer}\nDownload Speed: %{speed_download} bytes/sec\nHTTP Code: %{http_code}\nHeader Size: %{size_header} bytes\nEffective URL: %{url_effective}\n" {$URL} && encoded=$(ls -l /tmp/compressed.gz 2>/dev/null | awk '{print $5}') && [ -s /tmp/compressed.gz ] && decoded=$(zcat /tmp/compressed.gz 2>/dev/null | wc -c) || decoded=0 && header=$(curl -s -o /dev/null -D - {$URL} | wc -c) && echo "Encoded Body Size: ${encoded:-0} bytes" && echo "Decoded Body Size: $decoded bytes" && echo "Navigation Transfer Size: $(($header + $decoded)) bytes""]

          Macro: {$URL}

          Comment

          Working...