@@ -181,16 +181,16 @@ func ScrapeTarget(ctx context.Context, target string, config *config.Module, log
181
181
continue
182
182
}
183
183
184
- allowedList = filterAllowedInstances (logger , filter , pdus , allowedList )
184
+ allowedList = filterAllowedIndices (logger , filter , pdus , allowedList )
185
185
186
- // Update config to get only instance and not walk them
186
+ // Update config to get only index and not walk them
187
187
newWalk = updateWalkConfig (newWalk , filter , logger )
188
188
189
- // Only Keep instance not involved in filters
189
+ // Only Keep indices not involved in filters
190
190
newCfg := updateGetConfig (newGet , filter , logger )
191
191
192
- // We now add each instance from filter to the get list
193
- newCfg = addAllowedInstances (filter , allowedList , logger , newCfg )
192
+ // We now add each index from filter to the get list
193
+ newCfg = addAllowedIndices (filter , allowedList , logger , newCfg )
194
194
195
195
newGet = newCfg
196
196
}
@@ -261,7 +261,7 @@ func ScrapeTarget(ctx context.Context, target string, config *config.Module, log
261
261
return results , nil
262
262
}
263
263
264
- func filterAllowedInstances (logger log.Logger , filter config.DynamicFilter , pdus []gosnmp.SnmpPDU , allowedList []string ) []string {
264
+ func filterAllowedIndices (logger log.Logger , filter config.DynamicFilter , pdus []gosnmp.SnmpPDU , allowedList []string ) []string {
265
265
level .Debug (logger ).Log ("msg" , "Evaluating rule for oid" , "oid" , filter .Oid )
266
266
for _ , pdu := range pdus {
267
267
found := false
@@ -276,9 +276,9 @@ func filterAllowedInstances(logger log.Logger, filter config.DynamicFilter, pdus
276
276
}
277
277
if found {
278
278
pduArray := strings .Split (pdu .Name , "." )
279
- instance := pduArray [len (pduArray )- 1 ]
280
- level .Debug (logger ).Log ("msg" , "Caching instance " , "instance " , instance )
281
- allowedList = append (allowedList , instance )
279
+ index := pduArray [len (pduArray )- 1 ]
280
+ level .Debug (logger ).Log ("msg" , "Caching index " , "index " , index )
281
+ allowedList = append (allowedList , index )
282
282
}
283
283
}
284
284
return allowedList
@@ -324,11 +324,11 @@ func updateGetConfig(getConfig []string, filter config.DynamicFilter, logger log
324
324
return newCfg
325
325
}
326
326
327
- func addAllowedInstances (filter config.DynamicFilter , allowedList []string , logger log.Logger , newCfg []string ) []string {
327
+ func addAllowedIndices (filter config.DynamicFilter , allowedList []string , logger log.Logger , newCfg []string ) []string {
328
328
for _ , targetOid := range filter .Targets {
329
- for _ , instance := range allowedList {
330
- level .Debug (logger ).Log ("msg" , "Adding get configuration" , "oid" , targetOid + "." + instance )
331
- newCfg = append (newCfg , targetOid + "." + instance )
329
+ for _ , index := range allowedList {
330
+ level .Debug (logger ).Log ("msg" , "Adding get configuration" , "oid" , targetOid + "." + index )
331
+ newCfg = append (newCfg , targetOid + "." + index )
332
332
}
333
333
}
334
334
return newCfg
0 commit comments