how to configure plugin in Nagios ?

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
jayeshdalwadi2007
Posts: 1
Joined: Wed May 02, 2012 8:02 am

how to configure plugin in Nagios ?

Post by jayeshdalwadi2007 »

try to install plugin in ubuntu for monitor tomcat i download plugin
file from

http://exchange.nagios.org/directory/Pl ... che-Tomcat

but how to configure this plugin in nagios-server so i can monitor
tomcat using web-console
help me out for configure new plugin in nagios and what step need follow for configure ?
help me out to configure tomcat moniter plugin on ubuntu desktop version

thanks
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: how to configure plugin in Nagios ?

Post by agriffin »

It is probably set up just the same as other services. If you're not familiar with the process, you can check out this page to get an idea for what you need to do.
mtarkowski
Posts: 4
Joined: Mon May 07, 2012 1:40 pm

Re: how to configure plugin in Nagios ?

Post by mtarkowski »

I already have Nagios setup and working with plugins, and I want to install the tomcat plugin check_tomcat.pl

What are the steps to installing / using the check_tomcat.pl file?

Where do I put the file?

Do I need to restart Nagios on the remote computer?

Are there any commands I need to run in order to active the plugin?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: how to configure plugin in Nagios ?

Post by lmiltchev »

Just copy the file in the plugins directory and run it with a "-h" flag to see the usage:

Code: Select all

[root@localhost libexec]# ./check_tomcat.pl -h
Usage:
        ./check_tomcat.pl [-v] [-H hostname] [-I ip_address] [-p port] [-S] [-t time_out] [-l user] [-a password] [-w /xpath[=value]...] [-c /xpath[=value]...]

        -H  ... Hostname and Host: header (default: localhost)
        -I  ... IP address (default: none)
        -p  ... Port number (default: 80)
        -S  ... Use SSL connection
        -v  ... verbose messages
        -t  ... Seconds before connection times out. (default: 10)
        -l  ... username for authentication (default: nagios)
        -a  ... password for authentication (default: embedded in script)
        -u  ... uri path, (default: /manager/status?XML=true)
        -n  ... connector name, regular expression
                eg 'ajp-bio-8009' or 'http-8080' or '^http-'.
                default is to check: .*-port_number$
                Note: leading/trailing quotes and spaces are trimmed from the connector name for matching.
        -w  ... warning thresholds for threads,memory (memory in MB)
                eg 20,50 or 10%,25% default is 25%,5%
        -c  ... critical thresholds for threads,memory (memory in MB)
                eg 10,20 or 5%,10%, default is 10%,2%
Example:
        ./check_tomcat.pl -H app01.signon.devint.lpo -p 8080 -t 5 -l nagios -a apples -u '/manager/status?XML=true'
        ./check_tomcat.pl -H app01.signon.devint.lpo -p 8080 -w 10%,50 -c 5%,10
        ./check_tomcat.pl -H app01.signon.devint.lpo -p 8080 -w 10%,50 -c 5%,10 -l admin -a admin -n .

Notes:
        The -I parameters connects to a alternate hostname/IP, using the Host header from the -H parameter

        To check ALL connectors mentioned in the status XML file, use '-n .'
        '.' is a regular expression matching all connector names.
I would suggest testing if from the command line first before configuring it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mtarkowski
Posts: 4
Joined: Mon May 07, 2012 1:40 pm

Re: how to configure plugin in Nagios ?

Post by mtarkowski »

Here is what I have done so far but I’m still getting the following errors in the log file no matter what I try.

May 7 15:22:04 vm16401 nrpe[31288]: Host is asking for command 'check_tomcat8080' to be run...
May 7 15:22:04 vm16401 nrpe[31288]: Running command: /usr/local/nagios/libexec/check_tomcat.pl -H 127.0.0.1 -p 8080 -t 5 -l nagios -a password -u '/manager/status?XML=true'
May 7 15:22:04 vm16401 nrpe[31288]: Command completed with return code 3 and output:
May 7 15:22:04 vm16401 nrpe[31288]: Return Code: 3, Output: NRPE: Unable to read output

Or this error message.
May 8 10:17:33 vm16401 nrpe[11834]: Host is asking for command 'check_tomcat8080' to be run...
May 8 10:17:33 vm16401 nrpe[11834]: Running command: /usr/local/nagios/libexec/check_tomcat.pl -H 127.0.0.1 -p 8080 -t 5 -l core -a password -u '/manager/status?XML=true'
May 8 10:17:33 vm16401 nrpe[11834]: Command completed with return code 2 and output:
May 8 10:17:33 vm16401 nrpe[11834]: Return Code: 2, Output: NRPE: Unable to read output
May 8 10:17:33 vm16401 nrpe[11834]: Connection from 10.105.70.12 closed.

On The remote Tomcat server I have installed Nagios plugins and NRPE add-on. Everything works fine when I use the Nagios plugins. The Nagios server can connect to the remote Tomcat server and results are coming back for severl plugins.

When I try to setup the check_tomcat.pl I keep getting the error no matter what I try.
I placed the check_tomcat.pl file in the /usr/local/nagios/libexec/ directory. Gave it 0755 permissions and root owner. I’m running NRPE under nagios ID so I setup an ACL so all of the directories have read and execute permissions under nagios. I gave nagios ID sudo permissions to the libexec directory. NRPE has debug turned on.

# file: libexec
# owner: nagios
# group: nagios
user::rwx
group::rwx
other::r-x

Here are the commands I setup in NRPE. They all give me the same error message when I run from the command line on the Nagios host.

command[check_tomcat8080a]=/usr/local/nagios/libexec/check_tomcat.pl -V -I 127.0.0.1 -p 8080 -t 5 -l manager -a password '/manager/status'
command[check_tomcat8080b]=/usr/local/nagios/libexec/check_tomcat.pl -V -I 127.0.0.1 -p 8080 -w 10%,50 -c 5%,10
command[check_tomcat8080c]=/usr/local/nagios/libexec/check_tomcat.pl -V -H test.abc.com -p 8080 -w 10%,50 -c 5%,10
command[check_tomcat8080d]=/usr/local/nagios/libexec/check_tomcat.pl -V -I 127.0.0.1 -p 8080 -t 5 -l manager -a password '/manager/status?XML=true'

Here are the commands from the Nagios host. Again they all give me the same error in the command line and in the remote server log file.



I have confirmed Perl is working on the server. Again several other Nagios plugins are working without error.
Any help on this would be greatly appreciated.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: how to configure plugin in Nagios ?

Post by agriffin »

Does it run fine from the command line if you test it like this (on the local machine)?

Code: Select all

su nagios -s /bin/bash -c "/usr/local/nagios/libexec/check_tomcat.pl -V -I 127.0.0.1 -p 8080 -t 5 -l manager -a password '/manager/status'"
mtarkowski
Posts: 4
Joined: Mon May 07, 2012 1:40 pm

Re: how to configure plugin in Nagios ?

Post by mtarkowski »

Yes, that was very helpful. From the error message I received I was able to determine the need for 2 Perl libs. First I had to install atrpms-75-1.noarch.rpm and then perl-XML-XPath-1.13-6.el5.noarch.rpm. Turns out I did not need to elevate the nagios Id to sudo, change the file owner from nagios to root, or add nagios as an owner to any of the directories. The only issue was the additional Perl plugins. I'm surprised no one else has mentioned this since the Perl libs are not standard.

Thank you (everyone) very much for your help.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: how to configure plugin in Nagios ?

Post by agriffin »

Thanks for sharing your solution. Glad you got everything figured out!
Locked