[Solved] How/where do I create a plugins folder?
[Solved] How/where do I create a plugins folder?
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
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.
Re: How/where do I create a plugins folder?
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
Re: How/where do I create a plugins folder?
I found the BSD equivalent of the plugins folder:
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:
I'm not sure where to go from here.
Thanks,
Joe B
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 #
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)
Thanks,
Joe B
-
- 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?
What is your commands.cfg definition for this check? You made sure to verify the config files and restart nagios correct?
Re: How/where do I create a plugins folder?
Here is my commands.cfg definition for this check:
And Nagios restarts just fine:
There are a ton of warnings but they say this:
Thanks,
Joe B
Code: Select all
define command {
command_name check_snmp_hp-procurve
command_line $USER1$/check_snmp_hp-procurve.sh public $HOSTADDRESS$
}
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 #
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!
Joe B
Re: How/where do I create a plugins folder?
Couple of things to check:
Try running the command from the command line as the nagios user: 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:
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>
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
Re: How/where do I create a plugins folder?
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
Re: How/where do I create a plugins folder?
That was a good idea because I found this:
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:
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
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 checked $USER1$ and it's correct:
Code: Select all
# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/local/libexec/nagios
Thanks,
Joe B
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: How/where do I create a plugins folder?
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.
Re: How/where do I create a plugins folder?
The folder has standard permissions:
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
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 #
Thanks,
Joe B