Grafana - create table with column values with Prometheus (dynamic) property/label data - grafana

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?

Related

Grafana, how to choose which column for axis in Timechart?

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!

Convert metric value from number to string

I'm using Grafana table panel to show status of my application.
Currently in Prometheus metrics, I'm returning 1 and 0. Where, 1 mean pass and 0 means fail.
On table view it is also showing as 0 & 1.
Can I change the Prometheus query to return 'PASS' when value is 1, 'FAIL' otherwise?
I faced similar for a graph. I had to convert int value to text for metric. I managed the situation by converting the value to text by using CAST. Simply use the CAST in your metric column. Please note that, I'm using PostgreSQL as a DataSource.
Please check below image for the casting example:
I believe you should look the way to change the display in Grafana.
Under Edit option of the panel
Check the overrides option where you can select
Override fields with name and select value mappings
Add Value mappings as per your requirement
I have also took the screenshot as per the numbers for your reference.

Prometheus/Grafana: combining 2 timeseries

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

Show single statistics in Grafana table

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.

SSRS Column Grouping Based on Row and Column

I've looked everywhere but found no luck and did some tinkering which didn't amount to much. I have a table that displays the following result set:
| Name | Value|
| Pat | 1.6 |
| Pat | 1.4 |
I have to group them in together by Row based on the first column (which is not a problem). Although I'm trying to make the report put the two numeric values in one cell in the Tablix.
This is what I need to do:
And this is what I have achieved
I achieved the third one by grouping it by the first column of my result set as a Row group.
Any nudge to the right direction will be very much appreciated!
Add a new tablix and add Name field in the Row Groups Pane, then delete details group.
In the Value cell use the below expression:
=join(LookupSet(
Fields!Name.Value,
Fields!Name.Value,
Fields!Value.Value,
"DataSetName"
),Environment.NewLine)
Replace DataSetName by the actual name of yours. You will get:
UPDATE: Expression to surround the second value with parenthesis.
=join(LookupSet(
Fields!Name.Value,
Fields!Name.Value,
Fields!Value.Value,
"DataSet4"
),Environment.NewLine & "(") & ")"
Let me know if this helps.