Extract hostname from "node_uname_info" metric and create CPU, Memory usage grafana panels

Hi, I have populated

prometheus.yml → scrape_configs → static_configs → targets

section using multiple IP addresses. There is no DNS functionality on prometheus server nor populating hostnames (instead of IPs) is possible.

  1. I want to create memory, cpu usage specific grafana panel using regexp based on nodename/hostname value. It should also have hostname in legands.
  2. Since hostname info is not available in default node_exporter metrics, I am exploring possibility of leveraging node_uname_info metric which has hostname information.
  3. I tried using relabel_configs and metric_relabel_configs but it is not serving the purpose.

Can someone please help to understand possible solution ? Thanks in advance.

Possible metric to use:

node_uname_info{domainname="(none)",machine="x86_64",nodename="xy1dcxyz111",release="3.10.0-1160.81.1.el7.x86_64",sysname="Linux",version="#1 SMP Thu Nov 24 12:21:22 UTC 2022"} 1

TD;LR

(avg by(instance) (irate(node_cpu_seconds_total{mode="user"}[1m])) * 100) * on(instance) group_left(hostname) role{role="Apache"}

Hi, I stumbled upon a old writeup by Brian Brazil himself (link shared below) which helped me figure out solution. In addition, I have populated custom metric “role” which I leveraged for subsequent filtering.

https://www.robustperception.io/exposing-the-software-version-to-prometheus/