<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.5659" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=221554011-05032009><FONT face=Arial
color=#0000ff size=2>Brill, this is the kind of thing that helps me learn how to
use programs, wish a few more would post things like this.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=221554011-05032009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=221554011-05032009><FONT face=Arial
color=#0000ff size=2>Cheers</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> vinod.e [mailto:vinod.e@enlume.com]
<BR><B>Sent:</B> 05 March 2009 10:57<BR><B>To:</B>
Nagios-users@lists.sourceforge.net<BR><B>Subject:</B> [Nagios-users] How to
monitor using custom scripts in nagios.<BR></FONT><BR></DIV>
<DIV></DIV>Hi Friends,<BR>I Want <BIG>share My experience</BIG>
of monitoring scripts on nagios , Very simple and
Easy.<BR><BIG>I am 3 months experienced with nagios and u
should make copy of all your modifying files
initially.<BR></BIG><BR>Actually I want to monitor tomcat threads,memory
etc.. along with other services , i could not find plug ins similar
to mysql.<BR>In my office we have inbuilt scripts to
monitor tomcat manually.<BR>On test bases I had taken one of this
script and tested , I had success.<BR>There are other ways <BIG>thanks
to</BIG> <BIG>Mr.Richard Quintin</BIG> who shared his knowledge of
using nagiosgraph and scripts to monitor tomcat but my suse10.2 ,
monitoring server have few issues i could not go head instead tried
this.<BR><BR><BIG>Monitoring nagios using
scripts.</BIG><BR>Example:<BR>Monitoring tomcat Threads.<BR><BR><FONT size=+1>At
remote host side i.e where nrpe is installed / monitored
box</FONT><BR><BR>Created a file tomcat_threads.sh using vi editor<BR><BR>#vi
tomcat_threads.sh<BR>Entered following three line
code<BR><BR>#!/bin/sh<BR>totalThreads=`ps -C java -L -o pid,tid,pcpu,state | wc
-l`<BR>echo "Total Threads Available:$totalThreads"<BR><BR>Save the file and
quit<BR><BR>Made sure first script runs at # prompt.<BR><BR>Moved
script to /usr/local/nagios/libexec folder if its not created
here.<BR><BR>Set permission<BR>#chmod 755 tomcat_threads.sh<BR><BR>Give
ownner ship to nagios user only.<BR>#chown nagios:nagios
tomcat_threads.sh<BR><BR><BR>#cd /usr/local/nagios/etc<BR>#vi
nrpe.cfg<BR><BR>Append below command
line<BR><BR>command[tomcat_threads.sh]=/usr/local/nagios/libexec/tomcat_threads.sh<BR><BR>Save
and quit<BR><BR>Restart xinetd to make changes effected.<BR>#service
xinetd restart<BR><BIG><BR><BR>At monitoring server side / where nagios
monitoring server installed</BIG>.<BR>#cd
/usr/local/nagios/etc/<BR><BR>#vi services.cfg<BR>Append this
service<BR><BR>define service{<BR>
use
generic-service<BR> host_name
amazon<BR>
service_description
tomcat_threads.sh<BR>
check_command
check_nrpe!tomcat_threads.sh<BR>
notifications_enabled
0<BR> }<BR><BR>Save and
quit<BR><BR>check for erorrs <BR>#/usr/local/nagios/bin /nagios -v
/usr/local/nagios/etc/nagios.cfg<BR>correct your erorror if any.<BR><BR>Restart
nagios service<BR>#service nagios restart<BR>
<BR><BIG>DISCLAIMER:<BR>This is what worked for me and i am confident i
will add as many as scripts i want in future.<BR>You make changes as it suits to
you and i own no responsibility for typo error or if some thing goes
wrong.</BIG><BR><BR><BIG>Please share your knowledge, knowledges grows by
sharing while money reduces by sharing. </BIG><BR><BR>Regards<BR>Gajula
Vinod Kumar Eleshetty<BR>SYSTEM ADMINISTRATOR/DATA BASE ADMINISTRATOR<BR>Enlume
technologis.<BR><BR><BR><BR></BODY></HTML>