{"id":245,"date":"2015-06-09T15:46:46","date_gmt":"2015-06-09T18:46:46","guid":{"rendered":"http:\/\/monitor.infracoop.com.ar\/blog\/?p=245"},"modified":"2015-06-09T15:46:46","modified_gmt":"2015-06-09T18:46:46","slug":"monitoreando-postgresql-remotamente-con-newrelic","status":"publish","type":"post","link":"https:\/\/www.infracoop.com.ar\/?p=245","title":{"rendered":"Monitoreando PostgreSQL remotamente con Newrelic"},"content":{"rendered":"<p>Hoy vamos a ver c\u00f3mo monitorear remotamente una instancia de PostgreSQL utilizando <a href=\"http:\/\/www.newrelic.com\" target=\"_blank\">Newrelic<\/a><\/p>\n<p>Esta tarea no lleva mayores inconvenientes si seguimos los pasos descriptos en <a href=\"https:\/\/github.com\/MeetMe\/newrelic-plugin-agent\" target=\"_blank\">la pagina del proveedor del plugin:<\/a><\/p>\n<pre># pip install newrelic-plugin-agent[postgresql]<\/pre>\n<p>pero puede complicarse si no tenemos acceso como usuario <em>root<\/em> a la m\u00e1quina donde querramos instalar el agente. Y m\u00e1s si no tenemos ni pip ni postgresql instalados en esa m\u00e1quina.<\/p>\n<h2><strong>Instalando PIP en el home del usuario<br \/>\n<\/strong><\/h2>\n<p>Siguiendo los pasos de la <a href=\"https:\/\/pip.pypa.io\/en\/latest\/installing.html\">p\u00e1gina de pip<\/a> descargamos el programa &#8216;get-pip.py&#8217; y ejecutamos:<\/p>\n<pre>$ python get-pip.py --user<\/pre>\n<p>(esto instala pip en ~\/.local\/bin)<\/p>\n<p>Ahora, revisemos si tenemos postgres instalado (sus binarios, espec\u00edficamente vamos a necesitar el pg_config)<\/p>\n<pre>$ which pg_config<\/pre>\n<p>Si no obtenemos la ruta donde est\u00e1 este programa, deberemos instalarlo.<\/p>\n<h3>Instalando PostgreSQL en el home del usuario<\/h3>\n<p>Para este ejemplo, instalaremos la \u00faltima versi\u00f3n de la rama 9.3:<\/p>\n<pre>$ wget https:\/\/ftp.postgresql.org\/pub\/source\/v9.3.8\/postgresql-9.3.8.tar.gz\r\n$ mkdir src\r\n$ cd src\/\r\n$ tar xvfz ..\/postgresql-9.3.8.tar.gz\r\n$ cd postgresql-9.3.8\r\n$ .\/configure --prefix ~\/local --exec-prefix ~\/bin\r\n$ make\r\n$ make install\r\n$ cd\r\n$ export PATH=`pwd`\/bin\/bin:$PATH<\/pre>\n<p>Y ahora si, which pg_config deber\u00eda decir algo como \u00e9sto:<\/p>\n<pre>~$ which pg_config\r\n\/home\/user\/bin\/bin\/pg_config<\/pre>\n<h4>Finalmente, podemos instalar el agente<\/h4>\n<pre>$ pip install newrelic-plugin-agent[postgresql] --user<\/pre>\n<p>Nuevamente, esto instalar\u00e1 el agente en ~\/.local\/bin\/newrelic-plugin-agent.<\/p>\n<p>Para ejecutarlo, debemos crear un archivo de configuraci\u00f3n que contenga:<\/p>\n<pre>%YAML 1.2\r\n---\r\nApplication:\r\n license_key: [la key que nos provee newrelic]\r\n wake_interval: 60\r\npostgresql:\r\n host: [host remoto a monitorear]\r\n port: 5432\r\n user: [user]\r\n password: [passwd]\r\n dbname: [database]\r\n superuser: [true|false]<\/pre>\n<p>Y podremos llamar al agente ejecutando:<\/p>\n<pre>$ export PATH=~\/.local\/bin:$PATH\r\n$ newrelic-plugin-agent -c \/path\/to\/newrelic-plugin-conf<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hoy vamos a ver c\u00f3mo monitorear remotamente una instancia de PostgreSQL utilizando Newrelic Esta tarea no lleva mayores inconvenientes si seguimos los pasos descriptos en la pagina&hellip; <span class=\"read-more\"><a class=\"more-link\" href=\"https:\/\/www.infracoop.com.ar\/?p=245\" rel=\"bookmark\">Read more <span class=\"screen-reader-text\">&#8220;Monitoreando PostgreSQL remotamente con Newrelic&#8221;<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,32,22],"tags":[54,53,34,61],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-cloud-computing","category-postgresql","category-tips","tag-monitoreo","tag-newrelic","tag-performance","tag-postgresql"],"_links":{"self":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=245"}],"version-history":[{"count":4,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":253,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions\/253"}],"wp:attachment":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}