With node exporter, whether we can obtain the info of virtual IP? On Wednesday, September 8, 2021 at 5:00:42 PM UTC+8 nina guo wrote:
> I'm using node exporter to get the metrics. I dont have the virtual IP > infos, I want to get the value first and display it on Grafana. > You kindly provided 2 ways, we don't want to install too much exporter on > target systems, so we prefer to use a cronjob to get the virtual IP data. > May I know if there is an example for how to write this cronjob? > > On Wednesday, September 8, 2021 at 4:45:58 PM UTC+8 Brian Candler wrote: > >> You haven't shown the actual metric which returns the virtual IP state. >> It may already have the info you need in labels. Which exporter are you >> using, and can you give an example of a metric? If you're not already >> collecting it, then obviously that's your first step. e.g. if your virtual >> IP is managed by keepalived then you can enable its SNMP function and talk >> to it using snmp_exporter; or you can run your virtualip list query from a >> cronjob which writes out data in prometheus metric format into a file which >> is picked up by node_exporter's textfile collector. >> >> The normal way to add info from node_uname_info onto some other metric is >> to do a join on a common label, most commonly "instance". >> >> To do this, you need to ensure that the labels are identical, and this >> means removing the port number from the label, using relabelling. That is, >> instead of >> node_uname_info{job="node",instance="*foo.bar:9100* >> ",nodename="hostname",...} >> you want >> node_uname_info{job="node",instance="*foo.bar*",nodename="hostname",...} >> >> Ditto for whichever metric shows your VIP state, i.e. it also needs >> instance="foo.bar" not "foo.bar:<someport>" >> >> For more info see: >> https://www.robustperception.io/controlling-the-instance-label >> https://groups.google.com/forum/#!topic/prometheus-users/I4dVtwI5YrM >> >> https://groups.google.com/forum/#!msg/prometheus-users/PPwF-2CQiSc/FsSvfCm3AwAJ >> >> Once you've done that, you can use a many-to-one join in PromQL to pick >> up additional labels from node_uname_info. For example: >> node_arp_entries * *on(instance) group_left(hostname,domainname)* >> node_uname_info >> >> For more info see: >> https://www.robustperception.io/how-to-have-labels-for-machine-roles >> >> https://www.robustperception.io/exposing-the-software-version-to-prometheus >> https://www.robustperception.io/left-joins-in-promql >> >> https://prometheus.io/docs/prometheus/latest/querying/operators/#many-to-one-and-one-to-many-vector-matches >> >> On Wednesday, 8 September 2021 at 09:19:29 UTC+1 ninag...@gmail.com >> wrote: >> >>> A correction: >>> >>> (function_name) usrname@hostname:~> virtualip list >>> Configured Virtual IPs: >>> ----------------------- >>> function_name on eth0 >>> >>> Virtual IPs State: >>> ------------------ >>> function_name: (info) Virtual IP xxxx is up and active on hostname >>> On Wednesday, September 8, 2021 at 4:11:47 PM UTC+8 nina guo wrote: >>> >>>> Hi, >>>> >>>> Is there a way to show DNS name for a server on Grafana Dashboard? >>>> >>>> For example: >>>> (function_name) usrname@hostname:~> virtualip list >>>> Configured Virtual IPs: >>>> ----------------------- >>>> function_name >>>> >>>> Virtual IPs State: >>>> ------------------ >>>> function_name: (info) Virtual IP xxxx is up and active on hostname >>>> >>>> I want function_name can be shown on Grafana. >>>> >>>> But with node exporter, no related info shows. So what should I do to >>>> get function_name be shown on Grafana? >>>> node_uname_info{domainname="(none)", instance="xxx", job="xxx", >>>> machine="x86_64", nodename="hostname", release="4default", >>>> sysname="Linux", >>>> version="#1 } >>>> >>> -- 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-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e657c668-e8ef-48da-8eaf-8fc47d5e5d0dn%40googlegroups.com.