You are here

Epson XP-312 ink status script

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: 
topical-homopterousif you are reading this, don't click it as it will mark you as a spammer
if you are reading this, don't click it as it will mark you as a spammer