Skip to main content

Environment Variables

All Ops Platform configuration is passed in through environment variables: written in ops.yaml for Docker Compose, or in a ConfigMap for Kubernetes. The tables below are grouped by purpose. Anything not marked as required is optional and falls back to its default if unset.

General / Gateway

Environment VariableDescription
ENV_OPS_TOKENAccess authentication key for the Ops Platform; be sure to change it on first deployment
ENV_OPS_SUB_PATHReverse proxy sub-path. Not needed for direct port access; once set, both the gateway and Grafana automatically adapt GF_SERVER_ROOT_URL and GF_SERVER_SERVE_FROM_SUB_PATH. Example: /mdis
ENV_OPS_PORTInternal listening port of ops-server, default 8081, usually no need to change
ENV_OPS_GATEWAY_PORTExternal port of the gateway, default 48881

Host Monitoring (Node Exporter)

Environment VariableDescription
ENV_PROMETHEUS_HOSTNode_Exporter service address; replace with the actual server IP. The port is fixed at 59100; use commas to separate multiple Node_Exporters, in the format custom-hostname/IP:59100.
For Docker Compose deployments, Node_Exporter defaults to a single node — just fill in the server's own internal IP. Example: hap_1/192.168.1.12:59100
For Kubernetes deployments, Node_Exporter runs on multiple nodes; use commas to separate them. Example: service_01/192.168.1.12:59100,service_02/192.168.1.13:59100

Cluster Monitoring (Kubernetes)

Since Ops Platform 1.3.0, monitoring a Kubernetes cluster (nodes, containers, Pods, cluster object state) is supported. For full configuration, see Kubernetes Cluster Monitoring.

Environment VariableDescription
ENV_K8S_MONITOR_MODEK8s monitoring mode: off (default, disabled) / static (outside the cluster, Docker Compose remote scraping) / incluster (inside the cluster, Pod-based auto-discovery)
ENV_PROMETHEUS_K8S_KSMkube-state-metrics address in static mode, in the format alias/IP:NodePort. Example: k8s/192.168.1.10:30080
ENV_PROMETHEUS_K8S_NODEK8s node_exporter address in static mode; comma-separated for multiple nodes. Example: n1/192.168.1.10:30081,n2/192.168.1.11:30081
ENV_PROMETHEUS_K8S_KUBELETkubelet HTTPS endpoint in static mode (for scraping container-level cAdvisor metrics), in the format alias/IP:10250; comma-separated for multiple nodes. Example: n1/192.168.1.10:10250
ENV_K8S_BEARER_TOKENServiceAccount token used to scrape kubelet in static mode (requires nodes/proxy permission, provided by 15-metrics-reader.yaml)
ENV_K8S_BEARER_TOKEN_FILESame as above, but using the path to an already-mounted token file (choose either this or ENV_K8S_BEARER_TOKEN)
ENV_K8S_KSM_NAMESPACENamespace where kube-state-metrics runs in incluster mode, default mdis-monitoring

Middleware Exporter Proxy Addresses

Environment VariableDescription
ENV_PROMETHEUS_KAFKAKafka monitoring proxy address; defaults usually fine. Example: kafka_1/agent:9308
ENV_PROMETHEUS_ELASTICSEARCHElasticsearch monitoring proxy address; defaults usually fine. Example: elasticsearch_1/agent:9114
ENV_PROMETHEUS_REDISRedis monitoring proxy address; defaults usually fine. Example: redis_1/agent:9121
ENV_PROMETHEUS_MONGODBMongoDB monitoring proxy address; defaults usually fine. Example: mongodb_1/agent:9216
ENV_PROMETHEUS_MYSQLMySQL monitoring proxy address; defaults usually fine. Example: mysql_1/agent:9104
ENV_PROMETHEUS_SERVERPrometheus internal access address. Example: http://ops-prometheus:9090

Middleware Connection Details

Environment VariableDescription
ENV_MYSQL_HOSTMySQL database host address. Example: 10.206.0.6
ENV_MYSQL_PORTMySQL database connection port. Example: 3306
ENV_MYSQL_USERNAMEMySQL database username. Example: root
ENV_MYSQL_PASSWORDMySQL database password. Example: 123456
ENV_MONGODB_URIMongoDB connection URI. Example: mongodb://root:123456@10.206.0.6:27017
Replica set example: mongodb://root:123456@10.206.0.6:27017,10.206.0.7:27017,10.206.0.8:27017
ENV_MONGODB_OPTIONSAdditional MongoDB connection options, typically specifying the auth database as admin. If the database has no authentication enabled, this can be left empty. Example: ?authSource=admin
ENV_REDIS_HOSTRedis database host address. Example: 10.206.0.6
ENV_REDIS_PORTRedis database connection port. Example: 6379
ENV_REDIS_PASSWORDRedis database password. Example: 123456
ENV_KAFKA_ENDPOINTSKafka service address. For a cluster, just fill in one node. Example: 10.206.0.6:9092
ENV_ELASTICSEARCH_ENDPOINTSElasticsearch service address. For a cluster, just fill in one node. Example: http://10.206.0.6:9200
ENV_ELASTICSEARCH_PASSWORDElasticsearch user and password. Example: elastic:your-es-password
ENV_FLINK_URLFlink Web service address; can be commented out if not needed or Flink is not deployed. Example: http://flink:8081

Data Source Registry Mode (Since 1.4.0, Optional)

By default (ENV_PROMETHEUS_SD_MODE=env), middleware monitoring targets are statically configured via the environment variables above. Since 1.4.0, you can switch to http mode: monitoring targets are managed centrally on the Ops Platform UI's Data Source page (multiple Kafka / MongoDB / MySQL / Redis / Elasticsearch instances can be added), the agent automatically starts the corresponding exporters based on the registry, and Prometheus scrape targets are also driven by the registry — no more editing environment variables or restarting containers.

Environment VariableDescription
ENV_PROMETHEUS_SD_MODEService discovery mode: env (default, static configuration via environment variables) / http (driven by the UI data source registry). Must be configured on both the ops-prometheus and agent services
ENV_OPS_SD_URLAddress at which ops-prometheus / agent reach the registry (ops-server) in http mode, default http://gateway:8081
ENV_OPS_SD_TOKENAccess token for the registry interface in http mode; keep it consistent across gateway, ops-prometheus, and agent. When empty, no validation is performed (recommended only for Docker internal networks)
ENV_AGENT_SD_HOSTHostname of the agent service in http mode (for Prometheus to address the exporters), default agent, usually no need to change

Data Retention Periods

Environment VariableDescription
ENV_PROMETHEUS_RETENTIONPrometheus metrics data retention period, default 15d if unset. Example: 30d
ENV_LOKI_RETENTIONLoki log data retention period, default 720h (30 days) if unset. Example: 360h
ENV_TEMPO_RETENTIONTempo trace data retention period, default 720h (30 days) if unset. Example: 360h

Observability Collection (Alloy)

Environment VariableDescription
ENV_TEMPO_GRPC_URLgRPC address for alloy to forward trace data to Tempo. Example: http://ops-tempo:4317
ENV_PROMETHEUS_REMOTE_WRITE_URLAddress for alloy to report metrics to Prometheus via remote_write. Example: http://ops-prometheus:9090/prometheus/server/api/v1/write
ENV_LOKI_PUSH_URLHTTP API address for alloy to push logs to Loki. Example: http://ops-loki:3100/loki/api/v1/push

Log Storage Backend (Loki S3/MinIO, Optional)

Uses Loki's local filesystem storage when unset.

Environment VariableDescription
ENV_S3_ENDPOINTS3-compatible storage endpoint. Example: http://minio:9000
ENV_S3_BUCKETBucket name for storing logs. Example: loki
ENV_S3_ACCESS_KEYS3 access key
ENV_S3_SECRET_KEYS3 secret key

Alert Subsystem (Since 1.4.0)

Ops Platform 1.4.0 includes a built-in, self-developed alert subsystem. Alert configuration data (rules/state/history/notification channels/data sources) is stored in a dedicated ops-mongo container, fully decoupled from the business MongoDB being monitored.

Environment VariableDescription
ENV_OPS_MONGODB_URIMongoDB connection address for the alert subsystem's own storage, pointing to the built-in ops-mongo container by default. Example: mongodb://ops-mongo:27017
ENV_MONGODB_COLLECTION_PREFIXCommon prefix for the alert subsystem's collection names. Example: mdis_
ENV_ALERT_CRYPTO_KEYAES encryption key for data source credentials (passwords/URIs) before they are persisted. Be sure to change it to a random string on first deployment and keep it safe. After changing the key, previously saved credentials can no longer be decrypted and must be re-entered

Alert notification channels (Feishu / DingTalk / WeCom / Email / custom Webhook) are configured on the Alert → Notification Channels page in the Ops Platform UI, no longer via environment variables. The SMTP server details for the email channel are also entered on that page.