summaryrefslogtreecommitdiff
path: root/datasources/yves_laserjet_tonerstatus.sh
diff options
context:
space:
mode:
Diffstat (limited to 'datasources/yves_laserjet_tonerstatus.sh')
-rwxr-xr-xdatasources/yves_laserjet_tonerstatus.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/datasources/yves_laserjet_tonerstatus.sh b/datasources/yves_laserjet_tonerstatus.sh
new file mode 100755
index 0000000..6b7628a
--- /dev/null
+++ b/datasources/yves_laserjet_tonerstatus.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+name=yves.laserjet.tonerstatus
+type=int
+
+curl -s "http://10.1.0.10/hp/device/info_suppliesStatus.html" |
+ sed -ne 's/.*>\([0-9]*\)%<.*/\1/p' |
+ (
+ read value
+ curl -s -i -H "Accept: application/json" \
+ -X PUT "http://localhost:8000/sensor/${name}" \
+ -d "value=${value}&type=${type}" |
+ grep '"error": null' >/dev/null
+ )