Skip to content

Instantly share code, notes, and snippets.

@dkt26111
Last active June 6, 2019 22:15
Show Gist options
  • Save dkt26111/a3bc7ba45f82c599ab31821597fc7f63 to your computer and use it in GitHub Desktop.
Save dkt26111/a3bc7ba45f82c599ab31821597fc7f63 to your computer and use it in GitHub Desktop.
Prometheus configuration file to scrape OpenStack instances that belong to Senlin clusters
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
# Scrape OpenStack instances
- job_name: 'openstack'
openstack_sd_configs:
- identity_endpoint: http://10.0.20.10/identity
region: RegionOne
username: admin
project_name: admin
domain_name: default
password: secretsecret
role: instance
relabel_configs:
# Keep only active instances
- source_labels: [__meta_openstack_instance_status]
action: keep
regex: ACTIVE
# Keep Senlin instances that have cluster_id
- source_labels: [__meta_openstack_tag_cluster_id]
action: keep
# Update the scraping port if required
- source_labels:
- __address__
action: replace
regex: ([^:]+)(?::\d+)
replacement: $1:9100
target_label: __address__
rule_files:
- alert.rules.yml
alerting:
alertmanagers:
- static_configs:
- targets:
- 'localhost:9093'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment