diff --git a/src/WebApi_prometheus.cpp b/src/WebApi_prometheus.cpp index 3596376ea..2cbc6f5d1 100644 --- a/src/WebApi_prometheus.cpp +++ b/src/WebApi_prometheus.cpp @@ -81,6 +81,22 @@ void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* reques stream->printf("opendtu_last_update{serial=\"%s\",unit=\"%d\",name=\"%s\"} %d\n", serial.c_str(), i, name, inv->Statistics()->getLastUpdate() / 1000); + if (i == 0) { + stream->print("# HELP opendtu_inverter_limit_relative current relative limit of the inverter\n"); + stream->print("# TYPE opendtu_inverter_limit_relative gauge\n"); + } + stream->printf("opendtu_inverter_limit_relative{serial=\"%s\",unit=\"%d\",name=\"%s\"} %f\n", + serial.c_str(), i, name, inv->SystemConfigPara()->getLimitPercent() / 100.0); + + if (inv->DevInfo()->getMaxPower() > 0) { + if (i == 0) { + stream->print("# HELP opendtu_inverter_limit_absolute current relative limit of the inverter\n"); + stream->print("# TYPE opendtu_inverter_limit_absolute gauge\n"); + } + stream->printf("opendtu_inverter_limit_absolute{serial=\"%s\",unit=\"%d\",name=\"%s\"} %f\n", + serial.c_str(), i, name, inv->SystemConfigPara()->getLimitPercent() * inv->DevInfo()->getMaxPower() / 100.0); + } + // Loop all channels if Statistics have been updated at least once since DTU boot if (inv->Statistics()->getLastUpdate() > 0) { for (auto& t : inv->Statistics()->getChannelTypes()) {