Check Cups Queue

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
MilesDeep
Posts: 24
Joined: Thu Mar 13, 2014 12:22 pm

Check Cups Queue

Post by MilesDeep »

Hello Nagios World,

I've found some good plug-ins for monitoring cups queues, but I'd like to monitor whether or not a queue is up or down, not the number of jobs in the queue.

Any suggestions?

Thanks.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Check Cups Queue

Post by abrist »

There are a number of plugins that achieve this on the exchange. Take a look:
http://exchange.nagios.org/index.php?op ... hword=cups
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
MilesDeep
Posts: 24
Joined: Thu Mar 13, 2014 12:22 pm

Re: Check Cups Queue

Post by MilesDeep »

If I run lpq -P printer1 from the command line, I get printer1 is ready or printer1 is not ready. That's what I want. Can someone help me with a script that can turn this into an alert?
MilesDeep
Posts: 24
Joined: Thu Mar 13, 2014 12:22 pm

Re: Check Cups Queue

Post by MilesDeep »

Thanks. I did check those and I didn't see any that checked simply if the queue was enabled or disabled, whether the printer was ready to not. That said, I am very new at this.

I'm still receiving this: NRPE: Unable to read output

I thought about modifying one of the scripts found on the Exchange. This one, but I can't get it to work:

#!/bin/bash

LPR=$1
ERROR='$LPR is not ready'

QUEUE=`lpq -P $LPR'
QUEUE=$(($QUEUE))

INFO="Queue($QUEUE)"

if [ $QUEUE -gt $ERROR ]; then
echo "ERROR - $INFO"
exit
fi

echo "OKAY - $INFO"
exit 0
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Check Cups Queue

Post by Box293 »

How about something like this:

Code: Select all

#!/bin/bash

LPR=$1
MESSAGE='$LPR is ready'

QUEUE=$(lpq -P $LPR 2>&1)

INFO="Queue($QUEUE)"

if [ "$QUEUE" != "$MESSAGE" ]
then
   echo "ERROR - $INFO"
   exit 2
fi

echo "OKAY - $INFO"
exit 0
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
MilesDeep
Posts: 24
Joined: Thu Mar 13, 2014 12:22 pm

Re: Check Cups Queue

Post by MilesDeep »

I've added that script, thanks. At this point I am receiving error; NRPE: Unable to read output in Nagios and error; -bash: !check_queue_status!lpq: event not found, from the command line.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Check Cups Queue

Post by ssax »

Did you add the script to your remote host and add the command to your remote hosts agent configuration?

You would then use something like:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H REMOTEIP -c check_queue_status -a "printer1"
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check Cups Queue

Post by tmcdonald »

Can you also show the command you are running that produces the "event not found" output?
Former Nagios employee
MilesDeep
Posts: 24
Joined: Thu Mar 13, 2014 12:22 pm

Re: Check Cups Queue

Post by MilesDeep »

I can't figure out why I keep getting NRPE: Command 'check_queue_status.sh' not defined. When I run it from the command line, I get a result. When I look at the logs, I see no errors. The command is listed in nrpe.cfg. It's correct in commands.cfg and Linux.cfg. Really stuck.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Check Cups Queue

Post by ssax »

Please post the service, command, and nrpe configs.
Locked