Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

Hi,

Its been a while... And sorry for the long post as my first back....,

I'm currently managing the infrastructure for an acute NHS Hospital. I've recently done the infrastructure side for the implementation of an Electronic Patient Record system. I HAD a monitoring solution for the infrastructure (OPsManger from ManageEngine) but have been asked to move off of this as it is proving too expensive (also it's not as easy to work with as you'd hope). Primarily I'm looking to monitor both SNMP directly to (mainly Zebra) printers (and some other medical devices) AND the Print Servers themselves.

So I looked at CheckMK (one of our local NHS trusts have been using this for years.. I say using... they've had it in and are using some basic checks, nothing interesting). It has a Win_printers plugin which reports jobs in the queue of the printers, and error state. The plugin on agent side uses PowerShell.

This plugin was hanging - due to the

Code: Select all

Get-WmiObject win32_printer
(needed for getting the error status) hanging for around 5 minutes when run, this seems to be a limitiation of the command and the no. of printers (300+) on my servers.

So I rewrote it and removed the error check - using this command in PowerShell to get all the data I want:

Code: Select all

Get-CIMInstance Win32_PerfFormattedData_Spooler_PrintQueue | Select Name, Jobs, JobErrors, JobsSpooling, MaxJobsSpooling, TotalJobsPrinted, TotalPagesPrinted  | Sort Name | format-table
Which spits this out:

Code: Select all

Name                          Jobs JobErrors JobsSpooling MaxJobsSpooling TotalJobsPrinted TotalPagesPrinted
----                          ---- --------- ------------ --------------- ---------------- -----------------
_Total                           1         1            0               0                1                 0
AORS16193Q610                    0         0            0               0                0                 0
(but much longer)

But this doesn't work (yet) so I fudged it and removed all but the Jobs Column adding a couple of fake columns in so the server side would continue to work (trying to get this rewritten ATM).

So all's good... except...

This is simple numeric data being generated, and changes over time.. So I want to graph this. If it goes above x for n cycles I want to be alerted (yes I can do this in CheckMK) but NO I can't graph it... I want to see what normal is, and to see which are the most busy queues. I want to see when things started to change..

So I tried Grafana ... but no that doesn't, for some reason, access the counters (I can only use existing checkmk graphs, and rejig them)... Then I tried Zabbix, and ran into the a similar issue... SO ... I'm circling back to Cacti - I'm sure if I can get the data into Cacti it can be graphed.

So... Anybody up for the challenge of getting this working? Is it possible/easy? Is there a link between CheckMK and Cacti?
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by TheWitness »

Well, I wrote the WMI plugin for just that, but if you are using a Windows server to monitor, you will have to fix the COM integration to be able to pull the data back. I was working with one user for this, and I think he got it fixed, but did not provide a pull request to commit his fixes. The WMI plugin will polls the various query types and store it into a Cacti table that you can then generate graphs from. I gave up using Windows servers for my Cacti server very near after 2006 when I left General Motors and went to Platform Computing then IBM. Did not really touch Windows much after that. Linux is such a robust development platform for little things like Cacti.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

I am using a Linux (Ubuntu) server (or will be). Can you do WMI from Linux to Windows? Can you do a Get-CIMInstance from Linux (I guess that queries WMI anyway, but uses a different transport to do so?).

Bit frustrated so far (not with Cacti per se), that I got this working (very slowly) in OpManager, THEN found I could do it pretty easily in CHECKMK, BUT it failed when I got to a decent number of printers (the powershell script took too long to run), so fixed it, BUT can't graph the outputs...

Does Cacti have a Windows agent now/yet?

Will try to install Cacti on my server (I failed on Friday evening, due to db-config failing - probably because I've turned on security on MySQL) again, and try the WMI plugin.
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

TheWitness wrote: Sat Mar 18, 2023 10:35 am Well, I wrote the WMI plugin for just that, but if you are using a Windows server to monitor, you will have to fix the COM integration to be able to pull the data back. I was working with one user for this, and I think he got it fixed, but did not provide a pull request to commit his fixes. The WMI plugin will polls the various query types and store it into a Cacti table that you can then generate graphs from. I gave up using Windows servers for my Cacti server very near after 2006 when I left General Motors and went to Platform Computing then IBM. Did not really touch Windows much after that. Linux is such a robust development platform for little things like Cacti.
Hi Witness, I have installed the WMIC binary (via Kali repository). I've installed the WMI plugin, but not sure what it is doing now. Clicking on the grey gear isn't doing anything...
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by TheWitness »

Under Utilities there is a WMI Query tool where you can write your SQL statements and then create queries from the working queries. Making sure to pick a good Primary Key. There are a lot of pre-written examples to pick from.

Once you create a number of queries, you can setup a polling frequency and associate them with devices. You should also setup credentials to use against the various devices that you will be polling. It's a little different than other plugins where you have to enter the userid and pssword for every device.

Once you have it collecting data, ping me back.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by TheWitness »

I may have to update the poller a bit though. Let me see if I committed my latest updates. I'll let you know here.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by TheWitness »

Okay, I just made two minor changes. This would only impact things if your user or password had special characters.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

special characters? I have some non alpha characters in all my passwords, which *may* be fouling up the command line WMIC I've been trying...
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

@witness: On a side note, can you link/use data sources from Nagios to graph in Cacti? (this may get around getting the WMI plugin working, if so, as I've got the data from a 'nagios' agent (in CheckMK - forked from Nagios) - AFAIK it does store data in RRDs.

(indeed it does here: /opt/omd/sites/RSFT/var/pnp4nagios/perfdata/%hostname% but not sure it stores the output of the plugin I want... yet).
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by TheWitness »

I turned off the firewall on my home PC last night in a vain effort to get wmic working to no avail. I'm pretty sure windows is blocking NTLMv1 these days. Kept getting login denied.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by TheWitness »

We could, you would need a nice little plugin to stitch them up in order to make it not so laborious though.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

TheWitness wrote: Tue Mar 21, 2023 8:52 am I turned off the firewall on my home PC last night in a vain effort to get wmic working to no avail. I'm pretty sure windows is blocking NTLMv1 these days. Kept getting login denied.
Yeah, I did the same thing on my Print Server. Was going to try a new user with simple password to test....

There is a switch, apparently... have I still got it... yup:

Code: Select all

 --option="client ntlmv2 auth"=Yes
from https://serverfault.com/questions/58782 ... ess-denied, but it didn't seemto work for me.

OTOH if I we can get the external data source thing working (I can see that it DID work back in 0.8.7 at least, though the documentation seems deprecated now -- https://docs.cacti.net/manual:087:8_rrd ... dated_rrds and about12202.html&highlight=nagios2cacti - the latter by Gandalf), then why bother fixing something that MS don't seem to want to see fixed (they don't allow WMI or CIM calls from Linux PowerShell either), except for sheer bloody mindedness (which I'm all in favour of). The plugins in CheckMK and Nagios, using the windows client, seem to work quite well...


Argon0
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

TheWitness wrote: Tue Mar 21, 2023 8:53 am We could, you would need a nice little plugin to stitch them up in order to make it not so laborious though.
I assume you mean using external RRDs?

Happy for it to be laborious for the moment, just to see if it is possible, can you point me in the right direction?
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by argon0 »

Or maybe I should learn to use google properly and try the "https://github.com/Cacti/plugin_npc" plugin.....

:D
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Windows Print Spooler Monitor and graph jobs in queue (+errors, pages printed, etc..)

Post by TheWitness »

Hopefully it works. The conversion was done, but no one tested originally anyway. A few people contributed to it since, which I assume that means its working. It's likely dependent on your Nagios version I imagine.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests