{"id":6785,"date":"2019-11-08T09:28:29","date_gmt":"2019-11-08T15:28:29","guid":{"rendered":"https:\/\/www.poweradmin.com\/blog\/?p=6785"},"modified":"2019-11-08T09:28:29","modified_gmt":"2019-11-08T15:28:29","slug":"implementing-3rd-party-fail-over-with-the-service-monitor","status":"publish","type":"post","link":"https:\/\/www.poweradmin.com\/blog\/implementing-3rd-party-fail-over-with-the-service-monitor\/","title":{"rendered":"Implementing 3rd Party Fail Over with the Service Monitor"},"content":{"rendered":"<p><span style=\"font-family: verdana, geneva, sans-serif;\">We have a customer with a scenario where a set of services run on SERVER1 -or- SERVER2.\u00a0 If any service in a set fails, everything in the set should be stopped and the entire set should be started on the other server.\u00a0 Below I\u2019ll describe how to implement this.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">In my example I\u2019ll assume there are three services in each set, Service A, Service B and Service C.\u00a0 \u00a0This pattern will scale to any number, though it it is admittedly a little tedious to setup initially.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\"><a href=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/start-service-action.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-6786\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/start-service-action.jpg\" alt=\"\" width=\"399\" height=\"301\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/start-service-action.jpg 649w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/start-service-action-300x226.jpg 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\"><\/a><\/span><\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">The first step is to use the <a href=\"https:\/\/www.poweradmin.com\/help\/latestsmhelp.aspx?page=action_retart_service.aspx&amp;ref=blog\">Start, Stop or Restart a Service<\/a> action, and create an action to start Service A, Service B and Service C specifically on SERVER1 and SERVER2.\u00a0 \u00a0That is 6 actions to be created.\u00a0 \u00a0In addition we need to create 6 more that use the same action, but these are used to Stop the services.\u00a0 \u00a0 Note that normally the service could be started on the monitored server with much fewer actions, but in this case we want to stop and start the services on a different server, so this level of specificity is needed.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">So three actions to start the service on SERVER 1, three actions to stop on SERVER 1, three actions to start on SERVER 2 and three actions to stop on SERVER 2.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">To make these actions easier to deal with, I recommend adding the sets of three into an Action List action.\u00a0 \u00a0So you\u2019ll have four Action Lists:<\/span><\/p>\n<ol>\n<li><span style=\"font-family: verdana, geneva, sans-serif;\">Stop services on SERVER 1<\/span><\/li>\n<li><span style=\"font-family: verdana, geneva, sans-serif;\">Start services on SERVER 1<\/span><\/li>\n<li><span style=\"font-family: verdana, geneva, sans-serif;\">Stop services on SERVER 2<\/span><\/li>\n<li><span style=\"font-family: verdana, geneva, sans-serif;\">Start services on SERVER 2\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6787 alignright\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/service-monitor-300x256.jpg\" alt=\"\" width=\"401\" height=\"342\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/service-monitor-300x256.jpg 300w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/service-monitor.jpg 545w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\"><\/span><\/li>\n<\/ol>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">With all of that done, we can now setup the monitors.\u00a0 \u00a0First we\u2019ll create a Service Monitor on SERVER 1 that is set to watch Service A, Service B and Service C.\u00a0 \u00a0We\u2019ll create a monitor like this for both SERVER 1 and SERVER 2.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Now click the Actions button.\u00a0 We want to make sure that when the monitor on SERVER 1 detects a down service, that it runs the following Action Lists:<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Stop services on SERVER 1<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Start services on SERVER 2<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">We only want the actions to get run once while in alert state (i.e. when the monitor is detecting the services are not running), so choose the shown radio button below:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6789 alignright\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/run-actions-when-service-stopped.jpg\" alt=\"\" width=\"600\" height=\"354\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/run-actions-when-service-stopped.jpg 745w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2019\/11\/run-actions-when-service-stopped-300x177.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\"><\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">On the monitor for SERVER 2, we\u2019ll setup actions similarly, except when it fires actions it will run:<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Stop services on SERVER 2<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Start services on SERVER 1<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Now we have what we want \u2013 when a watch service in a set on SERVER 1 stops, all services in the set will be stopped, and the set of services will be started on SERVER 2.\u00a0 \u00a0And vice versa.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have a customer with a scenario where a set of services run on SERVER1 -or- SERVER2.\u00a0 If any service in a set fails, everything in the set should be stopped and the entire set should be started on the other server.\u00a0 Below I\u2019ll describe how to implement this. \u00a0 In my example I\u2019ll assume [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,57,10,9,8],"tags":[],"class_list":["post-6785","post","type-post","status-publish","format-standard","hentry","category-how-to","category-monitoring","category-power-admin","category-technical","category-windows"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts\/6785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/comments?post=6785"}],"version-history":[{"count":5,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts\/6785\/revisions"}],"predecessor-version":[{"id":6795,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts\/6785\/revisions\/6795"}],"wp:attachment":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/media?parent=6785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/categories?post=6785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/tags?post=6785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}