node_uname_info(nodename)

1,227 views
Skip to first unread message

Chris Bulleri

unread,
Apr 16, 2019, 9:22:53 AM4/16/19
to Prometheus Users
We are doing some queries and the "instance" gets added to every single piece of data that gets ingested.

The nodename is more user friendly(for some people) and it actually contains some information that is useful to us.

What would be the preferred manner of adding this nodename to the results.  

I see some people say, just add the label to each and every target, that is doable but I'd like to "not fat finger something"  and we are already using the name label for something.

I saw this as a sample but this didn't work.

node_memory_Active_bytes on(instance) group_left(nodename) (node_uname_info) 

Is there an addition I could make to the prometheus.yml file that will just pick up the whole hostname as well without impacting what we currently have.

I hope this makes sense.

Brian Brazil

unread,
Apr 16, 2019, 9:49:20 AM4/16/19
to Chris Bulleri, Prometheus Users
On Tue, 16 Apr 2019 at 14:22, Chris Bulleri <chris....@gmail.com> wrote:
We are doing some queries and the "instance" gets added to every single piece of data that gets ingested.

The nodename is more user friendly(for some people) and it actually contains some information that is useful to us.

What would be the preferred manner of adding this nodename to the results.  

I see some people say, just add the label to each and every target, that is doable but I'd like to "not fat finger something"  and we are already using the name label for something.

I saw this as a sample but this didn't work.

node_memory_Active_bytes on(instance) group_left(nodename) (node_uname_info) 

That's missing an operator:

node_memory_Active_bytes * on(instance) group_left(nodename) (node_uname_info) 
 

Is there an addition I could make to the prometheus.yml file that will just pick up the whole hostname as well without impacting what we currently have.

If you can provide the desired name to service discovery then you can do what you want, see https://www.robustperception.io/controlling-the-instance-label

Brian
 

I hope this makes sense.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/49410c70-d4e9-4099-b122-86549e18359f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Chris Bulleri

unread,
Apr 16, 2019, 8:22:25 PM4/16/19
to Prometheus Users
Thanks for the information. 

nodename.node_uname.info

Right now I have something like


- targets: ['192.168.1.1:9100']
  labels:
    name: 'NODE1'  => I could replace this with the hostname but don't want to fat finger things and I know that data is in node_uname_info 


-------------- I could add the below --------------------

relabel_configs:
   - source_labels: [ nodename ]
      target_label: instance


would I get the nodename from node_uname_info?

I think I'm just not getting something.


On Tuesday, April 16, 2019 at 9:49:20 AM UTC-4, Brian Brazil wrote:
On Tue, 16 Apr 2019 at 14:22, Chris Bulleri <chris....@gmail.com> wrote:
We are doing some queries and the "instance" gets added to every single piece of data that gets ingested.

The nodename is more user friendly(for some people) and it actually contains some information that is useful to us.

What would be the preferred manner of adding this nodename to the results.  

I see some people say, just add the label to each and every target, that is doable but I'd like to "not fat finger something"  and we are already using the name label for something.

I saw this as a sample but this didn't work.

node_memory_Active_bytes on(instance) group_left(nodename) (node_uname_info) 

That's missing an operator:

node_memory_Active_bytes * on(instance) group_left(nodename) (node_uname_info) 
 

Is there an addition I could make to the prometheus.yml file that will just pick up the whole hostname as well without impacting what we currently have.

If you can provide the desired name to service discovery then you can do what you want, see https://www.robustperception.io/controlling-the-instance-label

Brian
 

I hope this makes sense.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.

Ben Kochie

unread,
Apr 17, 2019, 2:13:50 AM4/17/19
to Chris Bulleri, Prometheus Users
Why not replace "192.168.1.1" with "NODE1"?

The best way to avoid fat fingers is to automate things with some kind of source of truth. Configuration management, IPAM (Netbox), etc.

To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.

To post to this group, send email to promethe...@googlegroups.com.

Chris Bulleri

unread,
Apr 17, 2019, 11:57:18 AM4/17/19
to Prometheus Users
isn't the "192...." used to get the information from Node Exporter?

Christian Hoffmann

unread,
Apr 17, 2019, 4:12:23 PM4/17/19
to Chris Bulleri, Prometheus Users
On 2019-04-17 17:57, Chris Bulleri wrote:
> isn't the "192...." used to get the information from Node Exporter?
Yes, this is used for the network connection.

But if you have your servers' hostnames in DNS, you can also use the DNS
name.

Kind regards,
Christian
Reply all
Reply to author
Forward
0 new messages