• Gallery
  • Hot Cold Ground Blues Band
  • Links
  • Music
  • Nurburgring 2010 Blog
  • Support
« The Times Tables Video (2 to 6)… | Home | Walking round Norwich's City Wa… »

Querying printer status via SNMP and PHP

Wednesday 18 October 2017 at 10:02 am

Background - my work (a college) migrated to a centralised printing system using about 15 multi-function Samsung printers.  As a support tech I wanted a single view which reported consumables and error statuses so we could see at a glance where supplies are low (only us technicians are allowed to replenish toner & paper).  Samsung do their own client software but I could never get it to work how I wanted.  This is what my page looks like (I've obliterated the name/location info for privacy):

2017-10/webpage.jpg

Here's how I did it...

First I used a program called Frameflow SNMP browser to connect to a printer to find the SNMP OIDs I needed.  This was the tricky bit.  There are hundreds of OIDs, and by trial and error I found the right ones to build my script.  I worked out that paper levels are reported as a figure ouf of 520 (presumably the tray capacity in pages).  When calculated as a percentage they report at 100, 70, 30 and 10%.  Toners are reported out of 30000 and our black high-capacity cartridges are out of 45000.  The PHP in the script calculates these as percentages for reporting.

I had to Google the OIDs because Frameflow reported the names differently to what's needed by PHP SNMPGET, so for example ".iso.org.dod.internet.mgmt.mib-2.43.11.1.1.9.1.1" translates to "1.3.6.1.2.1.43.11.1.1.9.1.1".  You can see there's a pattern.

In summary, the PHP gets a list of IPs, then queries each one for name/location/serial/toner and paper figures and prints this out on a web page.  Some fancy JQuery stuff (I don't pretend to know anything about this, I roped in our web developer for that) makes the nice progress bars.  The web page auto-refreshes every 60 seconds, and there's a 'last updated' timestamp and a countdown to the next update.  The background colour of each machine changes from green to amber to red depending on the printer's reported status.   I run it on a dedicated old laptop, running it in IE's kiosk mode and starting/stopping it on a scheduled task.  It fires up at 8am, then goes to sleep at 5pm.

I can't seem to display code very effectively on this website, so I've printed the code pages to pdfs if you want to download:

PHP main page
CSS stylesheet
JS countdown script

 webpage  frameflow  ink  paper 

EDIT Jan 2019 - Our Samsung contract has ended and the printers are being replaced with HP PageWide machines.  I can confirm that this information works with minor tweaking for the new HPs.

XML: RSS FeedXML: Atom FeedPowered by PivotX - 2.3.11

Site Pages

    Pages
    • Gallery
    • Links
    • Music
    • Nurburgring 2010 Blog
    • Support
    • Hot Cold Ground Blues Band

Blog Categories

  • home
  • bikes
  • funny
  • music
  • projects
  • random
  • rants

About

This is the personal website of Daniel Carway.

All characters, scenarios and events are entirely fictitious and should not be confused with real people and situations. Any similarity to your own life is completely your own fault. admin

Links

  • This site built on PivotX
  • PivotX Forum
  • PivotX Documentation
  • PivotX Extensions
  • PivotX Themes

Search

Search for words used in entries and pages on this website