<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
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>