Add collectd support for Keystone

Change-Id: I7edb67d2dfb7c70ce2fa0a41df48447c94d0cc22
diff --git a/keystone/files/collectd_check_openstack_api.conf b/keystone/files/collectd_check_openstack_api.conf
new file mode 100644
index 0000000..9dfdcdd
--- /dev/null
+++ b/keystone/files/collectd_check_openstack_api.conf
@@ -0,0 +1,10 @@
+Import "check_openstack_api"
+
+<Module "check_openstack_api">
+    KeystoneUrl "{{ plugin.url }}"
+    Username "{{ plugin.username }}"
+    Password "{{ plugin.password }}"
+    Tenant "{{ plugin.tenant }}"
+    MaxRetries "2"
+    Timeout "20"
+</Module>
diff --git a/keystone/files/collectd_openstack_keystone.conf b/keystone/files/collectd_openstack_keystone.conf
new file mode 100644
index 0000000..61ea023
--- /dev/null
+++ b/keystone/files/collectd_openstack_keystone.conf
@@ -0,0 +1,10 @@
+Import "openstack_keystone"
+
+<Module "openstack_keystone">
+    KeystoneUrl "{{ plugin.url }}"
+    Username "{{ plugin.username }}"
+    Password "{{ plugin.password }}"
+    Tenant "{{ plugin.tenant }}"
+    MaxRetries "2"
+    Timeout "20"
+</Module>
diff --git a/keystone/meta/collectd.yml b/keystone/meta/collectd.yml
new file mode 100644
index 0000000..62f9a5a
--- /dev/null
+++ b/keystone/meta/collectd.yml
@@ -0,0 +1,17 @@
+{%- from "keystone/map.jinja" import server with context %}
+
+remote_plugin:
+  openstack_keystone:
+    plugin: python
+    template: keystone/files/collectd_openstack_keystone.conf
+    url: "http://{{ server.bind.public_address }}:{{ server.bind.public_port }}/v{% if server.get('api_version', 2)|int == 2 %}2.0{% else %}3{% endif %}"
+    username: {{ server.admin_name }}
+    password: {{ server.admin_password }}
+    tenant: {{ server.admin_tenant }}
+  check_openstack_api:
+    plugin: python
+    template: keystone/files/collectd_check_openstack_api.conf
+    url: "http://{{ server.bind.public_address }}:{{ server.bind.public_port }}/v{% if server.get('api_version', 2)|int == 2 %}2.0{% else %}3{% endif %}"
+    username: {{ server.admin_name }}
+    password: {{ server.admin_password }}
+    tenant: {{ server.admin_tenant }}
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index d982699..1e6a177 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -2,7 +2,7 @@
   keystone:
     _support:
       collectd:
-        enabled: false
+        enabled: true
       heka:
         enabled: true
       sensu:
@@ -10,4 +10,4 @@
       sphinx:
         enabled: true
       config:
-        enabled: true
\ No newline at end of file
+        enabled: true