Change monitoring config dir

Add monitoring data dir

Change-Id: I3df723161503cee88b154308a063aa943db17a6a
Depends-On: Ie89009480c06cafb15bb06ded263e49ef194dfc9
diff --git a/docker/swarm/stack/monitoring.yml b/docker/swarm/stack/monitoring.yml
index bbc2d24..091add5 100644
--- a/docker/swarm/stack/monitoring.yml
+++ b/docker/swarm/stack/monitoring.yml
@@ -2,6 +2,8 @@
 - service.prometheus.server.container
 - service.prometheus.alertmanager.container
 - service.prometheus.pushgateway.container
+- system.prometheus.server
+- system.prometheus.alertmanager
 parameters:
   docker:
     client:
@@ -18,15 +20,21 @@
                 - monitoring
               deploy:
                 replicas: 2
+                labels:
+                  com.mirantis.monitoring: "alertmanager"
                 restart_policy:
                   condition: any
+              labels:
+                com.mirantis.monitoring: "alertmanager"
               image: ${_param:docker_image_alertmanager}
               ports:
                 - 15011:${prometheus:alertmanager:bind:port}
               volumes:
-                - /srv/volumes/prometheus:/opt/alertmanager/config
+                - ${prometheus:alertmanager:dir:config}:${_param:prometheus_alertmanager_config_directory}
+                - ${prometheus:alertmanager:dir:data}:${_param:prometheus_alertmanager_data_directory}
               environment:
-                config_dir: /opt/alertmanager/config
+                config_dir: ${_param:prometheus_alertmanager_config_directory}
+                data_dir: ${_param:prometheus_alertmanager_data_directory}
                 bind_port: ${prometheus:alertmanager:bind:port}
                 bind_address: ${prometheus:alertmanager:bind:address}
                 discovery_domain: 'monitoring_alertmanager'
@@ -35,11 +43,15 @@
                 - monitoring
               deploy:
                 replicas: 2
+                labels:
+                  com.mirantis.monitoring: "pushgateway"
                 restart_policy:
                   condition: any
               environment:
                 bind_port: ${prometheus:pushgateway:bind:port}
                 bind_address: ${prometheus:pushgateway:bind:address}
+              labels:
+                com.mirantis.monitoring: "pushgateway"
               image: ${_param:docker_image_pushgateway}
               ports:
                 - 15012:${prometheus:pushgateway:bind:port}
@@ -48,15 +60,21 @@
                 - monitoring
               deploy:
                 replicas: 1
+                labels:
+                  com.mirantis.monitoring: "prometheus"
                 restart_policy:
                   condition: any
+              labels:
+                com.mirantis.monitoring: "prometheus"
               image: ${_param:docker_image_prometheus}
               ports:
                 - 15010:${prometheus:server:bind:port}
               volumes:
-                - /srv/volumes/prometheus:/opt/prometheus/config
+                - ${prometheus:server:dir:config}:${_param:prometheus_server_config_directory}
+                - ${prometheus:server:dir:data}:${_param:prometheus_server_data_directory}
               environment:
-                config_dir: /opt/prometheus/config
+                config_dir: ${_param:prometheus_server_config_directory}
+                data_dir: ${_param:prometheus_server_data_directory}
                 bind_port: ${prometheus:server:bind:port}
                 bind_address: ${prometheus:server:bind:address}
                 alertmanager_port: ${prometheus:alertmanager:bind:port}
diff --git a/prometheus/alertmanager/init.yml b/prometheus/alertmanager/init.yml
new file mode 100644
index 0000000..e7ba562
--- /dev/null
+++ b/prometheus/alertmanager/init.yml
@@ -0,0 +1,4 @@
+parameters:
+  _param:
+    prometheus_alermanager_config_directory: /srv/alertmanager
+    prometheus_alermanager_data_directory: /data
diff --git a/prometheus/server/init.yml b/prometheus/server/init.yml
new file mode 100644
index 0000000..0ecea17
--- /dev/null
+++ b/prometheus/server/init.yml
@@ -0,0 +1,4 @@
+parameters:
+  _param:
+    prometheus_server_config_directory: /srv/prometheus
+    prometheus_server_data_directory: /data
diff --git a/prometheus/server/target/dns.yml b/prometheus/server/target/dns.yml
index 14d5da3..7bbf92e 100644
--- a/prometheus/server/target/dns.yml
+++ b/prometheus/server/target/dns.yml
@@ -1,7 +1,3 @@
-classes:
-- service.prometheus.server.container
-- service.prometheus.alertmanager.container
-- service.prometheus.pushgateway.container
 parameters:
   prometheus:
     server:
diff --git a/prometheus/server/target/etcd.yml b/prometheus/server/target/etcd.yml
index 4cd04bf..0ac3310 100644
--- a/prometheus/server/target/etcd.yml
+++ b/prometheus/server/target/etcd.yml
@@ -8,6 +8,6 @@
             scheme: https
             tls_config:
               skip_verify: true
-              ssl_dir: /opt/prometheus/config
+              ssl_dir: ${_param:prometheus_server_config_directory}
               cert_name: prometheus-server.crt
               key_name: prometheus-server.key
diff --git a/prometheus/server/target/kubernetes.yml b/prometheus/server/target/kubernetes.yml
index d7ba3d6..60ca1e0 100644
--- a/prometheus/server/target/kubernetes.yml
+++ b/prometheus/server/target/kubernetes.yml
@@ -5,6 +5,6 @@
         kubernetes:
           enabled: true
           api_ip: ${_param:kubernetes_control_address}
-          ssl_dir: /opt/prometheus/config
+          ssl_dir: ${_param:prometheus_server_config_directory}
           cert_name: prometheus-server.crt
           key_name: prometheus-server.key
diff --git a/salt/minion/cert/prometheus_server.yml b/salt/minion/cert/prometheus_server.yml
index 23c4abf..30a0711 100644
--- a/salt/minion/cert/prometheus_server.yml
+++ b/salt/minion/cert/prometheus_server.yml
@@ -5,8 +5,8 @@
         prometheus_server:
           host: ${_param:salt_minion_ca_host}
           authority: ${_param:salt_minion_ca_authority}
-          key_file: /srv/volumes/prometheus/prometheus-server.key
-          cert_file: /srv/volumes/prometheus/prometheus-server.crt
+          key_file: ${prometheus:server:dir:config}/prometheus-server.key
+          cert_file: ${prometheus:server:dir:config}/prometheus-server.crt
           common_name: prometheus-server
           signing_policy: cert_client
           alternative_names: IP:${_param:cluster_vip_address},IP:${_param:cluster_node01_address},IP:${_param:cluster_node02_address},IP:${_param:cluster_node03_address},IP:${_param:kubernetes_internal_api_address}