Using the Prometheus plugin, is it possible to show single statistics in a table as key:value table rows in stead of time series?
This means the current_value only.
E.g. node_uname_info giving:
key | value
------- |-------
machine | x86_64
nodename| ServerName
release | 4.10.51-1-amd64
sysname | Linux
version | #1 SMP Debian 4.10.51-1
Preferably I want to manually select one value per table row from different sources. E.g.:
A: node_uname_info.release
B: node_uname_info.version
C: "Some Manual String"
D: node_memory_MemTotal
As of Grafana 4.3, indeed you can:
http://docs.grafana.org/guides/whats-new-in-v4-3/#prometheus-table-data-column-per-label
But column C in your example, containing Some Random String, will be hard to accomplish in Grafana. Consider using Prometheus relabeling to permanently add additional data to you metrics in Prometheus.
Related
I am using Grafana to perform a Log to Metric query using an Azure Data Explorer datasource, that gives me a result like this as a table:
This comes from this query:
Log
| where $__timeFilter(TIMESTAMP)
| where eventId == 666
| summarize count() by bin(TIMESTAMP, 15m), Region
| order by TIMESTAMP asc
When rendered as a timechart in AppInsights, it renders perfectly like this:
However in Grafana, this perplexingly renders by the Count_ column, not using the obvious Regional breakout field:
My goal is to get an AppInsight's like timechart with multiple data series, within Grafana
I found my answer! It turns out I was rendering the data as a Table, using the Grafana query wizard here.
Once I changed that to TimeSeries, it all just worked!
When I have a Prometheus query resulting in:
my_metric{instance="instance1",job="job",prop_1="ok",prop_2="cancel"} 1
my_metric{instance="instance2",job="job",prop_1="error",prop_2="ok"} 1
How can I create a Grafana table showing:
timestamp | instance1 | ok | cancel
timestamp | instance2 | error | ok
So a Prometheus metric property is mapped to Grafana table column.
OPEN QUESTION: Is it possible to change the value of a tag dynamically? So the 3rd and 4th label (or property) values change over time.
QUESTION 1: The first part of the question is simple: Formatting the prometheus labels/properties in a table is easy. The answer you can find in this description.
How? Just select the 'table' format as shown in the second red box.
QUESTION 2: any idea?
I got a influx db table consisting of
> SELECT * FROM results
name: results
time artnum duration
---- ------ --------
1539084104865933709 1234 34
1539084151822395648 1234 81
1539084449707598963 2345 56
1539084449707598123 2345 52
and other tags. Both artnum and duration are fields (that is changeable though). I'm now trying to create a query (to use in grafana) that gives me the following result with a calculated mean() and the number of measurements for that artnum:
artnum mean_duration no. measurements
------ -------- -----
1234 58 2
2345 54 2
First of all: Is it possible to exclude the time column? Secondly, what is the influx db way to create such a table? I started with
SELECT mean("duration"), "artnum" FROM "results"
resulting in ERR: mixing aggregate and non-aggregate queries is not supported. Then I found https://docs.influxdata.com/influxdb/v1.6/guides/downsampling_and_retention/, which looked like what I wanted to do. I then created a infinite retention policy (duration 0s) and a continuous query
> CREATE CONTINUOUS QUERY "cq" ON "test" BEGIN
SELECT mean("duration"),"artnum"
INTO infinite.mean_duration
FROM infinite.test
GROUP BY time(1m)
END
I followed the instructions, but after I fed some data to the db and waited for 1m, `SELECT * FROM "infinite"."mean_duration" did not return anything.
Is that approach the right one or should I continue somewhere else? The very goal is to see the updated table in grafana, refreshing once a minute.
InfluxDB is a time series database, so you really need the time dimension - also in the response. You will have a hard time with Grafana if your query returns non time series data. So don't try to remove time from the query. Better option is to hide time in the Grafana table panel - use column styles and set Type: Hidden.
InfluxDB doesn't have a tables, but measurements. I guess you need query with proper grouping only, no advance continous queries, etc.. Try and improve this query*:
SELECT
MEAN("duration"),
COUNT("duration")
FROM results
GROUP BY "artnum" fill(null)
*you may have a problem with grouping in your case, because artnum is InfluxDB field - better option is to save artnum as InfluxDB tag.
assume next 2 prometheus timeseries:
service_deployed{service} timestamp
service_available{service} timestamp
A set of specific metrics with matching labels would be:
service_deployed{service='provision-service'} 12345678.0
service_available{service='provision-service'} 12345900.0
which in effect say that there is a newer 'provision-service' (as its available timestamp is greater than the deployed one).
Now imagine I'd like to present these 2 in one table in Grafana. Something like:
| Service | Deployed | Available |
| provision-service| 12345678.0 | 12345900.0|
Also assume that I cannot use the latest Grafana (>5.0) that seems to be able to combine tables so I'll have to do this using promQL. How would you go about combining these metrics?
Thanks
I want to built a distributed (across continents), fault-tolerant and fast image and file store. There would be a REST end-point in front of the storage which would serve the images and/or files.
The images or files are stored/inserted from a central location but served from a local intranet installed webserver which authenticates and authorises the user.
One object can have multiple sizes of the same image and probably files related to it. Using the mentioned storage gives me the ability to choose the column family and/or column qualifier to fetch the requested entity.
I did consider the FileSystem, however, to retrieve the requested entity I either need to know the correct path from the DB or the path should be intelligently designed. Which also means creating folders when a new year begins.
One entity can have the different sizes (thumbnail, grid, preview, etc.) for different years.
The request to get the image would look like -
entityId 123
year 2017
size thumbnail
The request to get all available image for a given entity for a year would look like -
entityId 123
year 2017
I am open for any other storage solution as long as the above are achievable. Thank you for your help and suggestions.
You could do as you suggest and build a filesystem table like th
cqlsh> use keyspace1;
cqlsh:keyspace1> create table filesystem(
... entitiyId int,
... year int,
... size text,
... payload blob,
... primary key (entitiyId, year, size));
cqlsh:keyspace1> insert into filesystem (entitiyId, year, size, payload) values (1,2017,'small',textAsBlob('payload'));
cqlsh:keyspace1> insert into filesystem (entitiyId, year, size, payload) values (1,2017,'big',textAsBlob('payload'));
cqlsh:keyspace1> insert into filesystem (entitiyId, year, size, payload) values (1,2016,'small',textAsBlob('payload'));
cqlsh:keyspace1> insert into filesystem (entitiyId, year, size, payload) values (1,2016,'big',textAsBlob('payload'));
cqlsh:keyspace1> insert into filesystem (entitiyId, year, size, payload) values (2,2016,'small',textAsBlob('payload'));
cqlsh:keyspace1>
cqlsh:keyspace1>
cqlsh:keyspace1> select * from filesystem where entitiyId=1 and year=2016;
entitiyid | year | size | payload
-----------+------+-------+------------------
1 | 2016 | big | 0x7061796c6f6164
1 | 2016 | small | 0x7061796c6f6164
(2 rows)
cqlsh:keyspace1>
and
cqlsh:keyspace1> select * from filesystem where entitiyId=1 and year=2016 and size='small';
entitiyid | year | size | payload
-----------+------+-------+------------------
1 | 2016 | small | 0x7061796c6f6164
(1 rows)
cqlsh:keyspace1>
What you cant do with this approach is selecting images for a specific size and id without specifying the year.
For related files you could build a list with the foreign entitiyIds or a seperate grouping table to keep them together.
But the cassandra blob type has a theoretically limit of 2GB but if you need performance the practial limit is about 1MB, in rare cases a few MB (performance degrades in many ways with bigger blobs). If that's no problem go ahead and just try out.
Another idea is using something like AWS S3 for storing the actual data with enabled cross region replication and cassandra for the metadata. But if someone goes to AWS - they also have EFS with cross region replication.
MongoDB is also easily deployed with cross region replication (https://docs.mongodb.com/manual/tutorial/deploy-geographically-distributed-replica-set/). In MongoDB you could keep all your data in one document and just query the relevant parts of it. In my opinion MongoDB requires more housekeeping than cassandra does (there is more config and planning necessary).