Linux Process Monitoring - Tomcat
Linux Process Monitoring - Tomcat
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?
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?
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Linux Process Monitoring - Tomcat
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.
Re: Linux Process Monitoring - Tomcat
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.
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.
Re: Linux Process Monitoring - Tomcat
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 ***
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 ***
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Linux Process Monitoring - Tomcat
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.
Re: Linux Process Monitoring - Tomcat
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.
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Linux Process Monitoring - Tomcat
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.
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Linux Process Monitoring - Tomcat
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:
to this:
(The difference is adding 'ww' to the ps arguments.)
Code: Select all
amt=$(ps aax | egrep "$patern" | grep -v egrep | grep -v "$PROGNAME" | wc -l | sed 's| ||g')
Code: Select all
amt=$(ps aaxww | egrep "$patern" | grep -v egrep | grep -v "$PROGNAME" | wc -l | sed 's| ||g')
Re: Linux Process Monitoring - Tomcat
That worked great Tony. Thanks for checking it out!
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Linux Process Monitoring - Tomcat
Glad to hear it! Let us know if you have any further issues.