{"id":439,"date":"2011-11-17T22:56:06","date_gmt":"2011-11-17T21:56:06","guid":{"rendered":"http:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/"},"modified":"2011-11-17T22:56:06","modified_gmt":"2011-11-17T21:56:06","slug":"kicking-jenkins-with-monit","status":"publish","type":"post","link":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/","title":{"rendered":"Kicking Jenkins with monit"},"content":{"rendered":"<p>We&#39;ve been using Jenkins to build and test all our projects for a good part of this year now. I think Jenkins is one of the very few Java projects I&#39;ve seen and worked with that <b>actually works<\/b> and it&#39;s a real pleasure to use. <b>Except every now and then it seems to crash without reason.<\/b>.<\/p>\n<p>I haven&#39;t had time to dig into this problem yet. I&#39;ve only seen the frontend Apache process logging errors because it cannot connect to the Tomcat backend on port 8080. My theory so far is that Jenkins tries to auto-update and crashes, or maybe there&#39;s a runaway test run that brings everything down&#8230;<\/p>\n<p>Time is really limited these days, and I have heard good things about monit, I decided to try it to see if we could have Jenkins kicked when it dies for some reason. In this way we can avoid cases where the test suites haven&#39;t been running for a day or two and nobody noticed&#8230; :-|<\/p>\n<p>So, long story short, <strong>here&#39;s the quick and dirty monit recipe<\/strong> to kick Apache + Jenkins (this is on Debian Squeeze):<\/p>\n<pre>\r\ncheck process jenkins with pidfile \/var\/run\/jenkins\/jenkins.pid\r\n  start program = &quot;\/etc\/init.d\/jenkins start&quot; with timeout 90 seconds\r\n  stop program  = &quot;\/etc\/init.d\/jenkins stop&quot;\r\n  if failed host my.host.name port 8080 protocol http\r\n     and request &quot;\/&quot;\r\n     then restart\r\n\r\ncheck process apache with pidfile \/var\/run\/apache2.pid\r\n  start program = &quot;\/etc\/init.d\/apache2 start&quot; with timeout 60 seconds\r\n  stop program  = &quot;\/etc\/init.d\/apache2 stop&quot;\r\n  if failed host my.host.name port 80 protocol http\r\n     and request &quot;\/&quot;\r\n     then restart\r\n<\/pre>\n<p>And, just for kicks, <strong>a complete <a href=\"https:\/\/github.com\/cosimo\/puppet-modules\/tree\/master\/monit\" rel=\"nofollow\">Monit module for puppet<\/a><\/strong> up on Github. Have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#39;ve been using Jenkins to build and test all our projects for a good part of this year now. I think Jenkins is one of the very few Java projects I&#39;ve seen and worked with that actually works and it&#39;s a real pleasure to use. Except every now and then it seems to crash without [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[259,63,258,257,255,76],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Kicking Jenkins with monit - Random hacking<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Kicking Jenkins with monit - Random hacking\" \/>\n<meta property=\"og:description\" content=\"We&#039;ve been using Jenkins to build and test all our projects for a good part of this year now. I think Jenkins is one of the very few Java projects I&#039;ve seen and worked with that actually works and it&#039;s a real pleasure to use. Except every now and then it seems to crash without [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/\" \/>\n<meta property=\"og:site_name\" content=\"Random hacking\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-17T21:56:06+00:00\" \/>\n<meta name=\"author\" content=\"cosimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cosimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/\"},\"author\":{\"name\":\"cosimo\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"headline\":\"Kicking Jenkins with monit\",\"datePublished\":\"2011-11-17T21:56:06+00:00\",\"dateModified\":\"2011-11-17T21:56:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/\"},\"wordCount\":211,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"keywords\":[\"apache\",\"github\",\"jenkins\",\"monit\",\"ops\",\"servers\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/\",\"name\":\"Kicking Jenkins with monit - Random hacking\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\"},\"datePublished\":\"2011-11-17T21:56:06+00:00\",\"dateModified\":\"2011-11-17T21:56:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Kicking Jenkins with monit\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\",\"name\":\"Random hacking\",\"description\":\"Assume nothing. Code defensively. Keep it simple, stupid!\",\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\",\"name\":\"cosimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"caption\":\"cosimo\"},\"logo\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Kicking Jenkins with monit - Random hacking","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/","og_locale":"en_US","og_type":"article","og_title":"Kicking Jenkins with monit - Random hacking","og_description":"We&#39;ve been using Jenkins to build and test all our projects for a good part of this year now. I think Jenkins is one of the very few Java projects I&#39;ve seen and worked with that actually works and it&#39;s a real pleasure to use. Except every now and then it seems to crash without [&hellip;]","og_url":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/","og_site_name":"Random hacking","article_published_time":"2011-11-17T21:56:06+00:00","author":"cosimo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"cosimo","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#article","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/"},"author":{"name":"cosimo","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"headline":"Kicking Jenkins with monit","datePublished":"2011-11-17T21:56:06+00:00","dateModified":"2011-11-17T21:56:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/"},"wordCount":211,"commentCount":0,"publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"keywords":["apache","github","jenkins","monit","ops","servers"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/","url":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/","name":"Kicking Jenkins with monit - Random hacking","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website"},"datePublished":"2011-11-17T21:56:06+00:00","dateModified":"2011-11-17T21:56:06+00:00","breadcrumb":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2011\/11\/kicking-jenkins-with-monit\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.streppone.it\/cosimo\/blog\/"},{"@type":"ListItem","position":2,"name":"Kicking Jenkins with monit"}]},{"@type":"WebSite","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website","url":"https:\/\/www.streppone.it\/cosimo\/blog\/","name":"Random hacking","description":"Assume nothing. Code defensively. Keep it simple, stupid!","publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1","name":"cosimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","caption":"cosimo"},"logo":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/439"}],"collection":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/comments?post=439"}],"version-history":[{"count":0,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/439\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/media?parent=439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/categories?post=439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/tags?post=439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}