Skip to content

Instantly share code, notes, and snippets.

@DanielG
Created January 12, 2016 23:53
Show Gist options
  • Save DanielG/abf2d285f6050147a10b to your computer and use it in GitHub Desktop.
Save DanielG/abf2d285f6050147a10b to your computer and use it in GitHub Desktop.
collectd exec plugin
#!/bin/sh
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"
while sleep $INTERVAL; do
v=$(curl -s http://it-syndikat.org/status.txt | awk -vFS=, '{ print $1 }')
if [ x"$v" = x"true" ]; then
VALUE=1
else
VALUE=0
fi
echo "PUTVAL \"$HOSTNAME/exec-isitopen/gauge-isitopen\" interval=$INTERVAL N:$VALUE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment