what's the unit of time() and container_last_seen

731 views
Skip to first unread message

Yong Zhang

unread,
Dec 11, 2017, 12:29:24 AM12/11/17
to Prometheus Users
Hi, all

I'm using time()-container_last_seen(...) to check if container stopped, but it doesn't work. I'm trying to debug but could not understand the unit of time(), the value looks as below:
1512970126

What does this value mean? Thanks for the help.

Ben Kochie

unread,
Dec 11, 2017, 3:36:41 AM12/11/17
to Yong Zhang, Prometheus Users
time() returns UNIX Time in seconds[0].  This is a standard for various Prometheus metrics and operations.

For example, these metrics are UNIX times:

process_start_time_seconds

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/0a67df79-1a58-4d63-9738-00a9c9d0a47a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yong Zhang

unread,
Dec 12, 2017, 2:45:48 AM12/12/17
to Prometheus Users
Thanks Ben.

I found even if one container stopped, container_last_seen() was still very close to time(), any way to monitor container stop event?


On Monday, 11 December 2017 16:36:41 UTC+8, Ben Kochie wrote:
time() returns UNIX Time in seconds[0].  This is a standard for various Prometheus metrics and operations.

For example, these metrics are UNIX times:

process_start_time_seconds
On Mon, Dec 11, 2017 at 6:29 AM, Yong Zhang <hisca...@gmail.com> wrote:
Hi, all

I'm using time()-container_last_seen(...) to check if container stopped, but it doesn't work. I'm trying to debug but could not understand the unit of time(), the value looks as below:
1512970126

What does this value mean? Thanks for the help.

--
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.

Ben Kochie

unread,
Dec 12, 2017, 3:50:12 AM12/12/17
to Yong Zhang, Prometheus Users
Containers (cgroups) don't really have a start/stop state. Do you mean docker?  Maybe you need to get the state from docker?  I don't know if dockerd provides such information.

To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/37f01601-1ddd-4fca-b62c-6e66b151f336%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages