i cant make non-official plugins to work

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.
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Re: i cant make non-official plugins to work

Post 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)
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: i cant make non-official plugins to work

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Re: i cant make non-official plugins to work

Post by Sander5 »

-rwxr-xr-x 1 nagios wheel 32657 Sep 11 11:53 check_snmp_printer
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: i cant make non-official plugins to work

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Re: i cant make non-official plugins to work

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: i cant make non-official plugins to work

Post 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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Re: i cant make non-official plugins to work

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: i cant make non-official plugins to work

Post 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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Sander5
Posts: 37
Joined: Wed Sep 04, 2013 5:15 am

Re: i cant make non-official plugins to work

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: i cant make non-official plugins to work

Post 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?
Locked