Skip to content

Commit e3d0863

Browse files
committed
add more metrics and add fenecon names to help
- add GridMode - add EssCapacity - add EssDcChargeEnergy - add EssDcDischargeEnergy Signed-off-by: Markus Blaschke <[email protected]>
1 parent 5687970 commit e3d0863

2 files changed

Lines changed: 70 additions & 26 deletions

File tree

fenecon/metrics.go

Lines changed: 66 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ type (
99
info *prometheus.GaugeVec
1010
status *prometheus.GaugeVec
1111

12-
batteryCharge *prometheus.GaugeVec
13-
batteryPower *prometheus.GaugeVec
14-
batteryPowerPhase *prometheus.GaugeVec
15-
batteryPowerChargeTotal *prometheus.GaugeVec
16-
batteryPowerDischargeTotal *prometheus.GaugeVec
17-
12+
batteryCharge *prometheus.GaugeVec
13+
batteryCapacity *prometheus.GaugeVec
14+
batteryPower *prometheus.GaugeVec
15+
batteryPowerPhase *prometheus.GaugeVec
16+
batteryPowerChargeTotal *prometheus.GaugeVec
17+
batteryPowerDischargeTotal *prometheus.GaugeVec
18+
batteryPowerDcChargeTotal *prometheus.GaugeVec
19+
batteryPowerDcDischargeTotal *prometheus.GaugeVec
20+
21+
gridMode *prometheus.GaugeVec
1822
gridPower *prometheus.GaugeVec
1923
gridPowerPhase *prometheus.GaugeVec
2024
gridPowerBuyTotal *prometheus.GaugeVec
@@ -56,7 +60,7 @@ func (fp *FeneconProber) initMetrics() {
5660
fp.prometheus.status = prometheus.NewGaugeVec(
5761
prometheus.GaugeOpts{
5862
Name: "fenecon_status",
59-
Help: "Fenecon status",
63+
Help: "Fenecon status (0=ok, 1=info, 2=warning, 3=error; State)",
6064
},
6165
commonLabels,
6266
)
@@ -68,16 +72,25 @@ func (fp *FeneconProber) initMetrics() {
6872
fp.prometheus.batteryCharge = prometheus.NewGaugeVec(
6973
prometheus.GaugeOpts{
7074
Name: "fenecon_battery_charge_percent",
71-
Help: "Fenecon battery charge in percent",
75+
Help: "Fenecon battery charge in percent (EssSoc)",
7276
},
7377
commonLabels,
7478
)
7579
fp.registry.MustRegister(fp.prometheus.batteryCharge)
7680

81+
fp.prometheus.batteryCapacity = prometheus.NewGaugeVec(
82+
prometheus.GaugeOpts{
83+
Name: "fenecon_battery_capacity",
84+
Help: "Fenecon battery capacity in Watthours (EssCapacity)",
85+
},
86+
commonLabels,
87+
)
88+
fp.registry.MustRegister(fp.prometheus.batteryCapacity)
89+
7790
fp.prometheus.batteryPower = prometheus.NewGaugeVec(
7891
prometheus.GaugeOpts{
7992
Name: "fenecon_battery_power",
80-
Help: "Fenecon battery power load in Watts",
93+
Help: "Fenecon battery power load in Watts (EssActivePower)",
8194
},
8295
commonLabels,
8396
)
@@ -86,7 +99,7 @@ func (fp *FeneconProber) initMetrics() {
8699
fp.prometheus.batteryPowerPhase = prometheus.NewGaugeVec(
87100
prometheus.GaugeOpts{
88101
Name: "fenecon_battery_power_phase",
89-
Help: "Fenecon battery power load in Watts",
102+
Help: "Fenecon battery power load in Watts (EssActivePowerLx)",
90103
},
91104
phaseLabels,
92105
)
@@ -95,7 +108,7 @@ func (fp *FeneconProber) initMetrics() {
95108
fp.prometheus.batteryPowerChargeTotal = prometheus.NewGaugeVec(
96109
prometheus.GaugeOpts{
97110
Name: "fenecon_battery_power_charge_total",
98-
Help: "Fenecon battery power charge in Wattshours",
111+
Help: "Fenecon battery power charge in Wattshours (EssActiveChargeEnergy)",
99112
},
100113
commonLabels,
101114
)
@@ -104,19 +117,46 @@ func (fp *FeneconProber) initMetrics() {
104117
fp.prometheus.batteryPowerDischargeTotal = prometheus.NewGaugeVec(
105118
prometheus.GaugeOpts{
106119
Name: "fenecon_battery_power_discharge_total",
107-
Help: "Fenecon battery power discharge in Wattshours",
120+
Help: "Fenecon battery power discharge in Wattshours (EssActiveDischargeEnergy)",
108121
},
109122
commonLabels,
110123
)
111124
fp.registry.MustRegister(fp.prometheus.batteryPowerDischargeTotal)
112125

126+
fp.prometheus.batteryPowerDcChargeTotal = prometheus.NewGaugeVec(
127+
prometheus.GaugeOpts{
128+
Name: "fenecon_battery_power_dc_charge_total",
129+
Help: "Fenecon battery power dc charge in Wattshours (EssDcChargeEnergy)",
130+
},
131+
commonLabels,
132+
)
133+
fp.registry.MustRegister(fp.prometheus.batteryPowerDcChargeTotal)
134+
135+
fp.prometheus.batteryPowerDcDischargeTotal = prometheus.NewGaugeVec(
136+
prometheus.GaugeOpts{
137+
Name: "fenecon_battery_power_dc_discharge_total",
138+
Help: "Fenecon battery power dc discharge in Wattshours (EssDcDischargeEnergy)",
139+
},
140+
commonLabels,
141+
)
142+
fp.registry.MustRegister(fp.prometheus.batteryPowerDcDischargeTotal)
143+
113144
// ##########################################
114145
// Grid
115146

147+
fp.prometheus.gridMode = prometheus.NewGaugeVec(
148+
prometheus.GaugeOpts{
149+
Name: "fenecon_grid_mode",
150+
Help: "Fenecon grid mode (0=undefined, 1=On-Grid, 2=Off-Grid; GridActivePower)",
151+
},
152+
commonLabels,
153+
)
154+
fp.registry.MustRegister(fp.prometheus.gridMode)
155+
116156
fp.prometheus.gridPower = prometheus.NewGaugeVec(
117157
prometheus.GaugeOpts{
118158
Name: "fenecon_grid_power",
119-
Help: "Fenecon grid power load in Watts",
159+
Help: "Fenecon grid power load in Watts (GridActivePower)",
120160
},
121161
commonLabels,
122162
)
@@ -125,7 +165,7 @@ func (fp *FeneconProber) initMetrics() {
125165
fp.prometheus.gridPowerPhase = prometheus.NewGaugeVec(
126166
prometheus.GaugeOpts{
127167
Name: "fenecon_grid_power_phase",
128-
Help: "Fenecon grid power load in Watts",
168+
Help: "Fenecon grid power load in Watts (GridActivePowerLx)",
129169
},
130170
phaseLabels,
131171
)
@@ -134,7 +174,7 @@ func (fp *FeneconProber) initMetrics() {
134174
fp.prometheus.gridPowerBuyTotal = prometheus.NewGaugeVec(
135175
prometheus.GaugeOpts{
136176
Name: "fenecon_grid_power_buy_total",
137-
Help: "Fenecon grid power buy in Wattshours",
177+
Help: "Fenecon grid power buy in Wattshours (GridBuyActiveEnergy)",
138178
},
139179
commonLabels,
140180
)
@@ -143,7 +183,7 @@ func (fp *FeneconProber) initMetrics() {
143183
fp.prometheus.gridPowerSellTotal = prometheus.NewGaugeVec(
144184
prometheus.GaugeOpts{
145185
Name: "fenecon_grid_power_sell_total",
146-
Help: "Fenecon grid power sell in Wattshours",
186+
Help: "Fenecon grid power sell in Wattshours (GridSellActiveEnergy)",
147187
},
148188
commonLabels,
149189
)
@@ -155,7 +195,7 @@ func (fp *FeneconProber) initMetrics() {
155195
fp.prometheus.productionPower = prometheus.NewGaugeVec(
156196
prometheus.GaugeOpts{
157197
Name: "fenecon_production_power",
158-
Help: "Fenecon production power load in Watts",
198+
Help: "Fenecon production power load in Watts (ProductionActivePower)",
159199
},
160200
commonLabels,
161201
)
@@ -164,7 +204,7 @@ func (fp *FeneconProber) initMetrics() {
164204
fp.prometheus.productionPowerPhase = prometheus.NewGaugeVec(
165205
prometheus.GaugeOpts{
166206
Name: "fenecon_production_power_phase",
167-
Help: "Fenecon production power load in Watts",
207+
Help: "Fenecon production power load in Watts (ProductionAcActivePowerLx)",
168208
},
169209
phaseLabels,
170210
)
@@ -173,7 +213,7 @@ func (fp *FeneconProber) initMetrics() {
173213
fp.prometheus.productionPowerAc = prometheus.NewGaugeVec(
174214
prometheus.GaugeOpts{
175215
Name: "fenecon_production_power_ac",
176-
Help: "Fenecon production power load in Watts",
216+
Help: "Fenecon production power load in Watts (ProductionAcActivePower)",
177217
},
178218
commonLabels,
179219
)
@@ -182,7 +222,7 @@ func (fp *FeneconProber) initMetrics() {
182222
fp.prometheus.productionPowerDc = prometheus.NewGaugeVec(
183223
prometheus.GaugeOpts{
184224
Name: "fenecon_production_power_dc",
185-
Help: "Fenecon production power load in Watts",
225+
Help: "Fenecon production power load in Watts (ProductionDcActualPower)",
186226
},
187227
commonLabels,
188228
)
@@ -191,7 +231,7 @@ func (fp *FeneconProber) initMetrics() {
191231
fp.prometheus.productionPowerTotal = prometheus.NewGaugeVec(
192232
prometheus.GaugeOpts{
193233
Name: "fenecon_production_power_total",
194-
Help: "Fenecon production power load in Watthours",
234+
Help: "Fenecon production power load in Watthours (ProductionActiveEnergy)",
195235
},
196236
commonLabels,
197237
)
@@ -200,7 +240,7 @@ func (fp *FeneconProber) initMetrics() {
200240
fp.prometheus.productionPowerAcTotal = prometheus.NewGaugeVec(
201241
prometheus.GaugeOpts{
202242
Name: "fenecon_production_power_ac_total",
203-
Help: "Fenecon production power load in Watthours",
243+
Help: "Fenecon production power load in Watthours (ProductionAcActiveEnergy)",
204244
},
205245
commonLabels,
206246
)
@@ -209,7 +249,7 @@ func (fp *FeneconProber) initMetrics() {
209249
fp.prometheus.productionPowerDcTotal = prometheus.NewGaugeVec(
210250
prometheus.GaugeOpts{
211251
Name: "fenecon_production_power_dc_total",
212-
Help: "Fenecon production power load in Watthours",
252+
Help: "Fenecon production power load in Watthours (ProductionDcActiveEnergy)",
213253
},
214254
commonLabels,
215255
)
@@ -221,7 +261,7 @@ func (fp *FeneconProber) initMetrics() {
221261
fp.prometheus.consumptionPower = prometheus.NewGaugeVec(
222262
prometheus.GaugeOpts{
223263
Name: "fenecon_consumption_power",
224-
Help: "Fenecon consumption power load in Watts",
264+
Help: "Fenecon consumption power load in Watts (ConsumptionActivePower)",
225265
},
226266
commonLabels,
227267
)
@@ -230,7 +270,7 @@ func (fp *FeneconProber) initMetrics() {
230270
fp.prometheus.consumptionPowerPhase = prometheus.NewGaugeVec(
231271
prometheus.GaugeOpts{
232272
Name: "fenecon_consumption_power_phase",
233-
Help: "Fenecon consumption power load in Watts",
273+
Help: "Fenecon consumption power load in Watts (ConsumptionActivePowerLX)",
234274
},
235275
phaseLabels,
236276
)
@@ -239,7 +279,7 @@ func (fp *FeneconProber) initMetrics() {
239279
fp.prometheus.consumptionPowerTotal = prometheus.NewGaugeVec(
240280
prometheus.GaugeOpts{
241281
Name: "fenecon_consumption_power_total",
242-
Help: "Fenecon consumption power load in Watts",
282+
Help: "Fenecon consumption power load in Watts (ConsumptionActiveEnergy)",
243283
},
244284
commonLabels,
245285
)

fenecon/prober.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,18 @@ func (fp *FeneconProber) Run(target string) {
102102

103103
// battery
104104
fp.queryCommon(&wg, client, "_sum/EssSoc", commonLabels, fp.prometheus.batteryCharge)
105+
fp.queryCommon(&wg, client, "_sum/EssCapacity", commonLabels, fp.prometheus.batteryCapacity)
105106
fp.queryCommon(&wg, client, "_sum/EssActivePower", commonLabels, fp.prometheus.batteryPower)
106107
fp.queryCommonIfNotZero(&wg, client, "_sum/EssActiveChargeEnergy", commonLabels, fp.prometheus.batteryPowerChargeTotal)
107108
fp.queryCommonIfNotZero(&wg, client, "_sum/EssActiveDischargeEnergy", commonLabels, fp.prometheus.batteryPowerDischargeTotal)
109+
fp.queryCommonIfNotZero(&wg, client, "_sum/EssDcChargeEnergy", commonLabels, fp.prometheus.batteryPowerDcChargeTotal)
110+
fp.queryCommonIfNotZero(&wg, client, "_sum/EssDcDischargeEnergy", commonLabels, fp.prometheus.batteryPowerDcDischargeTotal)
108111
fp.queryCommon(&wg, client, "_sum/EssActivePowerL1", phase1Labels, fp.prometheus.batteryPowerPhase)
109112
fp.queryCommon(&wg, client, "_sum/EssActivePowerL2", phase2Labels, fp.prometheus.batteryPowerPhase)
110113
fp.queryCommon(&wg, client, "_sum/EssActivePowerL3", phase3Labels, fp.prometheus.batteryPowerPhase)
111114

112115
// grid
116+
fp.queryCommon(&wg, client, "_sum/GridMode", commonLabels, fp.prometheus.gridMode)
113117
fp.queryCommon(&wg, client, "_sum/GridActivePower", commonLabels, fp.prometheus.gridPower)
114118
fp.queryCommonIfNotZero(&wg, client, "_sum/GridBuyActiveEnergy", commonLabels, fp.prometheus.gridPowerBuyTotal)
115119
fp.queryCommonIfNotZero(&wg, client, "_sum/GridSellActiveEnergy", commonLabels, fp.prometheus.gridPowerSellTotal)

0 commit comments

Comments
 (0)