I have installed the prometheus node_exporter running on port 9100
and mysqld_exporterrunning in port 9104
and configured grafana to use prometheus as the default source.
From the grafana explorer, I can query the node_memory_MemTotal_bytes
using something like:
node_memory_MemTotal_bytes{instance="10.0.0.4:9100"}
notice port 9100 (node_exporter)
And I can query also the innodb_buffer_pool_size
using:
mysql_global_variables_innodb_buffer_pool_size{instance="10.0.0.4:9104"}
notice port 9104 (mysqld_exporter)
I would like to calculate the Buffer pool size of total RAM
using:
(mysql_global_variables_innodb_buffer_pool_size{instance=~"$host"} * 100) / on (instance) node_memory_MemTotal_bytes{instance=~"$host"}
The problem I have is that $host
is the IP and the port: 10.0.0.4:9104
and can only obtain the mysql_global_variables_innodb_buffer_pool_size
from the mysqld_exporter
and not the node_memory_MemTotal_bytes
since is in port 9100
because of this I am getting No Data
Any ideas about how could I mix data the metrics from the node_exporter
& the mysqld_exporter
?
This is the prometheus configuration:
- job_name: test_mysql
scheme: http
static_configs:
- targets:
- 10.0.0.4:9104
- job_name: test_node
scheme: http
static_configs:
- targets:
- 10.0.0.4:9100
Follow the steps to update buffer pool size-
(mysql_global_variables_innodb_buffer_pool_size{instance="$host"} * 100) / on (instance) node_memory_MemTotal_bytes{instance="$host"}
into avg by (node_name) ((mysql_global_variables_innodb_buffer_pool_size{service_name=~""} * 100)) /on (node_name) (avg by (node_name) (node_memory_MemTotal_bytes{node_name=~""}))
Replace old metric as given below-