server uptime

138 views
Skip to first unread message

sri L

unread,
Feb 16, 2023, 11:25:28 PM2/16/23
to Prometheus Users
Hi all,

I am looking for server uptime percentage metrics on a monthly basis
Example: If server is down for 60hrs out of 720hrs of a month the uptime has to show 91.66% in dashboard

Please suggest if you have a relevant expression to serve this purpose

Thanks

Julius Volz

unread,
Feb 17, 2023, 3:41:33 PM2/17/23
to sri L, Prometheus Users
Assuming you are monitoring your servers via something like the Node Exporter, and you want the trailing 30-day upness percentage, you could use the Node Exporters "up" metric like this:

    avg_over_time(up{job="node"}[30d]) * 100

This is assuming that the scrape interval is not changing over those 30d, as otherwise you would be weighting some periods (the ones with a higher scrape frequency) more than others.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e34b891c-a5ea-43c8-b567-83588354f831n%40googlegroups.com.


--
Julius Volz
PromLabs - promlabs.com

sri L

unread,
Feb 21, 2023, 4:56:05 AM2/21/23
to Prometheus Users
Thanks for your reply Julius Volz. 
Yes, we are monitoring servers with Node Exporter. We are looking for Uptime average based on calendar Month instead of last 30 days. 
For example, February Month it should give the uptime average for 28days i.e., 1st Feb to 28th feb

Stuart Clark

unread,
Feb 21, 2023, 12:52:03 PM2/21/23
to sri L, Prometheus Users
On 21/02/2023 09:56, sri L wrote:
Thanks for your reply Julius Volz. 
Yes, we are monitoring servers with Node Exporter. We are looking for Uptime average based on calendar Month instead of last 30 days. 
For example, February Month it should give the uptime average for 28days i.e., 1st Feb to 28th feb

On Saturday, February 18, 2023 at 2:11:33 AM UTC+5:30 Julius Volz wrote:
Assuming you are monitoring your servers via something like the Node Exporter, and you want the trailing 30-day upness percentage, you could use the Node Exporters "up" metric like this:

    avg_over_time(up{job="node"}[30d]) * 100

You would need to adjust the query to be

avg_over_time(up{job="node"}[28d]) * 100

-- 
Stuart Clark
Reply all
Reply to author
Forward
0 new messages