Grafana custom legend with strings between hyphens - grafana

I am creating a Grafana Dashboard with the initial legends like these:
mon-master-app.ns.svc.cluster.local:8080
mon-worker1-app.ns.svc.cluster.local:8080
mon-worker2-app.ns.svc.cluster.local:8080
How can I use regular express to truncate the legend as these:
master
worker1
worker2

Related

Filter context for PIE Chart in Grafana

Is there any feature present to filter data in dashboard by clicking on one of the values in pie chart??
This can be done with the table visualization. Is it possible for piechart??
for example: Refer pic(red circled part)- If I click on piechart value DE then a filter should be added & applied to the dashboard

Grafana define Title value for chart

I am trying to create a dashboard. Able to generate Bar Gauge from the Prometheus data for simple query sum by (namespace) (kube_pod_container_status_running)
I want to display only Namespace rather than {namespace="kube-system"}, so was playing with Visualization > Field > Title for a while, but was not able to figure out.
Any Idea How can just display kube-system instead of {namespace="kube-system"} and make the list in sorted order, because everytime when i refresh the dashboard, it reshuffles the order.
What I need here ?
https://grafana.com/docs/grafana/latest/features/datasources/prometheus/
Legend format
Controls the name of the time series, using name or pattern. For example {{hostname}} will be replaced with label value for the label hostname.
=> configure Legend format in the Queries section and add {{namespace}} there.
I'm not sure about sort. You may try Prometheus sort/sort_desc function to sort query result.

Grafana Prometheus pie chart time range

I'm using Grafana to chart Prometheus data. I have a set of data in gauges and it's displaying just fine on line charts. When I try and use a pie chart it only seems to show the most recent data point, not the sum for the whole time range selected in the dashboard.
I'm trying this:
sum(successful_requests)
Is there something I need to do to get it to sum all the data in the time range?
Thanks,
Ian
Ok - I just figured it out thanks to an article about sum_over_time. You can do it like this:
sum(sum_over_time(total_requests[$__interval]))
The outer sum is good if you are trying to aggregate multiple series together, otherwise you can do without:
sum_over_time(total_requests[$__interval])
Ian

Create histograms in Grafana with alphabetical values as x-axis

I need to create a dashboard to be used in a control room, where a bunch of operators will need to monitor the number of tasks assigned to other employees (among other aspects).
Source data will be coming from a RDBMs (PostgreSQL, in this case). We have people with assigned and numbered tasks that also have a status, and the DB data is like this (purely fictional: but it resembles the real one)
Having to create and mantain a dashboard i was thinking to use tools like Grafana, Kibana or similars, to plot something like this
The problem is that Grafana, for example, doesn't let me use alphabetical values for the x-axis. It only allow numeric values, while i've names to plot (Mark, Luke, Brian).
Is there a best practice than i can follow? Am i trying to use the wrong tools?
Actually solution is easier then you think although it also took me some time to figure it out. I will place here an example for some unspecified shop data grouped over countries - you just need to change it for your task. Example was tested on Grafana 5.0.3
PostgreSQL query for metrics
SELECT
$__time( partition_date ),
country as metric,
sum(value) as value
FROM
aggregations.my_data_for_dashboard
WHERE
shop = 'myshopname' AND
$__timeFilter(partition_date )
group by 1, 2
Grafana will show usual metrics:
In "Axes" tab look at "X-Axis" section, item "Mode" - switch "Time" to "Series" and Grafana will show bar chart for countries.

Add column data value labels in Google Drive Spreadsheet chart

Is there an (easy) way to add data-value labels to the columns of a Google Drive Spreadsheet column chart? Either fixed or mouse-over?
I have the charts already made, and would not like to have to define them again.
So I'm basically looking to alter the default behaviour of the existing charts.
The spreadsheet and charts are not (yet) for publishing, only for sharing directly.
Nick
Google Sheets embedded charts have text annotations. To use them for values, you could use TEXT() function. I.E. assume that you have a two column chart, then add a third column for annotations. Add the following formula
=TEXT(A2,"0")
then fill down as necessary.
Example
References
Adding annotations to a chart - Docs Editors Help