{"id":1616,"date":"2011-10-11T19:37:06","date_gmt":"2011-10-12T00:37:06","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=1616"},"modified":"2011-10-11T19:39:32","modified_gmt":"2011-10-12T00:39:32","slug":"querying-load-balancing-information-from-the-lad-balancing-advisory","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2011\/10\/11\/querying-load-balancing-information-from-the-lad-balancing-advisory\/","title":{"rendered":"Querying load balancing information from the Load Balancing Advisory"},"content":{"rendered":"<p>I use what is below to periodically gather what the load balancing advisory posts.  The data reflects the percentage of connections to distribute to each instance for a given service in a RAC.<\/p>\n<pre lang=\"python\" line=\"1\">\r\n#!\/home\/oracle\/local\/bin\/python\r\n\r\nimport cx_Oracle, string\r\n\r\nconn = cx_Oracle.connect(mode = cx_Oracle.SYSDBA)\r\ncursor = conn.cursor()\r\n\r\ncursor.execute(\"select to_char(from_tz(enq_time,'GMT') at time zone sessiontimezone,'YYYY\/MM\/DD HH24:MI:SS'),t.user_data.srv,t.user_data.payload from sys.sys$service_metrics_tab t order by t.enq_time\")\r\n\r\n\"\"\"\r\n\r\nVERSION=1.0 database=wcprod service=wcpfan { {instance=wcprod3 percent=14 flag=GOOD aff=TRUE}{instance=wcprod1 percent=20 flag=GOOD aff=TRUE}{instance=wcprod2 percent=66 flag=GOOD aff=TRUE} }\r\n\r\n\"\"\"\r\n\r\nfor r in cursor:\r\n  payload = r[2]\r\n  dist=payload[payload.find(\"{ {\") + 2:payload.rfind(\"}\")]\r\n  while dist.find(\"}\") > 0:\r\n\r\n    tmp=dist[dist.find(\"{ {\") + 2:dist.rfind(\"}\")]\r\n    tmp=tmp[:tmp.find(\"}\")]\r\n    instance=tmp[:tmp.find(\" \")+1]\r\n    instance=instance[instance.find(\"=\")+1:]\r\n    tmp=tmp[tmp.find(\" \")+1:]\r\n    print r[0],instance,\r\n\r\n    instance=tmp[2:tmp.find(\" \")+1]\r\n    tmp=tmp[tmp.find(\" \"):]\r\n    instance=instance[instance.find(\"=\")+1:]\r\n    tmp=tmp[tmp.find(\" \")+1:]\r\n    print instance,\r\n\r\n    instance=tmp[2:tmp.find(\" \")+1]\r\n    tmp=tmp[tmp.find(\" \"):]\r\n    instance=instance[instance.find(\"=\")+1:]\r\n    tmp=tmp[tmp.find(\" \")+1:]\r\n    print instance\r\n\r\n    dist=dist[dist.find(\"}\")+1:]\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I use what is below to periodically gather what the load balancing advisory posts. The data reflects the percentage of connections to distribute to each instance for a given service in a RAC. #!\/home\/oracle\/local\/bin\/python import cx_Oracle, string conn = cx_Oracle.connect(mode&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2011\/10\/11\/querying-load-balancing-information-from-the-lad-balancing-advisory\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,22,26,32],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1616"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1616"}],"version-history":[{"count":6,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1616\/revisions"}],"predecessor-version":[{"id":1621,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1616\/revisions\/1621"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1616"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}