summaryrefslogtreecommitdiff
path: root/datasources/yves_laserjet_tonerstatus.sh
blob: 6b7628ae187c275d11ec42e11216ba5e07d517ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
	)