Sponsored Content
Top Forums Shell Programming and Scripting Monitoring Tomcat Service with shell script Post 302794231 by ooilinlove on Monday 15th of April 2013 12:57:30 PM
Old 04-15-2013
Wrench Monitoring Tomcat Service with shell script

Hello Forum,

I have prepared script to monitor the tomcat status.
Following is the script which will monitor tomcat instance.
I need little modifcation in the script.

My script will grep for process,
the output of grep command will analyze by if condition under for loop and will send following echo message on the email.
The echo message which will get send is as follows echo "Tomcat Application Server is down on myserver" | mailx -s "tomcatserver of myserver is down" $email.
I need modifcation here ,it sends very generalised message i.e tomcat is down.
I would like it to send message which tomcat is going down whether it is tomcat Port 7007 7008 8001 8008 8009 8023 8024 kindly assist.


Code:
#!/usr/bin/ksh
 
# Lisr for Port
list='7007
7008
8001
8008
8009
8023
8024'
for li in $list
do
RESULT=`netstat -na | grep $li |grep "LISTEN" | wc -l`
 
if [ "$RESULT" = 0 ]; then
echo "TOMCAT PORT $li STILL NOT LISTENING"
else 
echo "TOMCAT PORT $li IS LISTENINS AND SO TOMCAT WORKING"
fi
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Weblogic monitoring shell script

HI, I'm new in unix. I would like to know if you have a ready script for monitoring the weblogic and managed servers. I want to have a script that checks the weblogic once in a while if it's up and running. if not running, will send an email to me. any idea? please help me. i will... (4 Replies)
Discussion started by: tungaw2004
4 Replies

2. Shell Programming and Scripting

script for monitoring service

Hi, I am new to shell programming, I would like to write a script which will monitor sendmail service in linux, and if service goes down it will send the mail can you please suggest me how to monitor the service? Regards, Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

3. Shell Programming and Scripting

Shell script for service

Hi, I want to add an application as a service in Linux(Fedora 12). It should be run always for monitoring my system. It never terminate unless kill it. I wrote this script, put it on /etc/init.d/myapp and added it to run level 2345: #!/bin/bash # # chkconfig: 2345 20 80 # description:... (3 Replies)
Discussion started by: pronetin
3 Replies

4. Shell Programming and Scripting

Monitoring Tomcat Instance using shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance.I need little modifcation in the script. My script will grep for java,the output of grep command will analyze by if condition under for loop and will send following echo... (7 Replies)
Discussion started by: coolguyamy
7 Replies

5. Shell Programming and Scripting

Shell script for process monitoring

Im having a bit of troble coming up with a script that does this monitors processes to see if they die, if they do die, restart the process and write out to a log file that the process was restarted with the new PID and the date and time the new process was launched. Any suggestions? (1 Reply)
Discussion started by: jspinal
1 Replies

6. Shell Programming and Scripting

Tomcat Monitoring log file

Hi, I ned to monitor the tomcat log file called "catalina.out" for "OutOfMemory" ,"java.sql.SQLException" and "Error" error. the script should monitor this file (catalina.out) and send us the mail as soon as it finds the string "Out of memory" or "java.sql.SQLException" or "Error" in the... (2 Replies)
Discussion started by: mnmonu
2 Replies

7. Shell Programming and Scripting

Shell Monitoring Script

Hi guys, I didn't understand this monitoring script request - I don't ask for the script result. If you understand the request, I'm just asking an explanation to simplify it for me. THE Script Request: Our organization keeps various files in directories structured as... (2 Replies)
Discussion started by: moshesa
2 Replies

8. UNIX for Beginners Questions & Answers

Server monitoring using shell script

I want to write a shell script which is used in cron job and it runs every 4 hours to check whether tomcat servers are running or not . If servers are not running , one email should be triggered like alert notification. if servers are Running then no need to print anything. This is what i want... (5 Replies)
Discussion started by: kk123
5 Replies

9. Infrastructure Monitoring

Problem with service monitoring

This morning we had an activity on our Nagios server, whereby we inserted new disks into the server, and rebooted the server. The disk implementation failed, therefore we had to revoke the changes, and rebooted the server once again. The server was up and running at 6:00 am this morning.... (2 Replies)
Discussion started by: anaigini45
2 Replies

10. UNIX for Beginners Questions & Answers

Shell script newbie- how to generate service log from shell script

Hi, I am totally a newbie to any programming languages and I just started an entry level job in an IT company. One of my recent tasks is to create a script that is able to show the log file of linux service (i.e. ntpd service) lets say, if I run my script ./test.sh, the output should be... (3 Replies)
Discussion started by: xiaogeji
3 Replies
OCF_HEARTBEAT_TOMCAT(7) 					OCF resource agents					   OCF_HEARTBEAT_TOMCAT(7)

NAME
ocf_heartbeat_tomcat - Manages a Tomcat servlet environment instance SYNOPSIS
tomcat [start | stop | status | monitor | meta-data | validate-all] DESCRIPTION
Resource script for Tomcat. It manages a Tomcat instance as a cluster resource. SUPPORTED PARAMETERS
tomcat_name The name of the resource, added as a Java parameter in JAVA_OPTS: -Dname=<tomcat_name> to Tomcat process on start. Used to ensure process is still running and must be unique. (unique, optional, string, no default) script_log Log file, used during start and stop operations. (unique, optional, string, no default) tomcat_stop_timeout Time-out for stop operation. DEPRECATED (optional, integer, no default) tomcat_suspend_trialcount Maximum number of times to retry stop operation before suspending and killing Tomcat. DEPRECATED. Does not retry. (optional, integer, no default) tomcat_user The user who starts Tomcat. (optional, string, no default) statusurl URL for state confirmation. (optional, string, no default) java_home Home directory of Java. (required, string, no default) java_opts Java JVM options used on start and stop. (optional, string, no default) catalina_home Home directory of Tomcat. (unique, required, string, no default) catalina_base Instance directory of Tomcat (unique, optional, string, no default) catalina_pid A PID file name for Tomcat. (unique, optional, string, no default) tomcat_start_opts Tomcat start options. (optional, string, no default) catalina_opts Catalina options, for the start operation only. (optional, string, no default) catalina_rotate_log Rotate catalina.out flag. (optional, string, no default) catalina_rotatetime catalina.out rotation interval (seconds). (optional, integer, no default) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 60s. stop Stops the resource. Suggested minimum timeout: 120s. status Performs a status check. Suggested minimum timeout: 60. monitor Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval: 10s. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a tomcat resource using the crm(8) shell: primitive p_tomcat ocf:heartbeat:tomcat params java_home=string catalina_home=string op monitor depth="0" timeout="30s" interval="10s" SEE ALSO
http://www.linux-ha.org/wiki/tomcat_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 03/09/2014 OCF_HEARTBEAT_TOMCAT(7)
All times are GMT -4. The time now is 01:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy