@@ -148,7 +148,7 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
148
148
"info" ), "node network address by device" ,
149
149
[]string {"device" , "address" , "netmask" , "scope" }, nil )
150
150
151
- for _ , addr := range getAddrsInfo (interfaces ) {
151
+ for _ , addr := range getAddrsInfo (interfaces , & c . deviceFilter , c . logger ) {
152
152
ch <- prometheus .MustNewConstMetric (desc , prometheus .GaugeValue , 1 ,
153
153
addr .device , addr .addr , addr .netmask , addr .scope )
154
154
}
@@ -180,10 +180,14 @@ func scope(ip net.IP) string {
180
180
}
181
181
182
182
// getAddrsInfo returns interface name, address, scope and netmask for all interfaces.
183
- func getAddrsInfo (interfaces []net.Interface ) []addrInfo {
183
+ func getAddrsInfo (interfaces []net.Interface , filter * deviceFilter , logger * slog. Logger ) []addrInfo {
184
184
var res []addrInfo
185
185
186
186
for _ , ifs := range interfaces {
187
+ if filter .ignored (ifs .Name ) {
188
+ logger .Debug ("Ignoring device" , "device" , ifs .Name )
189
+ continue
190
+ }
187
191
addrs , _ := ifs .Addrs ()
188
192
for _ , addr := range addrs {
189
193
ip , ipNet , err := net .ParseCIDR (addr .String ())
0 commit comments