Skip to main content
Solved

Using cURL as a way to monitor Tomcat / restart if needed


Forum|alt.badge.img+10
  • Contributor
  • 200 replies

Has anyone out there used something simple like cURL to monitor if JSS goes down, and to restart Tomcat automatically if it gets no response?

Best answer by rich.trouton

I'm using netstat on my Linux box to monitor port 8080 to see if Tomcat is up and running on my JSS. If it's not running, it compiles and sends an email, then restarts Tomcat.

I've got a post on what I did:

http://derflounder.wordpress.com/2011/12/14/monitoring-the-casper-jss-tomcat-on-red-hat-linux/

View original
Did this topic help you find an answer to your question?

13 replies

russeller
Forum|alt.badge.img+15
  • Valued Contributor
  • 215 replies
  • December 11, 2012

I have the JSS running on Ubuntu servers. My less eloquent solution is using crontab to schedule a script that stops and starts tomcat at 3am daily. https://help.ubuntu.com/community/CronHowto


Forum|alt.badge.img+10
  • Author
  • Contributor
  • 200 replies
  • December 11, 2012

launchd in OS X would do the same thing, but we need our JSS around the clock. We've also seem to be running into a database corruption issue when we restart tomcat "at the wrong time".


Forum|alt.badge.img+24
  • Valued Contributor
  • 1892 replies
  • December 12, 2012

What's your server platform? Is this something you're looking to run locally on the server or remotely from something else? Do you have any existing enterprise monitoring solutions?


Forum|alt.badge.img+10
  • Author
  • Contributor
  • 200 replies
  • December 12, 2012

It's currently OS X.

To be honest it just be nice to have something that'll auto restart Tomcat when it goes down. Doing it at a scheduled time is not the answer and doesn't necessarily fix the problem of JSS crashing.

As for monitoring, I'd think something simple like cURL could just do the job, I could ask if other teams here have something like Nagios or Zenoss to do the heavy lifting. I'd hate to set that up just for JSS and nothing else.


Forum|alt.badge.img+24
  • Valued Contributor
  • 1892 replies
  • December 12, 2012

Give me a bit and I'll get you in the right direction with launchd


Forum|alt.badge.img+2
  • New Contributor
  • 12 replies
  • December 12, 2012

One thing that you may want to take into consideration is what is causing your JSS to not being accessible. JAMF had a monitor services feature in the past that would also give you the option to restart those services. I'm guessing that it was taken out because more damage was caused by just restarting those services and never fixing why they are going down. Basically making the problem worse by never fixing it. The snowball down the hill analogy. Just something to think about.


Forum|alt.badge.img+10
  • Author
  • Contributor
  • 200 replies
  • December 12, 2012

I agree 100% and JAMF Support formally is looking into my environment to try to figure out what's going on. But until then, I still got angry mobs with pitchforks that need to be held at bay when JSS is unavailable.


Forum|alt.badge.img+31
  • Employee
  • 920 replies
  • Answer
  • December 12, 2012

I'm using netstat on my Linux box to monitor port 8080 to see if Tomcat is up and running on my JSS. If it's not running, it compiles and sends an email, then restarts Tomcat.

I've got a post on what I did:

http://derflounder.wordpress.com/2011/12/14/monitoring-the-casper-jss-tomcat-on-red-hat-linux/


Forum|alt.badge.img+10
  • Author
  • Contributor
  • 200 replies
  • December 12, 2012

As usual Rich comes to the rescue!


Forum|alt.badge.img+24
  • Valued Contributor
  • 1892 replies
  • December 12, 2012

Damn Rich, that's purdy.


Forum|alt.badge.img+9
  • Valued Contributor
  • 138 replies
  • March 20, 2013

Rich comes through in the clutch. Easy enough to modify to suit just about any environment.


donmontalvo
Forum|alt.badge.img+36
  • Legendary Contributor
  • 4293 replies
  • March 20, 2013

We. Must. Clone. Rich.


Forum|alt.badge.img+5
  • New Contributor
  • 75 replies
  • March 20, 2013

I've been using curl since last fall from another box monitoring the JSS on 9006. Also use another script with curl on our JSS box that will restart Tomcat automatically if its non-responsive. Both will notify me when it doesn't work. Wanted to make sure we have another machine monitoring as if our jSS server totally breaks, there's another machine to tell me it went down. If our JSS server dies, it can't tell me its dead (or if the network goes away, etc).

We were having some problems last fall with Tomcat and set this up to tell us when it was going down. That problem has since been fixed, but left the monitoring in place as Tomcat/Java will consume tons of memory until it becomes unresponsive. The script to auto-restart it catches this & restarts Tomcat pretty quickly. This only happens about once every 4-8 weeks and depending on what the system has been up to.

Watching netstat is interesting, but it wouldn't have worked with our problem from the fall. Tomcat had the port open and was barely active (it would accept the connection and that's it). curl is able to check to see if its alive.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings