Server component of VictoriaMetrics Anomaly Detection (vmanomaly) is responsible for serving the REST API (e.g. /metrics endpoint) and the
web UI
for anomaly detection.
If set, it also acts as metrics publishing endpoint for VictoriaMetrics Agent or other Prometheus-compatible scrapers to collect
self-monitoring metrics
, so no monitoring.pull is needed to be set in such cases.
Parameters #
addr, port, path_prefix, uvicorn_config, ui_default_state, and max_concurrent_tasks parameters can be set in the server section of the vmanomaly configuration file. Below is the description of each parameter:
addr: IP address of the query server to listen on. Default is0.0.0.0.port: Port of the query server to listen on. Default is8490.path_prefix: Optional URL path prefix for all HTTP routes. If set tomy-appor/my-app, routes will be served under<vmanomaly-host>:<port>/my-app/....ui_default_state: Optional UI state fragment to open on/vmui/. Must be URL-encoded and start with#/?(e.g.#/?param=value). See Default State section for details on constructing the value from UI state.max_concurrent_tasks: Maximum number of concurrent anomaly detection tasks processed by the backend. Positive integer. All tasks above the limit will be cancelled if the limit is exceeded. Defaults to2.uvicorn_config: Uvicorn configuration dictionary. Default is{"log_level": "warning"}. See Uvicorn server settings for details.-
Available from v1.29.2
use_reader_connection_settings: If set totrue, UI will use connection settings (e.g. credentials, TLS, etc.) from the reader configuration when connecting to data sources. This allows UI to connect to data sources with the same settings without requiring havingvmauthin front of both UI and data sources.
Example Configuration #
If hot-reloading is enabled in vmanomaly service, the server will automatically pick up changes made to the configuration file without requiring a restart.
server:
addr: '0.0.0.0'
port: 8490
path_prefix: '/vmanomaly' # optional path prefix for all HTTP routes
# see https://docs.victoriametrics.com/anomaly-detection/ui/#default-state section for details on constructing the value from UI state
ui_default_state: '#/?anomaly_threshold=1.0&anomaly_consecutive=true&fit_window=3d' # optional default UI state opened on /vmui/
max_concurrent_tasks: 4 # maximum number of concurrent anomaly detection tasks processed by backend
uvicorn_config: # optional Uvicorn server configuration
log_level: 'warning'
use_reader_connection_settings: true # if set to true, UI will use connection settings from reader configuration below when connecting to data sources, allowing it to connect with the same credentials, TLS settings, etc. without requiring having vmauth in front of both UI and data sources.
# other vmanomaly configuration sections, like reader, scheduler, models, etc.
reader:
datasource_url: %{DS_URL}
user: %{DS_USER}
password: %{DS_PASSWORD}
# or
# bearer_token: %{DS_BEARER_TOKEN}
verify_tls: false
Accessing the server #
After starting the vmanomaly server with the above configuration, UI can be accessed at <vmanomaly-host>:8490/vmanomaly/vmui/ (e.g. http://localhost:8490/vmanomaly/vmui/).
Rest API endpoints (e.g. /metrics) can be accessed at <vmanomaly-host>:8490/vmanomaly/metrics (e.g. http://localhost:8490/vmanomaly/metrics).