To scrape the metrics of your Growatt inverter using Prometheus, it is necessary to set up a Prometheus server. If you are not familiar with this technology, please refer to the getting started tutorial.
A possible configuration for the prometheus.yml
file used to scrape the metrics every 5 minutes is as follows:
global:
scrape_interval: 5m
scrape_configs:
- job_name: 'growatt'
static_configs:
- targets: ['<ip>:80']
metrics_path: /metrics
You can check the names of the metrics available by inspecting the endpoint http://<ip>/metrics
. You should get a response similar to the following:
growatt_inverter_status{mac="<mac>"} 5
growatt_input_power{mac="<mac>"} 2520
growatt_pv1_voltage{mac="<mac>"} 261.5
[...]
For instance, a metric name is growatt_inverter_status
. You can query Prometheus using the PromQL language. A basic query consists of the metric name. You can check if your metrics are being collected by querying Prometheus using a metric name.
It is quite common to use Grafana to build dashboards using Prometheus as a data source. You will need to install Grafana and configure it to query Prometheus. Then, it is possible to build a dashboard. If your Modbus version is v1.24, you can refer to this dashboard as a possible example. It may work without modifications or not, depending on the model of your inverter and the available metrics.