check_snmp_printer plugin issues

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
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

check_snmp_printer plugin issues

Post 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 $
}


jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_snmp_printer plugin issues

Post 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
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: check_snmp_printer plugin issues

Post 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
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_snmp_printer plugin issues

Post 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
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: check_snmp_printer plugin issues

Post 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'
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_snmp_printer plugin issues

Post by jolson »

In Ubuntu, you should be able to use apt-get similarly.

Code: Select all

apt-get install net-snmp-utils
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: check_snmp_printer plugin issues

Post 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$

:(
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_snmp_printer plugin issues

Post by jolson »

Sorry, was thinking of CentOS again. This should work for you.

Code: Select all

apt-get install snmp
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: check_snmp_printer plugin issues

Post 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
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_snmp_printer plugin issues

Post 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!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked