Prometheus documentation

I understand nothing in the documentation.I miss probably something
what are the API?
how do you use them?
how do you call them?
how to set the flags in prometheus?
please help to understand a minimum…

regards
Knasso

Have you read First steps | Prometheus?

What are you trying to do/what don’t you understand?

1 Like

Yes,
I am Reading and trying to understand.

I want to pickup a counter value at a precise time of the day then pickup the value 24 hours later on the same counter and make the différence.Simple no?
However i dont find how to that in promQL.
If you could hold the hand to a beginner it would be great.
Than you.
knasson

A great way to start understanding concepts, the API, and how to use Prometheus, especially PromQL is to invest some time thoroughly studying it. The book Prometheus Up & Running by Brian Brazil (one of the Prom maintainers) helped me personally a lot, so I’d recommend that to you.

1 Like

Hi,

I thought about using delta() but then learned that this should only be used with gauges, not counters. Since I haven’t done this before, trying to figure out how this works.

Tried a new Google search for promql compare two counter values at different times and landed at prometheus - Calculate difference between first and last element in counter metrics' range vector - Stack Overflow

It seems that increase() does what you are looking for.

increase(http_requests_total{job="api-server"}[1440m])

Cheers,
Michael

Thanks you i will have a look …

Thanks a lot for trying,
What you find in Google is exactly what i use now. Instead [1440] i use [1d] but it is ok.
The problem is that query gives use the counter difference at 24h interval but sliding all the day .So this difference depend on what happened previous day at each moment.
What i need is the absolute difference of value of the counter at midnight (00:00:00) to day and the value of the counter next day at the same Time. This is quite different!
I need a constant value which is not Moving all the day.
I tried to had a "max " but it is not exact because the max value depend on what happened during the previous 24h.
So i think there is something simple but i don’t fond it.
Regards
Knasson

Hi,

can you share a 24h graph of the data as a visualization image here? It may help understand what you’re describing. I’m not sure if I can follow.

Cheers,
Michael

How the data is presented and the time period used is the responsibility of whichever tool you decide to use (for example Grafana). All these tools just call the Prometheus API, which for a query accepts a start & end timestamp to use.

Therefore if you were calling the API directly you would just include the midnight to midnight timestamps for the start/end alongside that increase function.

1 Like

Here the graph for to day…

Hi Stuart,

Good Guy ! But i don’t know how to call the API directly.
Please show me the way…
Thanks you
Regards
Knasson

Take a look at the API documentation here:

For instant queries there is a “time” parameter, while for range queries
there are “start” and “end” parameters.

1 Like

Ok i understand what you say …however what i don’t understand is how to manage these API.

Where do you inter the query commands or code?
In the prometheus browser ( localhost:9090) ? Or where ?
Thanks you for clarifying this basic knowledges
Regards

Jean-Claude

I had a look at this documentation…I tested the examples it works i get values but how to link these results to grafana ?

Thank you

Jean-claude

Provenance : Courrier pour Windows 10

PLease one or 2 things unclear in the doc,

  1. from where are coming GET or POST ? and how to use them ?

‘for precising what is the difference between this :

curl [http://localhost:9090/api/v1/targets](http://localhost:9090/api/v1/targets) and 
GET /api/v1/targets

and to pass from one to the other ?

  1. Once you get the result how to use it in grafana ?

Sorry for asking so basic things

Thank you…

regards

Provenance : Courrier pour Windows 10

The API is what Grafana uses to fetch the data itself. If you are wanting to use Grafana for your visualisations you would need to set the start/end times there.