[Solved] How/where do I create a plugins folder?

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.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

[Solved] How/where do I create a plugins folder?

Post by jbruyet »

Hey all, I downloaded a script from the Nagios Exchange:

http://exchange.nagios.org/directory/Pl ... or/details

and in the instructions it says to "Just copy the plugin in the right directory, e.g.: /usr/lib/nagios/plugins/ and remember to make the file executable." I don't have a plugins folder so I'm not sure where to create one or how to set it up in Nagios. One problem may be that I'm running my Nagios on a FreeBSD 9.1 server. Any ideas?

Thanks,

Joe B
Last edited by jbruyet on Mon May 05, 2014 6:02 pm, edited 1 time in total.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How/where do I create a plugins folder?

Post by tmcdonald »

You must have a plugins folder, but it might not be called plugins. I'm not a BSD guru, but I think you guys still have the "find" command. Look for "check_http" and that should indicate the folder the plugins reside in. check_http is a standard plugin that almost every nagios install should have, so if you find that you have found the others.
Former Nagios employee
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How/where do I create a plugins folder?

Post by jbruyet »

I found the BSD equivalent of the plugins folder:

Code: Select all

root@FreeNag:/usr/home/jobee/SNMP # find / -name "check_http"
/usr/local/libexec/nagios/check_http
root@FreeNag:/usr/home/jobee/SNMP #
I put the script in there, made it executable, made the changes to commands.cfg and switch.cfg but I'm getting the following error on the monitoring page:

Code: Select all

Host		Service	Status		Last Check	Duration	Attempt	Status Information
CS-2524SrvRm	HP-hw	CRITICAL	13:52:59	0d 2h 7m 46s	3/3	(Return code of 127 is out of bounds - plugin may be missing) 
I'm not sure where to go from here.

Thanks,

Joe B
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How/where do I create a plugins folder?

Post by slansing »

What is your commands.cfg definition for this check? You made sure to verify the config files and restart nagios correct?
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How/where do I create a plugins folder?

Post by jbruyet »

Here is my commands.cfg definition for this check:

Code: Select all

define command {
    command_name check_snmp_hp-procurve
    command_line $USER1$/check_snmp_hp-procurve.sh public $HOSTADDRESS$
    }
And Nagios restarts just fine:

Code: Select all

root@FreeNag:/usr/local/etc/nagios/objects # service nagios restart
Performing sanity check of nagios configuration: OK
Stopping nagios.
Waiting for PIDS: 782.
Performing sanity check of nagios configuration: OK
Starting nagios.
root@FreeNag:/usr/local/etc/nagios/objects #
There are a ton of warnings but they say this:

Code: Select all

Warning: Host 'srv-AppServ' has no default contacts or contactgroups defined!
Warning: Host 'srv-OCS' has no default contacts or contactgroups defined!
Warning: Host 'srv-fnw' has no default contacts or contactgroups defined!
Warning: Host 'srv-navitrans' has no default contacts or contactgroups defined!
Thanks,

Joe B
pato
Posts: 18
Joined: Thu Oct 10, 2013 6:06 pm
Location: Melbourne, Australia

Re: How/where do I create a plugins folder?

Post by pato »

Couple of things to check:

Try running the command from the command line as the nagios user:

Code: Select all

/usr/local/libexec/nagios/check_snmp_hp-procurve.sh public <target host>
You may find the permissions on the file do not allow execution by the nagios user.

Check how Nagios is defining your $USER1$ macro. This is defined in resources.cfg, in Nagios's config directory (I'm not sure where this would be on a BSD install). I'm assuming your other checks run fine, so this is probably set up correctly, but always good to check. For your install, you want to ensure that it's defined as below:

Code: Select all

# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/local/libexec/nagios
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How/where do I create a plugins folder?

Post by tmcdonald »

I think pato has the right idea. We don't really get a lot of people running Nagios on BSD systems, so pathing and permissions could be somewhat different.
Former Nagios employee
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How/where do I create a plugins folder?

Post by jbruyet »

That was a good idea because I found this:

Code: Select all

root@FreeNag:/usr/local/libexec/nagios # whoami
root
root@FreeNag:/usr/local/libexec/nagios # ls -l *.sh
-r-xr-xr-x  1 root  wheel  3295 May  1 11:54 check_snmp_hp-procurve.sh
-r-xr-xr-x  1 root  wheel   880 Mar 13  2013 utils.sh
root@FreeNag:/usr/local/libexec/nagios # ./check_snmp_hp-procurve.sh
./check_snmp_hp-procurve.sh: Command not found.
root@FreeNag:/usr/local/libexec/nagios #
I changed permissions on check_snmp_hp-procurve.sh from nagios to root and as you can see it still won't run. I'm baffled. Any ideas?

I checked $USER1$ and it's correct:

Code: Select all

# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/local/libexec/nagios
FWIW I installed Nagios on FreeBSD on the recommendation of a friend. While I have learned to do the little tweaks required for its idiosyncrasies there have been too many of them. I'm starting to think about moving everything over to Linux. I've heard that Nagios prefers CentOS. Is that true?

Thanks,

Joe B
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How/where do I create a plugins folder?

Post by sreinhardt »

There certainly are differences, and we would be able to better assist you with os level issues, but otherwise it's more of a personal choice than anything else. Both BSD and linux will work fine for an average nagios install. That is extremely strange that root cannot execute something that has execute and root ownership, what are the permissions on the libexec directory?
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.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Re: How/where do I create a plugins folder?

Post by jbruyet »

The folder has standard permissions:

Code: Select all

root@FreeNag:/usr/local # ls -l
total 48
drwxr-xr-x   4 root  wheel  6656 Apr  8 14:43 bin
drwxr-xr-x  15 root  wheel   512 Jan  9 10:55 etc
drwxr-xr-x  17 root  wheel  1536 May 30  2013 include
drwxr-xr-x   2 root  wheel   512 Jun  6  2013 info
drwxr-xr-x  13 root  wheel  4096 Jun  6  2013 lib
drwxr-xr-x   5 root  wheel   512 Mar 12  2013 libdata
drwxr-xr-x   6 root  wheel   512 Nov 20 15:41 libexec
drwxr-xr-x  55 root  wheel  1024 Apr 26 04:15 man
drwxr-xr-x   2 root  wheel  1024 Jan  9 10:55 sbin
drwxr-xr-x  35 root  wheel  1024 Jan  9 10:54 share
drwxr-xr-x   4 root  wheel   512 Mar 13  2013 www
root@FreeNag:/usr/local #
Well, sreinhardt, I think I hit the tipping point with your "...able to better assist you with os level issues..." comment. I believe it's time to start the process of getting my Nagios files moved over to Linux. I hope this doesn't start a flame war but is there a preferred Linux distribution for running Nagios?

Thanks,

Joe B
Locked