Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用 prometheus 作为数据源,使用 windows 导出器作为监控服务器上的导出器。我已经为服务器创建了一个变量,我只想显示服务器名称我接下来应该写什么来过滤掉服务器名称并省略应用程序 url
如果您有一个仅包含服务器名称的指标,那么可以。例如,如果您有如下指标:
host_cpu_number{instance="192.168.1.1"}
host_cpu_number{instance="192.168.1.2"}
那么你可以使用label_values(host_cpu_number, instance)来获取192.168.1.1和192.168.1.2
label_values(host_cpu_number, instance)
192.168.1.1
192.168.1.2