How can I group labels in a Prometheus query?

Yes, you can you use label replace to group all the misc together: sum by (new_group) ( label_replace( label_replace(my_metric, “new_group”, “$1”, “group”, “.+”), “new_group”, “misc”, “group”, “misc group.+” ) ) The inner label_replace copies all values from group into new_group, the outer overwrites those which match “misc group.+” with “misc”, and we then sum by … Read more

Prometheus – add target specific label in static_configs

I have the same question before. Here is my solution: use job_name as the group label add more target option to separate instance and add labels For you the code may like this: – job_name: ‘development’ static_configs: – targets: [ ‘192.168.1.1:9100’ ] labels: service: ‘1’ – targets: [ ‘192.168.1.1:9101’ ] labels: service: ‘2’

How do I write a Prometheus query that returns the value of a label?

My answer tries to elaborate on Carl’s answer. I assume that the GUI layout may have changed a little since 2016, so it took me while to find the “name” option. Assuming you have a metric as follows: # HELP db2_prometheus_adapter_info Information on the state of the DB2-Prometheus-Adapter # TYPE db2_prometheus_adapter_info gauge db2_prometheus_adapter_info{app_state=”UP”) 1.0 and … Read more

Usecases: InfluxDB vs. Prometheus [closed]

InfluxDB CEO and developer here. The next version of InfluxDB (0.9.5) will have our new storage engine. With that engine we’ll be able to efficiently store either single event data or regularly sampled series. i.e. Irregular and regular time series. InfluxDB supports int64, float64, bool, and string data types using different compression schemes for each … Read more

Get Total requests in a period of time

What you need is the increase() function, that will calculate the difference between the counter values at the start and at the end of the specified time interval. It also correctly handles counter resets during that time period (if any). increase(http_requests_total[24h]) If you have multiple counters http_requests_total (e.g. from multiple instances) and you need to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)