【问题标题】:Trying to get the uptime of a serviced service, I have the state up/down试图获得服务服务的正常运行时间,我的状态为 up/down
【发布时间】:2022-01-03 02:09:09
【问题描述】:

我正在尝试获取正常运行时间,即服务运行了多长时间。我设法获得了服务启动/关闭状态。我在统计面板中为 0 和 1 做了一些映射。

这是我的查询

node_systemd_unit_state{instance="x.x.x.x:9100", name="service01.service", state="active"}

这确实有效,但我不知道如何获得服务的正常运行时间。

不是机器的正常运行时间,而是服务。

有人知道这是否可行吗?

【问题讨论】:

    标签: prometheus grafana prometheus-node-exporter


    【解决方案1】:

    您可以为此使用process-exporter。在这种情况下,您要搜索的指标如下:

    # HELP namedprocess_namegroup_oldest_start_time_seconds start time in seconds since 1970/01/01 of oldest process in group
    # TYPE namedprocess_namegroup_oldest_start_time_seconds gauge
    namedprocess_namegroup_oldest_start_time_seconds{groupname="xxxxx"} 1.619627766e+09
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多