Epson XP-312 ink status script

Submitted by Falken on

The following script outputs the percentage of each ink tank from an Epson XP-312 313 or 315 series WiFi enabled printer.

The output looks like

K:96 C:80 M:12 Y:34

which is perfect for feeding into Cacti or other monitoring systems. Guess I'd best go get some magenta ink !

wget http://192.168.11.5/PRESENTATION/HTML/TOP/PRTINFO.HTML -O PRTINFO.HTML >/dev/null 2>&1

echo -n K\: > /opt/ink-usage
grep Ink_K PRTINFO.HTML | cut -d\' -f6 | xargs expr 2 \* | tr -d '\n' >> /opt/ink-usage

echo -n " C:" >> /opt/ink-usage
grep Ink_C PRTINFO.HTML | cut -d\' -f6 | xargs expr 2 \* | tr -d '\n' >> /opt/ink-usage

echo -n " M:" >> /opt/ink-usage
grep Ink_M PRTINFO.HTML | cut -d\' -f6 | xargs expr 2 \* | tr -d '\n' >> /opt/ink-usage

echo -n " Y:" >> /opt/ink-usage
grep Ink_Y PRTINFO.HTML | cut -d\' -f6 | xargs expr 2 \* >> /opt/ink-usage

rm /tmp/PRTINFO.HTML
Sections