/arduino-webserver-temperature-sensor

Arduino web server using an Ethernet Shield and 1-Wire temperature sensor to output XML, JSON, JSONP or Prometheus (prom format) response.

Primary LanguagePostScript

Arduino Webserver Temperature Sensor

Arduino web server using an Ethernet Shield and 1-Wire temperature sensor to output XML, JSON, JSONP or Prometheus (prom format) response.

XML

XML
<?xml version=\"1.0\"?>
<xml>
<temperature>
<celcius>0</celcius>
<fahrenheit>32</fahrenheit>
</temperature>
</xml>
  • Sample XML response with error:
XML
<?xml version=\"1.0\"?>
<xml>
<temperature>
ERROR
</temperature>
</xml>

JSON

{
  "temperature": {
    "celcius": 12.50,
    "fahrenheit": 54.50
  }
}
  • Sample JSON response with error:
{
  "error": "error"
}

JSONP

MyCallback({
  "temperature": {
    "celcius": 12.50,
    "fahrenheit": 54.50
  }
});
  • Sample JSON response with error:
MyCallback({
  "error": "error"
});

Prometheus

http://192.168.2.70/metric

arduino_temperature_probe 20.00

NOTE: Error state will return a HTTP 500.

NOTE: As per Prometheus best practices, only Celcius is returned.

Config for prometheus.yml:

  - job_name: 'External Ambient Temperature Monitor'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.2.70:80']