{"id":769,"date":"2016-08-23T12:12:34","date_gmt":"2016-08-23T11:12:34","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=769"},"modified":"2016-08-23T12:37:25","modified_gmt":"2016-08-23T11:37:25","slug":"testing-rackspace-cloud-server-service-net-connectivity-creating-alarm","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2016\/08\/23\/testing-rackspace-cloud-server-service-net-connectivity-creating-alarm\/","title":{"rendered":"Testing Rackspace Cloud-server Service-net Connectivity and creating an alarm"},"content":{"rendered":"<p>So, the last few weeks my colleagues and myself have been noticing that there has been a couple of issues with the cloud-servers servicenet interface. Unfortunately for some customers utilizing dbaas instances this means that their cloud-server will be unable to communicate, often, with their database backend.<\/p>\n<p>The solution is a custom monitoring script that my colleague Marcin has kindly put together for another customer of his own.<\/p>\n<p>The python script that goes on the server:<\/p>\n<p>Create file:<\/p>\n<pre>\r\nvi \/usr\/lib\/rackspace-monitoring-agent\/plugins\/servicenet.sh\r\n<\/pre>\n<p>Paste into file:<\/p>\n<pre>\r\n#!\/bin\/bash\r\n#\r\nping=\"\/usr\/bin\/ping -W 1 -c 1 -I eth1 -q\"\r\n\r\nif [ -z $1 ];then\r\n   echo -e \"status CRITICAL\\nmetric ping_check uint32 1\"\r\n   exit 1\r\nelse\r\n   $ping $1 &>\/dev\/null\r\n   if [ \"$?\" -eq 0 ]; then\r\n      echo -e \"status OK\\nmetric ping_check uint32 0\"\r\n      exit 0\r\n   else\r\n      echo -e \"status CRITICAL\\nmetric ping_check uint32 1\"\r\n      exit 1\r\n   fi\r\nfi\r\n\r\n<\/pre>\n<p>Create an alarm that utilizes the below metric<\/p>\n<pre>\r\nif (metric[\"ping_check\"] == 1) {\r\n    return new AlarmStatus(CRITICAL, 'what?');\r\n}\r\nif (metric[\"ping_check\"] == 0) {\r\n    return new AlarmStatus(OK, 'eee?');\r\n}\r\n<\/pre>\n<p>Of course for this to work the primary requirement is a Rackspace Cloud-server and an installation of Rackspace Cloud Monitoring installed on the server already. <\/p>\n<p>Thanks again Marcin, for this golden nugget.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, the last few weeks my colleagues and myself have been noticing that there has been a couple of issues with the cloud-servers servicenet interface. Unfortunately for some customers utilizing dbaas instances this means that their cloud-server will be unable &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2016\/08\/23\/testing-rackspace-cloud-server-service-net-connectivity-creating-alarm\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,69,37,7,29,4,61],"tags":[],"class_list":["post-769","post","type-post","status-publish","format-standard","hentry","category-bash","category-cloud-monitoring","category-disaster-recovery","category-management-tools","category-monitoring","category-networking","category-rackspace"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=769"}],"version-history":[{"count":4,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/769\/revisions"}],"predecessor-version":[{"id":773,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/769\/revisions\/773"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}