I'm using netdata to monitor my instance and containers.
I use prometheus to query the data and I use influxDB to store it
Netdata creates long chart name and I would like to reduce them to make my dashboard clearer.
I want the label to be the actual name of the containers :
nginx
grafana
netdata
...
But what I get is cgroup_<container_name>.<metric_name>
I can see that there is a pull request about legend formatting since 2016 but I was wondering if there is another solution.
Maybe directly from Netdata? Or maybe using another tool such as Graphite instead of Prometheus?
i'm not using prometheus so i can't help you but i'm on graphite. With graphite u can use alias() function to display shorter name.
Related
I am using prometheues metric in grafana UI emitted from sysdig dashboard.
I am implementing a state change metric i.e pod states and my data mode is below:
pod_request_state_duration(id,method="create",demoapi,state=creating-running)
I want to use promQL to find the changing state and display in grafana UI. Please help.
As the query is not exact, i will try to give a best possible solution.
Try using delta.
delta(pod_request_state_duration{id,method="create",demoapi,state=creating-running}[time_duration])
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.
I want to show in Grafana with an Annotation if there is a successful Prometheus config reload.
Grafana v6.3.5 &
Prometheus v2.12.0
I imported an existing Dashboard for internal Prometheus Stats and saw that within this Dashboard they use the following Statement as Annotion: sum(changes(prometheus_config_last_reload_success_timestamp_seconds[10m]))
Sadly this does not work and I am not sure how to properly use the metric to create Annotations.
How can I use this Metric to make this work?
Since you are using a recent version of Grafana, you don't need this expression any more. There is a feature to display annotations base on series value.
If you want in annotations the successful reloads of configuration, you can simply use the value of the metric prometheus_config_last_reload_success_timestamp_seconds, multiplied by 1000 to have the timestamp in msec (as expected by Grafana). And there is a tick box at the bottom of the annotation panel Series value as timestamp to active.
Save your dashboard and that's all.
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/
I have similar services on the same host. For example I have two mysql server named mysql01 e mysql02. I have installed two mysqld_exporter one for each mysql server. The values of label instance are instance="<host>-mysql01" and instance="<host>-mysql02". I have also installed node_exporter on the same host.
I wish to relate mysql_exporter series with node_exporter series. For example, on the same grafana dashboard, dedicated to mysql0x, I wish to visualize metrics about swap memory and buffer pool size. So I need to visualize the following series:
mysql_global_variables_innodb_buffer_pool_size{instance="<host>-mysql0x"}
node_memory_SwapTotal_bytes{instance="<host>"}
How can I extract from instance label value <host>-mysql0x the host part?
As bonus question: there is a best practice to label similar service on the same host?
you can use regex to do that as mentioned in the documentation.
http://docs.grafana.org/reference/templating/#filter-and-modify-the-options-using-a-regex-capture-group-to-return-part-of-the-text
Note: regex in image is just example