Page 1 of 1

check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 10:36 am
by nathanplatt
I've recently added the check_snmp_printer plugin to my nagios 4.1.0 box but I can't seem to get it to work. I matched the permissions from another plugin but i still can't seem to get this complie and run, any ideas what I'm missing?

nagios@nagios:/usr/local/nagios/libexec$ ls -l check_snmp_printer-rwxrwxrwx 1 nagios nagios 32656 Jul 17 07:37 check_snmp_printer
nagios@nagios:/usr/local/nagios/libexec$ ls -l check_nt
-rwxr-xr-x 1 nagios root 234782 Jul 14 10:56 check_nt
nagios@nagios:/usr/local/nagios/libexec$ chmod --reference check_nt check_snmp_printer
nagios@nagios:/usr/local/nagios/libexec$ ls -l check_snmp_printer-rwxr-xr-x 1 nagios nagios 32656 Jul 17 07:37 check_snmp_printer
nagios@nagios:/usr/local/nagios/libexec$ sudo check_snmp_printer -H 192.168.1.47 -C public -x "CONSUM ALL" -w 20 -c 10
sudo: check_snmp_printer: command not found

Code: Select all


Printer.cfg

define service{
        use                     generic-service
        host_name               kyocera47
        service_description     Toner Supply
        check_command           check_snmp_printer!public!"CONSUM Toners"!20!10
        }

# 'check_snmp_printer' command definition
define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2 -w $
}



Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 12:38 pm
by jolson
You need to reference the directory an executable resides in to run it, otherwise bash is going to hunt through your $PATH for the 'check_snmp_printer' command. Since the command doesn't exist in your $PATH, it will not be launched.

The proper method of launching the plugin manually is:

Code: Select all

cd /usr/local/nagios/libexec/
./check_snmp_printer

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 12:54 pm
by nathanplatt
I tried what you suggested and changed the location in the commands file, also tried to run it manually this is what happened;

Code: Select all

sudo ./check_snmp_printer -H 192.168.xxx.xxx -C public -x "CONSUM ALL" -w 20 -c 10
[sudo] password for nagios: 
UNKNOWN: check_snmp_printer: No usable 'snmpwalk' binary in '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
nagios@nagios:/usr/local/nagios/libexec$ ./check_snmp_printer -H 192.168.xxx.xxx -C public -x "CONSUM ALL" -w 20 -c 10
UNKNOWN: check_snmp_printer: No usable 'snmpwalk' binary in '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
nagios@nagios:/usr/local/nagios/libexec$ 
I haven't tried it in Nagios yet, whats next?

Nathan

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 12:59 pm
by jolson
At this point we'll need the 'snmpwalk' binary. You can run the following command to get it installed:

Code: Select all

yum install net-snmp-utils

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 1:04 pm
by nathanplatt
Running Ubuntu, so i've installed YUM, but this is what I get when i try to install

Code: Select all

nagios@nagios:/usr/local/nagios/libexec$ sudo yum install net-snmp-utils
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>
nagios@nagios:/usr/local/nagios/libexec$ yum repolist all
repolist: 0
nagios@nagios:/usr/local/nagios/libexec$ yum-config-manager --enable
The program 'yum-config-manager' is currently not installed. You can install it by typing:
sudo apt-get install yum-utils
nagios@nagios:/usr/local/nagios/libexec$ yum-config-manager --enable <repo>
bash: syntax error near unexpected token `newline'

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 1:07 pm
by jolson
In Ubuntu, you should be able to use apt-get similarly.

Code: Select all

apt-get install net-snmp-utils

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 1:09 pm
by nathanplatt
No such luck

nagios@nagios:/usr/local/nagios/libexec$ sudo apt-get install net-snmp
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package net-snmp
nagios@nagios:/usr/local/nagios/libexec$

:(

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 1:10 pm
by jolson
Sorry, was thinking of CentOS again. This should work for you.

Code: Select all

apt-get install snmp

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 1:14 pm
by nathanplatt
That's better!

Now i just need to find a better printer!

nagios@nagios:/usr/local/nagios/libexec$ ./check_snmp_printer -H 192.168.1.47 -C public -x "CONSUM ALL" -w 20 -c 10
WARNING: No SNMP response from 192.168.1.47! Make sure host is up and SNMP is configured properly.

nagios@nagios:/usr/local/nagios/libexec$

Thanks for all the help

Re: check_snmp_printer plugin issues

Posted: Fri Jul 17, 2015 1:28 pm
by jolson
Now i just need to find a better printer!
Don't we all! :D

I'm happy to help. I'll close the thread for now - if you have further questions or issues, feel free to make new threads. Thanks!