Search code examples
mysqlprometheusgrafanaprometheus-node-exporter

InnoDB Buffer Pool Size % of Total RAM - (Buffer Pool Size of Total RAM) returning No Data


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

Buffer Pool Size of Total RAM

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

Solution

  • Follow the steps to update buffer pool size-

    1. Edit innodb_buffer_pool_size enter image description here
    2. MySQL Overview / Edit Panel, replace Metrics (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- enter image description here

    1. Save setting

    enter image description here