Page 2 of 6

Re: i cant make non-official plugins to work

Posted: Wed Sep 11, 2013 2:45 am
by Sander5
I found xxd. Its located in /usr/local/bin.


Is it possible that i entered the wrong options in define_service/command? i will carefully check everything to make sure.

I just changed the printer plugin, #!/bin/sh back to the Original #!/bin/bash. now i recieve a completely different error:

(Return code of 127 is out of bounds - plugin may be missing)

Re: i cant make non-official plugins to work

Posted: Wed Sep 11, 2013 11:35 am
by lmiltchev
Can you show us the actual command that you are running, run from the command line and the output of it? What are the permissions?

Code: Select all

ls -la check_snmp_printer

Re: i cant make non-official plugins to work

Posted: Thu Sep 12, 2013 1:29 am
by Sander5
-rwxr-xr-x 1 nagios wheel 32657 Sep 11 11:53 check_snmp_printer

Re: i cant make non-official plugins to work

Posted: Thu Sep 12, 2013 9:59 am
by lmiltchev
You didn't show us the actual command and the output of it... Also, change the permissions on the plugin:

Code: Select all

chown nagios:nagios check_snmp_printer

Re: i cant make non-official plugins to work

Posted: Mon Sep 16, 2013 3:17 am
by Sander5
Im sorry i didnt read it correctly:

./check_snmp_printer wont work. i checked the plugin script and changed #!bin/bash to #!bin/sh now i can run it with ./ but the plugin dont work anymore from command after i changed that, but with bash it works.

bash check_snmp_printer -H 10.240.2.102 -C public -x "CONSUM black"

output:
Canon C-EXV 29 Black Toner is at 5% - CRITICAL! | Canon C-EXV 29 Black Toner=5;20;5;

./check_snmp_printer -H 10.240.2.102 -C public -x "CONSUM black"

output:
./check_snmp_printer: function: not found
(then the help from the script)


And after i used the chown nagios:nagios the out of bounds error 127 went away. but the plugin is still UNKNOWN.

Re: i cant make non-official plugins to work

Posted: Mon Sep 16, 2013 10:15 am
by sreinhardt
Are you referencing the plugin as ./ or $USER1$/ in the nagios configuration. As lmiltchev asked, could you please post the command as defined in the nagios commands.cfg file, not how you are executing via cli?

Re: i cant make non-official plugins to work

Posted: Tue Sep 17, 2013 5:54 am
by Sander5

Code: Select all

define command{
        command_name check_snmp_printer
        command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ -w $ARG3$ -c $ARG4$
}
I was referring the ./ via cli. I hope this is the correct one.

Re: i cant make non-official plugins to work

Posted: Tue Sep 17, 2013 1:18 pm
by sreinhardt
That does look like the correct one, and it does seem properly defined. Could we ask you to tar your entire nagios configs directory and send it to one of us please. It seems like you've got it working via cli, just for some reason not within the nagios daemon. As another thing to verify, you do have this in the same directory as your other working plugins?

Re: i cant make non-official plugins to work

Posted: Wed Sep 18, 2013 6:28 am
by Sander5
sreinhardt wrote:As another thing to verify, you do have this in the same directory as your other working plugins?
The plugin? yes it is in the same directory. (/usr/local/libexec/nagios)

I do not know the correct way to install a plugin. And i couldn't find good documentation. Only how to install the plugins wich came with nagios-plugins, check_nt and such they all work.

I will send the tar.

Re: i cant make non-official plugins to work

Posted: Wed Sep 18, 2013 9:37 am
by slansing
Well you should not have a nagios directory under your libexec directory, all of your plugins should go into libexec unless you are using a abnormal installation method.. which.. I suppose could be because you are on FreeBSD. You did not create the additional nagios directory, right?