#!/bin/bash

case $1 in
   config)
        cat <<'EOM'
graph_title Container temperature
graph_vlabel temperature
graph_category environment
container_temp.label temperature
container_temp.warning 40
container_temp.critical 45
EOM
        exit 0;;
esac

. /etc/munin/plugins/ticktick.sh

DATA=`curl -s "http://10.0.100.234/statusjsn.js?components=18179&_=1365876572736"`

RC=$?

if [ "$RC" != "0" ] ; then
     echo Could not fetch container temperature: curl returned $RC >&2
     exit -1
fi


tickParse "$DATA"

VAL=``sensor_values[0].values[0][0].v``
MIN=``sensor_values[0].values[0][0].st[0]``
MAX=``sensor_values[0].values[0][0].st[1]``

echo container_temp.value $VAL
