Prometheus¶
| Description / name | Input element |
|---|---|
| Your domain name |
Overview¶
Prometheus is an open-source systems monitoring and alerting toolkit.
Deployment¶
sb install prometheus
Usage¶
Visit https://prometheus.iYOUR_DOMAIN_NAMEi.
Basics¶
Prometheus provides monitoring and alerting with automatic installation of Node Exporter and cAdvisor for system and container metrics. Configuration is at /opt/prometheus/prometheus.yml. Data retention defaults to 15 days but can be configured in your Saltbox inventory using prometheus_role_retention and prometheus_role_size.
Add custom scrape targets to the config file and restart with docker restart prometheus. Works excellently with Grafana using data source http://prometheus:9090.
Role Defaults¶
Use the Inventory to customize variables. (1)
-
Example override
prometheus_name: "custom_value"Avoid overriding variables ending in
_defaultWhen overriding variables that end in
_default(likeprometheus_docker_envs_default), you replace the entire default configuration. Future updates that add new default values will not be applied to your setup, potentially breaking functionality.Instead, use the corresponding
_customvariable (likeprometheus_docker_envs_custom) to add your changes. Custom values are merged with defaults, ensuring you receive updates.
prometheus_name
# Type: string
prometheus_name: prometheus
prometheus_role_retention
# https://prometheus.io/docs/prometheus/latest/storage/
# Type: string
prometheus_role_retention: "15d"
prometheus_role_size
# Type: string
prometheus_role_size: "0"
prometheus_role_web_subdomain
# Type: string
prometheus_role_web_subdomain: "{{ prometheus_name }}"
prometheus_role_web_domain
# Type: string
prometheus_role_web_domain: "{{ user.domain }}"
prometheus_role_web_port
# Type: string
prometheus_role_web_port: "9090"
prometheus_role_web_url
# Type: string
prometheus_role_web_url: "{{ 'https://' + (lookup('role_var', '_web_subdomain', role='prometheus') + '.' + lookup('role_var', '_web_domain', role='prometheus')
if (lookup('role_var', '_web_subdomain', role='prometheus') | length > 0)
else lookup('role_var', '_web_domain', role='prometheus')) }}"
prometheus_role_dns_record
# Type: string
prometheus_role_dns_record: "{{ lookup('role_var', '_web_subdomain', role='prometheus') }}"
prometheus_role_dns_zone
# Type: string
prometheus_role_dns_zone: "{{ lookup('role_var', '_web_domain', role='prometheus') }}"
prometheus_role_dns_proxy
# Type: bool (true/false)
prometheus_role_dns_proxy: "{{ dns_proxied }}"
prometheus_role_traefik_sso_middleware
# Type: string
prometheus_role_traefik_sso_middleware: ""
prometheus_role_traefik_middleware_default
# Type: string
prometheus_role_traefik_middleware_default: "{{ traefik_default_middleware + ',prometheus-auth' }}"
prometheus_role_traefik_middleware_custom
# Type: string
prometheus_role_traefik_middleware_custom: ""
prometheus_role_traefik_certresolver
# Type: string
prometheus_role_traefik_certresolver: "{{ traefik_default_certresolver }}"
prometheus_role_traefik_enabled
# Type: bool (true/false)
prometheus_role_traefik_enabled: true
prometheus_role_traefik_api_enabled
# Type: bool (true/false)
prometheus_role_traefik_api_enabled: false
prometheus_role_traefik_api_endpoint
# Type: string
prometheus_role_traefik_api_endpoint: ""
Container
prometheus_role_docker_container
# Type: string
prometheus_role_docker_container: "{{ prometheus_name }}"
Image
prometheus_role_docker_image_pull
# Type: bool (true/false)
prometheus_role_docker_image_pull: true
prometheus_role_docker_image_tag
# Type: string
prometheus_role_docker_image_tag: "latest"
prometheus_role_docker_image_repo
# Type: string
prometheus_role_docker_image_repo: "prom/prometheus"
prometheus_role_docker_image
# Type: string
prometheus_role_docker_image: "{{ lookup('role_var', '_docker_image_repo', role='prometheus') }}:{{ lookup('role_var', '_docker_image_tag', role='prometheus') }}"
Envs
prometheus_role_docker_envs_default
# Type: dict
prometheus_role_docker_envs_default:
TZ: "{{ tz }}"
prometheus_role_docker_envs_custom
# Type: dict
prometheus_role_docker_envs_custom: {}
Commands
prometheus_role_docker_commands_default
# Type: list
prometheus_role_docker_commands_default:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/data"
- "--storage.tsdb.retention.time={{ lookup('role_var', '_retention', role='prometheus') }}"
- "--storage.tsdb.retention.size={{ lookup('role_var', '_size', role='prometheus') }}"
prometheus_role_docker_commands_custom
# Type: list
prometheus_role_docker_commands_custom: []
Volumes
prometheus_role_docker_volumes_default
# Type: list
prometheus_role_docker_volumes_default:
- "{{ prometheus_role_paths_location }}:/etc/prometheus"
- "{{ prometheus_role_paths_location }}/data:/data"
prometheus_role_docker_volumes_custom
# Type: list
prometheus_role_docker_volumes_custom: []
Labels
prometheus_role_docker_labels_default
# Type: dict
prometheus_role_docker_labels_default:
traefik.http.middlewares.prometheus-auth.basicauth.usersfile: "/etc/traefik/auth"
prometheus_role_docker_labels_custom
# Type: dict
prometheus_role_docker_labels_custom: {}
Hostname
prometheus_role_docker_hostname
# Type: string
prometheus_role_docker_hostname: "{{ prometheus_name }}"
Networks
prometheus_role_docker_networks_alias
# Type: string
prometheus_role_docker_networks_alias: "{{ prometheus_name }}"
prometheus_role_docker_networks_default
# Type: list
prometheus_role_docker_networks_default: []
prometheus_role_docker_networks_custom
# Type: list
prometheus_role_docker_networks_custom: []
Restart Policy
prometheus_role_docker_restart_policy
# Type: string
prometheus_role_docker_restart_policy: unless-stopped
State
prometheus_role_docker_state
# Type: string
prometheus_role_docker_state: started
User
prometheus_role_docker_user
# Type: string
prometheus_role_docker_user: "{{ uid }}:{{ gid }}"
The following advanced options are available via create_docker_container but are not defined in the role. See: docker_container module
Resource Limits
prometheus_role_docker_blkio_weight
# Type: int
prometheus_role_docker_blkio_weight:
prometheus_role_docker_cpu_period
# Type: int
prometheus_role_docker_cpu_period:
prometheus_role_docker_cpu_quota
# Type: int
prometheus_role_docker_cpu_quota:
prometheus_role_docker_cpu_shares
# Type: int
prometheus_role_docker_cpu_shares:
prometheus_role_docker_cpus
# Type: string
prometheus_role_docker_cpus:
prometheus_role_docker_cpuset_cpus
# Type: string
prometheus_role_docker_cpuset_cpus:
prometheus_role_docker_cpuset_mems
# Type: string
prometheus_role_docker_cpuset_mems:
prometheus_role_docker_kernel_memory
# Type: string
prometheus_role_docker_kernel_memory:
prometheus_role_docker_memory
# Type: string
prometheus_role_docker_memory:
prometheus_role_docker_memory_reservation
# Type: string
prometheus_role_docker_memory_reservation:
prometheus_role_docker_memory_swap
# Type: string
prometheus_role_docker_memory_swap:
prometheus_role_docker_memory_swappiness
# Type: int
prometheus_role_docker_memory_swappiness:
prometheus_role_docker_shm_size
# Type: string
prometheus_role_docker_shm_size:
Security & Devices
prometheus_role_docker_cap_drop
# Type: list
prometheus_role_docker_cap_drop:
prometheus_role_docker_cgroupns_mode
# Type: string
prometheus_role_docker_cgroupns_mode:
prometheus_role_docker_device_cgroup_rules
# Type: list
prometheus_role_docker_device_cgroup_rules:
prometheus_role_docker_device_read_bps
# Type: list
prometheus_role_docker_device_read_bps:
prometheus_role_docker_device_read_iops
# Type: list
prometheus_role_docker_device_read_iops:
prometheus_role_docker_device_requests
# Type: list
prometheus_role_docker_device_requests:
prometheus_role_docker_device_write_bps
# Type: list
prometheus_role_docker_device_write_bps:
prometheus_role_docker_device_write_iops
# Type: list
prometheus_role_docker_device_write_iops:
prometheus_role_docker_devices
# Type: list
prometheus_role_docker_devices:
prometheus_role_docker_devices_default
# Type: string
prometheus_role_docker_devices_default:
prometheus_role_docker_groups
# Type: list
prometheus_role_docker_groups:
prometheus_role_docker_privileged
# Type: bool (true/false)
prometheus_role_docker_privileged:
prometheus_role_docker_security_opts
# Type: list
prometheus_role_docker_security_opts:
prometheus_role_docker_userns_mode
# Type: string
prometheus_role_docker_userns_mode:
Networking
prometheus_role_docker_dns_opts
# Type: list
prometheus_role_docker_dns_opts:
prometheus_role_docker_dns_search_domains
# Type: list
prometheus_role_docker_dns_search_domains:
prometheus_role_docker_dns_servers
# Type: list
prometheus_role_docker_dns_servers:
prometheus_role_docker_domainname
# Type: string
prometheus_role_docker_domainname:
prometheus_role_docker_exposed_ports
# Type: list
prometheus_role_docker_exposed_ports:
prometheus_role_docker_hosts
# Type: dict
prometheus_role_docker_hosts:
prometheus_role_docker_hosts_use_common
# Type: bool (true/false)
prometheus_role_docker_hosts_use_common:
prometheus_role_docker_ipc_mode
# Type: string
prometheus_role_docker_ipc_mode:
prometheus_role_docker_links
# Type: list
prometheus_role_docker_links:
prometheus_role_docker_network_mode
# Type: string
prometheus_role_docker_network_mode:
prometheus_role_docker_pid_mode
# Type: string
prometheus_role_docker_pid_mode:
prometheus_role_docker_ports
# Type: list
prometheus_role_docker_ports:
prometheus_role_docker_uts
# Type: string
prometheus_role_docker_uts:
Storage
prometheus_role_docker_keep_volumes
# Type: bool (true/false)
prometheus_role_docker_keep_volumes:
prometheus_role_docker_mounts
# Type: list
prometheus_role_docker_mounts:
prometheus_role_docker_storage_opts
# Type: dict
prometheus_role_docker_storage_opts:
prometheus_role_docker_tmpfs
# Type: list
prometheus_role_docker_tmpfs:
prometheus_role_docker_volume_driver
# Type: string
prometheus_role_docker_volume_driver:
prometheus_role_docker_volumes_from
# Type: list
prometheus_role_docker_volumes_from:
prometheus_role_docker_volumes_global
# Type: bool (true/false)
prometheus_role_docker_volumes_global:
prometheus_role_docker_working_dir
# Type: string
prometheus_role_docker_working_dir:
Monitoring & Lifecycle
prometheus_role_docker_auto_remove
# Type: bool (true/false)
prometheus_role_docker_auto_remove:
prometheus_role_docker_cleanup
# Type: bool (true/false)
prometheus_role_docker_cleanup:
prometheus_role_docker_force_kill
# Type: string
prometheus_role_docker_force_kill:
prometheus_role_docker_healthcheck
# Type: dict
prometheus_role_docker_healthcheck:
prometheus_role_docker_healthy_wait_timeout
# Type: int
prometheus_role_docker_healthy_wait_timeout:
prometheus_role_docker_init
# Type: bool (true/false)
prometheus_role_docker_init:
prometheus_role_docker_kill_signal
# Type: string
prometheus_role_docker_kill_signal:
prometheus_role_docker_log_driver
# Type: string
prometheus_role_docker_log_driver:
prometheus_role_docker_log_options
# Type: dict
prometheus_role_docker_log_options:
prometheus_role_docker_oom_killer
# Type: bool (true/false)
prometheus_role_docker_oom_killer:
prometheus_role_docker_oom_score_adj
# Type: int
prometheus_role_docker_oom_score_adj:
prometheus_role_docker_output_logs
# Type: bool (true/false)
prometheus_role_docker_output_logs:
prometheus_role_docker_paused
# Type: bool (true/false)
prometheus_role_docker_paused:
prometheus_role_docker_recreate
# Type: bool (true/false)
prometheus_role_docker_recreate:
prometheus_role_docker_restart_retries
# Type: int
prometheus_role_docker_restart_retries:
prometheus_role_docker_stop_timeout
# Type: int
prometheus_role_docker_stop_timeout:
Other Options
prometheus_role_docker_capabilities
# Type: list
prometheus_role_docker_capabilities:
prometheus_role_docker_cgroup_parent
# Type: string
prometheus_role_docker_cgroup_parent:
prometheus_role_docker_create_timeout
# Type: int
prometheus_role_docker_create_timeout:
prometheus_role_docker_entrypoint
# Type: string
prometheus_role_docker_entrypoint:
prometheus_role_docker_env_file
# Type: string
prometheus_role_docker_env_file:
prometheus_role_docker_labels_use_common
# Type: bool (true/false)
prometheus_role_docker_labels_use_common:
prometheus_role_docker_read_only
# Type: bool (true/false)
prometheus_role_docker_read_only:
prometheus_role_docker_runtime
# Type: string
prometheus_role_docker_runtime:
prometheus_role_docker_sysctls
# Type: list
prometheus_role_docker_sysctls:
prometheus_role_docker_ulimits
# Type: list
prometheus_role_docker_ulimits:
prometheus_role_autoheal_enabled
# Enable or disable Autoheal monitoring for the container created when deploying
# Type: bool (true/false)
prometheus_role_autoheal_enabled: true
prometheus_role_depends_on
# List of container dependencies that must be running before the container start
# Type: string
prometheus_role_depends_on: ""
prometheus_role_depends_on_delay
# Delay in seconds before starting the container after dependencies are ready
# Type: string (quoted number)
prometheus_role_depends_on_delay: "0"
prometheus_role_depends_on_healthchecks
# Enable healthcheck waiting for container dependencies
# Type: string ("true"/"false")
prometheus_role_depends_on_healthchecks:
prometheus_role_diun_enabled
# Enable or disable Diun update notifications for the container created when deploying
# Type: bool (true/false)
prometheus_role_diun_enabled: true
prometheus_role_dns_enabled
# Enable or disable automatic DNS record creation for the container
# Type: bool (true/false)
prometheus_role_dns_enabled: true
prometheus_role_docker_controller
# Enable or disable Saltbox Docker Controller management for the container
# Type: bool (true/false)
prometheus_role_docker_controller: true
prometheus_role_docker_image_repo
# Type: string
prometheus_role_docker_image_repo:
prometheus_role_docker_image_tag
# Type: string
prometheus_role_docker_image_tag:
prometheus_role_docker_volumes_download
# Type: bool (true/false)
prometheus_role_docker_volumes_download:
prometheus_role_retention
# Type: string
prometheus_role_retention:
prometheus_role_size
# Type: string
prometheus_role_size:
prometheus_role_themepark_addons
# Type: string
prometheus_role_themepark_addons:
prometheus_role_themepark_app
# Type: string
prometheus_role_themepark_app:
prometheus_role_themepark_theme
# Type: string
prometheus_role_themepark_theme:
prometheus_role_traefik_api_endpoint
# Type: dict/omit
prometheus_role_traefik_api_endpoint:
prometheus_role_traefik_api_middleware
# Type: string
prometheus_role_traefik_api_middleware:
prometheus_role_traefik_api_middleware_http
# Type: string
prometheus_role_traefik_api_middleware_http:
prometheus_role_traefik_autodetect_enabled
# Enable Traefik autodetect middleware for the container
# Type: bool (true/false)
prometheus_role_traefik_autodetect_enabled: false
prometheus_role_traefik_certresolver
# Type: string
prometheus_role_traefik_certresolver:
prometheus_role_traefik_crowdsec_enabled
# Enable CrowdSec middleware for the container
# Type: bool (true/false)
prometheus_role_traefik_crowdsec_enabled: false
prometheus_role_traefik_error_pages_enabled
# Enable custom error pages middleware for the container
# Type: bool (true/false)
prometheus_role_traefik_error_pages_enabled: false
prometheus_role_traefik_gzip_enabled
# Enable gzip compression middleware for the container
# Type: bool (true/false)
prometheus_role_traefik_gzip_enabled: false
prometheus_role_traefik_middleware_http
# Type: string
prometheus_role_traefik_middleware_http:
prometheus_role_traefik_middleware_http_api_insecure
# Type: bool (true/false)
prometheus_role_traefik_middleware_http_api_insecure:
prometheus_role_traefik_middleware_http_insecure
# Type: bool (true/false)
prometheus_role_traefik_middleware_http_insecure:
prometheus_role_traefik_priority
# Type: string
prometheus_role_traefik_priority:
prometheus_role_traefik_robot_enabled
# Enable robots.txt middleware for the container
# Type: bool (true/false)
prometheus_role_traefik_robot_enabled: true
prometheus_role_traefik_tailscale_enabled
# Enable Tailscale-specific Traefik configuration for the container
# Type: bool (true/false)
prometheus_role_traefik_tailscale_enabled: false
prometheus_role_traefik_wildcard_enabled
# Enable wildcard certificate for the container
# Type: bool (true/false)
prometheus_role_traefik_wildcard_enabled: true
prometheus_role_web_domain
# Type: string
prometheus_role_web_domain:
prometheus_role_web_fqdn_override
# Override the Traefik fully qualified domain name (FQDN) for the container
# Type: list
prometheus_role_web_fqdn_override:
Example Override
prometheus_role_web_fqdn_override:
- "{{ traefik_host }}"
- "prometheus2.{{ user.domain }}"
- "prometheus.otherdomain.tld"
Note: Include {{ traefik_host }} to preserve the default FQDN alongside your custom entries
prometheus_role_web_host_override
# Override the Traefik web host configuration for the container
# Type: string
prometheus_role_web_host_override:
Example Override
prometheus_role_web_host_override: "Host(`{{ traefik_host }}`) || Host(`{{ 'prometheus2.' + user.domain }}`)"
Note: Use {{ traefik_host }} to include the default host configuration in your custom rule
prometheus_role_web_http_port
# Type: string (quoted number)
prometheus_role_web_http_port:
prometheus_role_web_http_scheme
# Type: string ("http"/"https")
prometheus_role_web_http_scheme:
prometheus_role_web_http_serverstransport
# Type: dict/omit
prometheus_role_web_http_serverstransport:
prometheus_role_web_scheme
# URL scheme to use for web access to the container
# Type: string ("http"/"https")
prometheus_role_web_scheme:
prometheus_role_web_serverstransport
# Type: dict/omit
prometheus_role_web_serverstransport:
prometheus_role_web_subdomain
# Type: string
prometheus_role_web_subdomain: