SUSE Support

Here When You Need Us

How to add custom labels to Alerts in Monitoring v2

This document (000020302) is provided subject to the disclaimer at the end of this document.

Environment

Rancher Version: v2.5.8
Monitoring Chart Version: 14.5.100

Situation

Alerts in Monitoring v2 contain standard labels. But in some cases, users want to inject custom labels like Kubernetes cluster names to easily identify the environment or need the labels for further Alert routing.

Resolution

Use defaultRules.additionalRuleLabels  in the Monitoring Apps's YAML spec to inject custom labels.

To inject cluster name, open the Monitoring App in Apps& Marketplace from Cluster explorer.
Under "Edit as YAML", add the custom label as below.
defaultRules:
  additionalRuleLabels:
    cluster: "My_Test_cluster"
Then click on "Deploy" or "Upgrade" if App is already installed.

If your receiver is webhook, then the alerts will have the custom labels as shown in the below example alert.
...
...
status":"firing",
"labels":{
  "alertname":"NodeClockNotSynchronising",
  "cluster":"My_Test_cluster", <<<------
  "container":"node-exporter",
  "endpoint":"metrics",
  "instance":"192.168.110.157:9796",
  "job":"node-exporter",
  "namespace":"cattle-monitoring-system",
  "pod":"rancher-monitoring-prometheus-node-exporter-lg2g6",
  "prometheus":"cattle-monitoring-system/rancher-monitoring-prometheus",
  "service":"rancher-monitoring-prometheus-node-exporter",
...
...

Additional Information

GitHub issue #3325 is opened to add additional labels via UI.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020302
  • Creation Date: 28-Jun-2021
  • Modified Date:28-Jun-2021
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.