Multiple asPercent series - grafana

Metrics example - something.{variable}.success & something.{variable}.total
What I want to achieve is multiple series graph containing the success percentage for each feature variable.
Trying asPercent(something.*.success, something.*.total) makes graphite simply return 400 in grafana.
As I understand I would be able to achieve this by applyByNode(), but it seems that it's not available in grafana's graphite integration? I'm using self-hosted grafana 7.0 with graphite 1.1.7 .
I also seen example of nesting reduceSeries and mapSeries, but all of them use predefined values for wildcard, in my case there are too many of them to bother.

Related

Prometheus query to get memory limit commitment for the entire cluster

I'm using the latest prometheus 2.21.0 and latest node-exporter
Trying to run the query and getting no datapoints found however both metrics kube_pod_container_resource_limits_memory_bytes and node_memory_MemTotal_bytes are working independently and return data
(sum(kube_pod_container_resource_limits_memory_bytes) / :node_memory_MemTotal_bytes:sum)*100
So two questions
I never saw such syntax before :node_memory_MemTotal_bytes:sum - is it valid prometheus query?
What is wrong with the query if the syntax is correct?
This is a convention widely used in prometheus land. It means this metric is not one directly scraped from some target(s), but instead a result of recording rule. This convention is described here.
If queries on both left and right side return data individually but after performing artihmetic on them you are left with no data then it probably means labels on them are not exactly the same. Execute them separately and compare labels you have on your results. Assuming that :node_memory_MemTotal_bytes:sum does return data then you'll probably have to add sum there too to remove any remaining labels there

Is it possible to have 2 different data sources in grafana dashboard

Is it possible to have 2 different sources i.e influxdb and prometheus in a single dashboard in grafana.
Yes, each panel or variable on a dashboard can use different data source.
Variables can use different data source and you can use it on panel no matter what data source uses. It allows you to mix information to have a better dashboard with more details.
Also, you have three especial data sources:
Grafana built-in data source that generates random walk data.
Mixed query multiple data sources in the same panel.
Dashboard use a result set from another panel in the same dashboard.
More info about data sources here
Yes, you can select the desired data sources in several points of the dashboard configuration (like panels and variables) and you can use different values for each one.

Grafana and Prometheus: add metrics automatically

I'm using Grafana and Prometheus to monitor our server. We have a lot of database procedures like "select_users" or "insert_task". In order to monitor how many pending database procedure calls are there in the server, we add data points for every procedure call in Prometheus dynamically. Now we have data points like "pending_select_users", "pending_insert_task" in Prometheus.
However, since there are so many database procedures(and the number will increase during developing), it's not very practical for us to add metrics in Grafana for each data point manually. Is there a way we can add metrics dynamically in Grafana? Since all the data point have a common name prefix("pending_"), can we add metrics in Grafana with wildcard? Or is there a better way to do this?
Since Grafana uses JSON as the underlying dashboard DSL, you could dynamically create dashboards, every time you add a new metric, and import it (via API) into Grafana.
I'd add an automation on top of your Prometheus targets, scrape the metrics, and if new metrics (with the required prefix) are found without a matching dashboard, the automation would create it and import it into Grafana.
Grafana API: http://docs.grafana.org/http_api/ (specifically for Dashbboards).
The solution described by #Eitan is definitely feasible. The same goes for using a library like grafonnet to generate dashboards dynamically.
But the simplest approach in my opinion would be to create a variable in Grafana that contains all the label values you are interested in. Something like
label_values(metric_name{label_name=~"prefix*"}, label_name)
should work for that. And then use the repeating panels / rows feature of Grafana to repeat a set of panels for every value in the variable. Though this could get out of hand if you have dozens / hundreds of distinct values.
https://grafana.com/docs/grafana/latest/variables/repeat-panels-or-rows/
https://grafana.com/blog/2020/06/09/learn-grafana-how-to-automatically-repeat-rows-and-panels-in-dynamic-dashboards/
If you want to generate just a single dashboard from your Proimetheus metrics sample, you can use this service:
http://eljah.tatar/micrometer2grafana/

How to properly monitor ELB latency on AWS using Grafana?

I am trying to monitor Latency on ElasticBeanstalk environment using Grafana.
I get some things to work, and some things do not provide any information.
I am using "CloudWatch" data source.
There is ELB and ApplicationELB.
The ApplicationELB does not offer Latency metric. In fact, every metric I select here will result with "no data".
When I configure monitoring on AWS, I get this following graph:
I am able to query for Latency on a region using Grafana and I do get some correlation
As you can see around 13:50 some requests timed-out. But it is also obvious Grafana is showing additional information from other environments which I would like to ignore.
My query currently looks like this:
Which I know is too broad, but I do not know how to refine.
I tried using "InstanceName" as dimension, but it is not clear to me which ELB I should look for, and seems to me like ApplicationELB should be what I am looking for, but that one does not offer Latency and does not provide any data either way.
Using AvailabilityZone does not help, and that's the only other option for dimension (other than InstanceName).
I need a way to refine the query so I see the same result in AWS and Grafana.
A clarification about ApplicationELB and ELB would be great also!
Application ELB vs ELB: they are just different types of load balancers provided by AWS https://aws.amazon.com/elasticloadbalancing/ - I'm not sure which one is used by ElasticBeanstalk.
You need to add dimension to filter your metrics. Some metrics may need multiple dimensions for correct filtering. Available dimensions are available in the docs. For example LoadBalancerName is a correct dimension for AWS/ELB namespace: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html
I recommend to use existing published AWS dashboard(s) (https://github.com/monitoringartist/grafana-aws-cloudwatch-dashboards - I'm the author) and then just customize them for your needs.

divideSeriesList in Grafana 5.1.0

I have a requirement to divide two series lists. As documentation says "divideSeriesList" function added in Graphite in 1.0.2 version.
So, I updated my Graphite to 1.0.2 and Grafana to 5.1.0. After update, I can see "devideSeriesList" in Graphite but not in Grafana. Where as I can see many other new functions in Grafana after update.
Is there any way I can solve this issue or any alternate way to divide two series lists in Grafana?
Thanks,
List of the functions (https://github.com/grafana/grafana/blob/master/public/app/plugins/datasource/graphite/gfunc.ts) in Grafana is static and it's currently out of sync according to graphite. Do not hesitate to make PR to Grafana with updated.
Alternatively you can write your own datasource plugin - http://docs.grafana.org/plugins/developing/datasources/.