Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a live nagios server(EC2) which is monitoring around number of linux clients(EC2 instances) .I want to monitor tomcat for one linux client .Any help will be highly appreciable .
Note :- I can do it using check_http plugin with port no
But our development team doesn't like to monitoring it using port no.The plugin available in nagios site needs user name and password to monitor it while we have password less authentication for all the servers .
Why don't you write your own plugin to either check the output of "pidof catalina" or check the access logs for the last modified date of the access log via NRPE? Nagios plugins are pretty easy to write in Perl. I've done this to monitor all sorts of processes and logs on NRPE clients. That way, you don't need to have the Tomcat instance being constantly hit with unnecessary checks from the Nagios server on non-standard ports and messing up the Tomcat logs - all traffic will just travel via the NRPE port 5666.
Well, no. Not that I'm aware of. But it's pretty simple. Here is a skeleton Perl plugin for you.
Code:
#!/usr/bin/perl
use lib "/usr/local/nagios/libexec";
use utils qw(%ERRORS &print_revision &support &usage);
# Argument will be stored in $arg.
if (@ARGV > 0) {
my $arg1 = @ARGV[0];
# This gets some arguments for the plugin. Disregard this if statement if no arguments needed to be passed to plugin.
if ($arg1 eq "") {
print "ERROR: processing arguments\n";
exit $ERRORS{"UNKNOWN"};
} else {
# Do your processing here. The plugin must return one of three states, OK, WARNING or CRITICAL.
# It's up to you to decide how to process the results and decide on the resulting state.
# Your processing here. Something like the bash output of "pidof catalina".
# Based on the result, set $state to either 0, 1 or 2.
if ($state == 0) { print "OK: Process running normally\n"; exit $ERRORS{"OK"}; }
if ($state == 1) { print "WARNING: Process or log entry failure\n"; exit $ERRORS{"WARNING"}; }
if ($state >= 2) { print "CRITICAL: Process and log entry failure\n"; exit $ERRORS{"CRITICAL"}; }
}
}
Basically it's just a Perl script that can return one of three states (OK, WARNING or CRITICAL) and a string message.
Well, no. Not that I'm aware of. But it's pretty simple. Here is a skeleton Perl plugin for you.
Code:
#!/usr/bin/perl
use lib "/usr/local/nagios/libexec";
use utils qw(%ERRORS &print_revision &support &usage);
# Argument will be stored in $arg.
if (@ARGV > 0) {
my $arg1 = @ARGV[0];
# This gets some arguments for the plugin. Disregard this if statement if no arguments needed to be passed to plugin.
if ($arg1 eq "") {
print "ERROR: processing arguments\n";
exit $ERRORS{"UNKNOWN"};
} else {
# Do your processing here. The plugin must return one of three states, OK, WARNING or CRITICAL.
# It's up to you to decide how to process the results and decide on the resulting state.
# Your processing here. Something like the bash output of "pidof catalina".
# Based on the result, set $state to either 0, 1 or 2.
if ($state == 0) { print "OK: Process running normally\n"; exit $ERRORS{"OK"}; }
if ($state == 1) { print "WARNING: Process or log entry failure\n"; exit $ERRORS{"WARNING"}; }
if ($state >= 2) { print "CRITICAL: Process and log entry failure\n"; exit $ERRORS{"CRITICAL"}; }
}
}
Basically it's just a Perl script that can return one of three states (OK, WARNING or CRITICAL) and a string message.
Thanks ,
I will use this script .I will check locally.
The above code is a example framework, it won't actually do anything. As I said, you can add as many arguments as you like and process what you want as long as the end result is one of those three states. I imagine all you'd need to do is to check for the presence of the Tomcat process, so unless you want to write a generalised process watcher, I doubt you'd need any arguments to your plugin.
The above code is a example framework, it won't actually do anything. As I said, you can add as many arguments as you like and process what you want as long as the end result is one of those three states. I imagine all you'd need to do is to check for the presence of the Tomcat process, so unless you want to write a generalised process watcher, I doubt you'd need any arguments to your plugin.
Could you give one example .I dont know to write scripts in perl .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.