Linux Process Monitoring - Tomcat

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Linux Process Monitoring - Tomcat

Post by SavaSC »

I'm monitoring services on SLES 10 SP3. I can monitor ntpd and cron without issue, but when I monitor tomcat NagiosXI reports Nok. I can check processes, memory, and many other functions on any one of my SLES hosts, but this tomcat check fails wherever I apply it.

If I run check services here are the returns:
ltc061l:/usr/local/nagios/libexec # ./check_services -p tomcat
tomcat: 1
ltc061l:/usr/local/nagios/libexec # ./check_services -p tomcat5
tomcat: 1

Here's my own check:
ltc061l:/usr/local/nagios/libexec # service tomcat5 status
Checking for Tomcat (/srv/www/tomcat5/base/) running

Here's what XI is reporting:
tomcat
Critical 7s 1/5 2011-04-07 11:12:51 *** tomcat: Nok ***
ntpd
Ok 12m 48s 1/5 2011-04-07 11:13:33 ntpd: 1

Here's what it's using to check(ntpd is identical):
check_nrpe
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
$ARG1$ = check_services
$ARG2$ = -a 'tomcat'

Any ideas why the check runs fine on the server but reports the service down to the console?
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Linux Process Monitoring - Tomcat

Post by tonyyarusso »

Permissions. Tomcat is not allowing nagios to read its PID file most likely. Set up your check_services to use and be allowed by sudo for the nagios user.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Linux Process Monitoring - Tomcat

Post by SavaSC »

ssh as root

ltc061l:/tmp/linux-nrpe-agent # su nagios
nagios@ltc061l:/tmp/linux-nrpe-agent> cd /usr/local/nagios/libexec/
nagios@ltc061l:/usr/local/nagios/libexec> ./check_services -p tomcat
tomcat: 1
nagios@ltc061l:/usr/local/nagios/libexec>

Same result as root. Not to mention I can check other services such as cron and ntp.
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Linux Process Monitoring - Tomcat

Post by SavaSC »

What's really interesting is that sometimes it checks out ok.

tomcat
Ok 2m 20s 1/5 2011-04-07 13:54:17 tomcat: 1

But the next time it checks it will fail. Or if I perform a manual check it will fail.

tomcat
Critical 6s 1/5 2011-04-07 13:58:03 *** tomcat: Nok ***
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Linux Process Monitoring - Tomcat

Post by tonyyarusso »

So, I just installed Tomcat and set up that check on a CentOS 5 system, and it's working fine, so I'm afraid I have no idea what your issue might be.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Linux Process Monitoring - Tomcat

Post by SavaSC »

OK, we run SLES. Any luck testing on SLES or are you saying SLES isn't supported? It's the 2nd or 3rd largest distro of Linux.
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Linux Process Monitoring - Tomcat

Post by tonyyarusso »

Well, it's not supported in the sense that we aren't particularly familiar with it and don't really do testing on it normally, but I'll still take a run at it tomorrow and see if I can figure anything out for you.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Linux Process Monitoring - Tomcat

Post by tonyyarusso »

All right, it's not just you! Turns out SLES has different behavior for 'ps' than other distros, specifically when output is not directed to a tty. Edit the plugin on the SLES server, and change this line:

Code: Select all

                amt=$(ps aax | egrep "$patern" | grep -v egrep | grep -v "$PROGNAME" | wc -l | sed 's| ||g')
to this:

Code: Select all

                amt=$(ps aaxww | egrep "$patern" | grep -v egrep | grep -v "$PROGNAME" | wc -l | sed 's| ||g')
(The difference is adding 'ww' to the ps arguments.)
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Linux Process Monitoring - Tomcat

Post by SavaSC »

That worked great Tony. Thanks for checking it out!
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Linux Process Monitoring - Tomcat

Post by tonyyarusso »

Glad to hear it! Let us know if you have any further issues.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
Locked