Ad Widget

Collapse

How to read data from URL?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmaurin
    Junior Member
    • Apr 2013
    • 20

    #1

    How to read data from URL?

    Hi!
    I have one Arduino sensor that's working by acessing one URL. In this URL, I can return anything that I want. In this Arduino, there's an temperature and Humidity sensor. I need to monitor both. I can split those cvalues by URL (/temp and /humidity, for example) or display both on the same URL.
    My question is: how can I make zabbix to get these values and store and make graphics? I would like to avoid external scripts, like PHP or Python to make this Web call and return only value. Is possible to zabbix directly call this URL and store value? Also, how should be this values displayed? It's better to simple show value (like '30') or JSON encoded?
  • wdijkerman
    Junior Member
    • Jan 2015
    • 18

    #2
    If you don't want to create an python script, is executing commands fine?
    Like:
    Code:
    curl <url>/temp | grep '<grep_json_key' | awk -F '"' '{print $1}'
    Where $1 is the column to print.

    But, if the page is printing JSON, it might be easier to write an simple python script. This can be done with say 5 - 10 lines and works very good with json data.

    Comment

    • jmaurin
      Junior Member
      • Apr 2013
      • 20

      #3
      Originally posted by wdijkerman
      If you don't want to create an python script, is executing commands fine?
      Like:
      Code:
      curl <url>/temp | grep '<grep_json_key' | awk -F '"' '{print $1}'
      Where $1 is the column to print.

      But, if the page is printing JSON, it might be easier to write an simple python script. This can be done with say 5 - 10 lines and works very good with json data.
      Actually, I can display wathever I want. I'm printing just the resulting number, so it's easier to use CURL, no params needed. The problem is: there's no agent on host. So, How can I execute this command? To execute in my Zabbix Server, I must 'put' this item in my Zabbix Server Host......but I want to create an specific host for this sensor.

      Comment

      • coreychristian
        Senior Member
        Zabbix Certified Specialist
        • Jun 2012
        • 159

        #4
        You should be able to do this as an external check item within zabbix.

        Essentially you add the external item to a manually configured host, then the script runs from the zabbix server but automatically places the values to the item on the host.

        Comment

        Working...