Merge "Add alerts for kafka and nodemgr-database only for analytics nodes"
diff --git a/opencontrail/meta/prometheus.yml b/opencontrail/meta/prometheus.yml
index 9eadf93..acc522b 100644
--- a/opencontrail/meta/prometheus.yml
+++ b/opencontrail/meta/prometheus.yml
@@ -1,5 +1,5 @@
 {%- if pillar.opencontrail is defined %}
-  {%- from "opencontrail/map.jinja" import control, collector, compute, config, database, web, monitoring with context %}
+  {%- from "opencontrail/map.jinja" import control, collector, compute, config, database, web, monitoring, version with context %}
 
   {%- if database.get('enabled', False) and
          database.get('cassandra', False) and
@@ -25,7 +25,15 @@
         template: opencontrail/files/jmx_exporter_cassandra.conf
         jmx_bind:
           address: localhost
+          {%- if version < 4.0 %}
           port: 7199
+          {%- else %}
+          {%- if database.get('type') == 'control' or database.get('type') == 'cluster' %}
+          port: 7198
+          {%- elif database.get('type') == 'analytics' %}
+          port: 7199
+          {%- endif %}
+          {%- endif %}
         bind:
           address: 0.0.0.0
           port: 9111
diff --git a/opencontrail/meta/telegraf.yml b/opencontrail/meta/telegraf.yml
index a93cd0c..ef973fc 100644
--- a/opencontrail/meta/telegraf.yml
+++ b/opencontrail/meta/telegraf.yml
@@ -135,14 +135,16 @@
   {%- endif %}
   {%- if database is defined and database.get('enabled', False) %}
     zookeeper:
-      address: "{{ database.bind.host|replace('0.0.0.0', '127.0.0.1') }}"
+    {%- set addr=database.bind.host|replace('0.0.0.0', '127.0.0.1') %}
       {%- if version < 4.0 %}
-      port: 2181
+      urls: ["{{ addr }}:2181"]
       {%- else %}
-      {%- if database.get('type') == 'control' or database.get('type') == 'cluster' %}
-      port: 2181
+      {%- if database.get('type') == 'control'%}
+      urls: ["{{ addr }}:2181"]
       {%- elif database.get('type') == 'analytics' %}
-      port: 2182
+      urls: ["{{ addr }}:2182"]
+      {%- elif database.get('type') == 'cluster' %}
+      urls: ["{{ addr }}:2181", "{{ addr }}:2182"]
       {%- endif %}
       {%- endif %}
   {%- endif %}