Hey all,
First time long time here -- love Prom.
I'm a bit stumped and was hoping maybe someone could tell me where I'm not connecting.
I'm currently using a service discovery plugin to pull inventory from our source of truth, netbox.
Netbox returns a __meta_netbox_tags in the form of tag,tag,tag
I'm trying to relabel this field and save it into the timeseries so that it can be used to exempt an object from certain alerts utilizing the absence of the tag !=.
Here's what the output looks like for service discovery:
"targets": [
"server"
],
"labels": {
"__meta_netbox_status": "active",
"__meta_netbox_model": "VirtualMachine",
"__meta_netbox_name": "server",
"__meta_netbox_primary_ip": "x.x.x.x",
"__meta_netbox_primary_ip4": "x.x.x.x",
"__meta_netbox_platform": "Linux (64-bit)",
"__meta_netbox_platform_slug": "linux-64-bit",
"__meta_netbox_tags": "NetBox-synced,prod,exempt-highcpu, exempt-highmem",
"__meta_netbox_tag_slugs": "exempt-highmem, exempt-highcpu",
"__meta_netbox_cluster": "production",
"__meta_netbox_cluster_group": "XXX",
"__meta_netbox_cluster_type": "VMware",
"__meta_netbox_site": "XXX",
"__meta_netbox_site_slug": "xxx",
"__meta_netbox_role": "Server",
"__meta_netbox_role_slug": "server"
Here's the latest iteration what I'm trying to do in prometheus.yml (when i try to use the separators to tell it there's a comma the yaml stops parsing):
metric_relabel_configs:
- source_labels: [__meta_netbox_tags]
regex: '.*'
replacement: '$1'
target_label: tags
And here's what I'm trying to do in our rules.yml:
- alert: HostHighCpuLoad
expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle",tags!="highcpuexempt"}[5m])) * 100) > 85
for: 10m
labels:
severity: warning
annotations:
identifier: '{{ $labels.instance }}'
summary: "Host high CPU load (instance {{ $labels.instance }})"
description: "CPU load is > 85% for 10 minutes\n VALUE = {{ $value }}\n LABELS: {{ $labels }}"
Anyone assistance would be greatly appreciated!!
Thanks,
Mike