Page 1 of 1
Check Cups Queue
Posted: Fri May 08, 2015 2:15 pm
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.
Re: Check Cups Queue
Posted: Fri May 08, 2015 2:20 pm
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
Re: Check Cups Queue
Posted: Fri May 08, 2015 2:53 pm
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?
Re: Check Cups Queue
Posted: Fri May 08, 2015 3:10 pm
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
Re: Check Cups Queue
Posted: Sun May 10, 2015 11:45 pm
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
Re: Check Cups Queue
Posted: Tue May 12, 2015 10:18 am
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.
Re: Check Cups Queue
Posted: Tue May 12, 2015 4:08 pm
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"
Re: Check Cups Queue
Posted: Tue May 12, 2015 4:17 pm
by tmcdonald
Can you also show the command you are running that produces the "event not found" output?
Re: Check Cups Queue
Posted: Wed May 13, 2015 6:57 am
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.
Re: Check Cups Queue
Posted: Wed May 13, 2015 1:06 pm
by ssax
Please post the service, command, and nrpe configs.