Added new variable for prometheus

Added the following:
Variable:
- PROMETHEUS_USE_STATIC_DATADIR

in order to control usage of the data_dir discovery
on the prometheus server nodes (docker swarm containers)
as optionally prometheus service could be created
in a mode: global, resulting in one replica per node
constraint.

All this is put into a dedicated prometheus_global.yml,
which later can be used in a way of:
-- system.docker.swarm.stack.monitoring
+- system.docker.swarm.stack.monitoring.prometheus_global

Change-Id: Ia113e603edcb19913e80b569577e04ed20d95e2a
Related-Bug: PROD-16771
diff --git a/docker/swarm/stack/monitoring/prometheus_global.yml b/docker/swarm/stack/monitoring/prometheus_global.yml
new file mode 100644
index 0000000..9745638
--- /dev/null
+++ b/docker/swarm/stack/monitoring/prometheus_global.yml
@@ -0,0 +1,131 @@
+classes:
+- system.prometheus.alertmanager.container
+- system.prometheus.pushgateway.container
+- system.prometheus.remote_storage_adapter.container
+- system.prometheus.server.container
+- 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"