Split monitoring stack to dedicated services

In order to introducing prometheus long term storage
we need to have an ability to arrange monitoring docker
services in a more flexible way. Ie be able to enable
or disable particular service.

Docker stack and prometheus target DNS branches are affected.

Change-Id: I0310c716bd39f780ae0080032cad4a2278132bcb
Partial-fix: PROD-17350
diff --git a/docker/swarm/stack/monitoring/prometheus_global.yml b/docker/swarm/stack/monitoring/prometheus_global.yml
index 9745638..6d8e4ba 100644
--- a/docker/swarm/stack/monitoring/prometheus_global.yml
+++ b/docker/swarm/stack/monitoring/prometheus_global.yml
@@ -1,131 +1,8 @@
 classes:
-- system.prometheus.alertmanager.container
-- system.prometheus.pushgateway.container
-- system.prometheus.remote_storage_adapter.container
-- system.prometheus.server.container
+- system.docker.swarm.stack.monitoring.prometheus
+- system.docker.swarm.stack.monitoring.prometheus.global
+- system.docker.swarm.stack.monitoring.alertmanager
+- system.docker.swarm.stack.monitoring.prometheus_relay
+- system.docker.swarm.stack.monitoring.pushgateway
 - system.docker.swarm.stack.monitoring.remote_agent
-parameters:
-  _param:
-    # Backward compatibility for Prometheus 1.7
-    prometheus_storage_local_engine: "persisted"
-    prometheus_storage_heap_size: 3221225472
-    prometheus_storage_num_fingerprint_mutexes: 4096
-
-  docker:
-    client:
-      stack:
-        monitoring:
-          network:
-            monitoring:
-              driver: overlay
-              driver_opts:
-                encrypted: 1
-          service:
-            relay:
-              networks:
-                - monitoring
-              deploy:
-                replicas: 2
-                labels:
-                  com.mirantis.monitoring: "relay"
-                restart_policy:
-                  condition: any
-              labels:
-                com.mirantis.monitoring: "relay"
-              image: ${_param:docker_image_prometheus_relay}
-              ports:
-                - 15016:8080
-              environment:
-                PROMETHEUS_RELAY_DNS: 'tasks.monitoring_server'
-            remote_storage_adapter:
-              networks:
-                - monitoring
-              deploy:
-                replicas: 1
-                labels:
-                  com.mirantis.monitoring: "remote_storage_adapter"
-                restart_policy:
-                  condition: any
-              labels:
-                com.mirantis.monitoring: "remote_storage_adapter"
-              image: ${_param:docker_image_remote_storage_adapter}
-              ports:
-                - 15015:${prometheus:remote_storage_adapter:bind:port}
-              environment:
-                RSA_BIND_PORT: ${prometheus:remote_storage_adapter:bind:port}
-                RSA_BIND_ADDRESS: ${prometheus:remote_storage_adapter:bind:address}
-                RSA_INFLUXDB_RETENTION_POLICY: 'lma'
-                RSA_INFLUXDB_URL: ${_param:prometheus_influxdb_url}
-                RSA_INFLUXDB_DB: ${_param:prometheus_influxdb_db}
-                RSA_INFLUXDB_USERNAME: ${_param:prometheus_influxdb_username}
-                RSA_INFLUXDB_PASSWORD: ${_param:prometheus_influxdb_password}
-            alertmanager:
-              networks:
-                - 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:
-                - ${prometheus:alertmanager:dir:config}:${_param:prometheus_alertmanager_config_directory}
-                - ${prometheus:alertmanager:dir:data}:${_param:prometheus_alertmanager_data_directory}
-              environment:
-                ALERTMANAGER_CONFIG_DIR: ${_param:prometheus_alertmanager_config_directory}
-                ALERTMANAGER_DATA_DIR: ${_param:prometheus_alertmanager_data_directory}
-                ALERTMANAGER_BIND_PORT: ${prometheus:alertmanager:bind:port}
-                ALERTMANAGER_BIND_ADDRESS: ${prometheus:alertmanager:bind:address}
-                ALERTMANAGER_DISCOVERY_DOMAIN: 'monitoring_alertmanager'
-                ALERTMANAGER_EXTERNAL_URL: "http://${_param:stacklight_monitor_address}:15011"
-            pushgateway:
-              networks:
-                - monitoring
-              deploy:
-                replicas: 2
-                labels:
-                  com.mirantis.monitoring: "pushgateway"
-                restart_policy:
-                  condition: any
-              environment:
-                PUSHGATEWAY_BIND_PORT: ${prometheus:pushgateway:bind:port}
-                PUSHGATEWAY_BIND_ADDRESS: ${prometheus:pushgateway:bind:address}
-              labels:
-                com.mirantis.monitoring: "pushgateway"
-              image: ${_param:docker_image_pushgateway}
-              ports:
-                - 15012:${prometheus:pushgateway:bind:port}
-            server:
-              networks:
-                - monitoring
-              deploy:
-                mode: global
-                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:
-                - ${prometheus:server:dir:config}:${_param:prometheus_server_config_directory}
-                - ${prometheus:server:dir:data}:${_param:prometheus_server_data_directory}
-              environment:
-                PROMETHEUS_CONFIG_DIR: ${_param:prometheus_server_config_directory}
-                PROMETHEUS_DATA_DIR: ${_param:prometheus_server_data_directory}
-                PROMETHEUS_BIND_PORT: ${prometheus:server:bind:port}
-                PROMETHEUS_BIND_ADDRESS: ${prometheus:server:bind:address}
-                PROMETHEUS_STORAGE_LOCAL_RETENTION: ${prometheus:server:storage:local:retention}
-                PROMETHEUS_EXTERNAL_URL: "http://${_param:stacklight_monitor_address}:15010"
-                # Backward compatibility for Prometheus 1.7
-                PROMETHEUS_STORAGE_LOCAL_ENGINE: ${_param:prometheus_storage_local_engine}
-                PROMETHEUS_STORAGE_LOCAL_TARGET_HEAP_SIZE: ${_param:prometheus_storage_heap_size}
-                PROMETHEUS_STORAGE_LOCAL_NUM_FINGERPRINT_MUTEXES: ${_param:prometheus_storage_num_fingerprint_mutexes}
-                PROMETHEUS_USE_STATIC_DATADIR: "true"
+- system.docker.swarm.stack.monitoring.remote_storage_adapter