[prometheus-users] Re: Is it possible to use prometheus in such a scenario

2022-02-23 Thread Brian Candler
What do you mean by "querying with a different hostname"?

Some Prometheus exporters accept URL query parameters to control what they 
do, e.g.
http://localhost:9115/probe*?module=http=foo*
That's a perfectly valid thing to do.  The prometheus server can specify 
these query parameters using "params" setting in the scrape job, or 
__param_XXX labels.

Hence if you're going to write your own exporter that performs SQL queries, 
it's perfectly fine to adjust the SQL query using values from the query 
parameters.

What you *don't* want to do is to return different data *depending on which 
host is making the query *(i.e. where the scrape is coming from)

On Wednesday, 23 February 2022 at 06:57:54 UTC rbf@gmail.com wrote:

> Thanks for the answer, I meant that I already have a SQL database with the 
> required data. And now, when using some kind of sql exporter, is it 
> possible to configure the config for each metric once, but so that when 
> querying with a different hostname, the sql query changes?
>
> Maybe it looks like this:
> query:  select value from perfmon where hostname = %variable% 
>
> Maybe I do not understand how this should work, I just started looking for 
> a solution
>
> среда, 23 февраля 2022 г. в 09:19:33 UTC+3, Brian Candler: 
>
>> Prometheus is not a SQL database: it's a time series database and has its 
>> own query language, PromQL.
>>
>> Each timeseries is uniquely identified by a metric name (which describes 
>> the type of thing you're measuring) and a set of labels (which taken 
>> together identify one particular instance of that thing).  A common label 
>> is "instance" which normally identifies the host the metric came from. Here 
>> are a few simple PromQL queries:
>>
>> node_filesystem_avail_bytes
>>
>> node_filesystem_avail_bytes{instance="server1"}
>>
>> node_filesystem_avail_bytes{instance="server1",mountpoint="/"}
>>
>> The first query returns a vector with available space on all filesystems.
>> The second query returns a vector with available space on all filesystems 
>> on one particular host (which still may be multiple results)
>> The third instance constrains the query more specifically to a single 
>> filesystem.
>>
>> There is lots of documentation online, both official and various blogs, 
>> which can tell you more.
>>
>> On Tuesday, 22 February 2022 at 19:56:58 UTC rbf@gmail.com wrote:
>>
>>> Good afternoon, 
>>> is it possible to use prometheus for such a scenario:
>>> One database, one request but with different parameters?
>>> Example:
>>> select value from perfmon where hostname = 'some hostname'
>>> There are many such hostnames, I would like to have one configuration 
>>> file for all hosts. Is it possible?
>>> Hostnames are specified in grafana variables.
>>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/48639d1b-8e3d-4a51-8287-72879e4f1ca4n%40googlegroups.com.


[prometheus-users] Re: Is it possible to use prometheus in such a scenario

2022-02-22 Thread Robert Flocks
Thanks for the answer, I meant that I already have a SQL database with the 
required data. And now, when using some kind of sql exporter, is it 
possible to configure the config for each metric once, but so that when 
querying with a different hostname, the sql query changes?

Maybe it looks like this:
query:  select value from perfmon where hostname = %variable% 

Maybe I do not understand how this should work, I just started looking for 
a solution

среда, 23 февраля 2022 г. в 09:19:33 UTC+3, Brian Candler: 

> Prometheus is not a SQL database: it's a time series database and has its 
> own query language, PromQL.
>
> Each timeseries is uniquely identified by a metric name (which describes 
> the type of thing you're measuring) and a set of labels (which taken 
> together identify one particular instance of that thing).  A common label 
> is "instance" which normally identifies the host the metric came from. Here 
> are a few simple PromQL queries:
>
> node_filesystem_avail_bytes
>
> node_filesystem_avail_bytes{instance="server1"}
>
> node_filesystem_avail_bytes{instance="server1",mountpoint="/"}
>
> The first query returns a vector with available space on all filesystems.
> The second query returns a vector with available space on all filesystems 
> on one particular host (which still may be multiple results)
> The third instance constrains the query more specifically to a single 
> filesystem.
>
> There is lots of documentation online, both official and various blogs, 
> which can tell you more.
>
> On Tuesday, 22 February 2022 at 19:56:58 UTC rbf@gmail.com wrote:
>
>> Good afternoon, 
>> is it possible to use prometheus for such a scenario:
>> One database, one request but with different parameters?
>> Example:
>> select value from perfmon where hostname = 'some hostname'
>> There are many such hostnames, I would like to have one configuration 
>> file for all hosts. Is it possible?
>> Hostnames are specified in grafana variables.
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/b1d2f758-e5a8-4dce-8a3e-e10e684113e2n%40googlegroups.com.


[prometheus-users] Re: Is it possible to use prometheus in such a scenario

2022-02-22 Thread Brian Candler
Prometheus is not a SQL database: it's a time series database and has its 
own query language, PromQL.

Each timeseries is uniquely identified by a metric name (which describes 
the type of thing you're measuring) and a set of labels (which taken 
together identify one particular instance of that thing).  A common label 
is "instance" which normally identifies the host the metric came from. Here 
are a few simple PromQL queries:

node_filesystem_avail_bytes

node_filesystem_avail_bytes{instance="server1"}

node_filesystem_avail_bytes{instance="server1",mountpoint="/"}

The first query returns a vector with available space on all filesystems.
The second query returns a vector with available space on all filesystems 
on one particular host (which still may be multiple results)
The third instance constrains the query more specifically to a single 
filesystem.

There is lots of documentation online, both official and various blogs, 
which can tell you more.

On Tuesday, 22 February 2022 at 19:56:58 UTC rbf@gmail.com wrote:

> Good afternoon, 
> is it possible to use prometheus for such a scenario:
> One database, one request but with different parameters?
> Example:
> select value from perfmon where hostname = 'some hostname'
> There are many such hostnames, I would like to have one configuration file 
> for all hosts. Is it possible?
> Hostnames are specified in grafana variables.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/88b1cde7-54a4-4433-a84a-3fde45b3ee5an%40googlegroups.com.