The sourcegraph/prometheus image provides an all-in-one image through prom-wrapper with:
- Vanilla Prometheus with embedded Sourcegraph configuration
- Bundled Alertmanager with a
siteConfigSubscribersidecar service to automatically apply relevant configuration changes to Alertmanager
To learn more, refer to the Sourcegraph observability developer guide and monitoring architecture.
docker run \
-v ${PROMETHEUS_DISK}:/prometheus \
-v ${CONFIG_DIR}:/sg_prometheus_add_ons \
sourcegraph/prometheusImage expects two volumes mounted:
- at
/prometheusa data directory where logs, the tsdb and other prometheus data files will live - at
/sg_prometheus_add_onsa directory that contains additional config files of two types:- rule files which must have the suffix
_rules.ymlin their filename (iegitserver_rules.yml) - target files which must have the suffix
_targets.ymlin their filename (ielocal_targets.yml) - if this directory contains a file named
prometheus.ymlit will be used as the main prometheus config file
- rule files which must have the suffix
You can specify additional flags to pass to Prometheus by setting the environment variable PROMETHEUS_ADDITIONAL_FLAGS, and similarly for Alertmanager, you can set the environment variable ALERTMANAGER_ADDITIONAL_FLAGS. For example, this can be used to leverage high-availability Alertmanager alongside ALERTMANAGER_ENABLE_CLUSTER=true.
prom-wrapper also accepts a few configuration options through environment variables - see cmd/prom-wrapper/main.go for more details.
Alertmanager components can be disabled entirely with DISABLE_ALERTMANAGER=true.