mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-01-15 16:03:03 -08:00
Ignore wifi collector permission errors (#646)
Ignore the permission denined error when the wifi collector has no permission to read metrics.
This commit is contained in:
parent
b7cc6fbea7
commit
8839640cd1
|
@ -144,11 +144,15 @@ func NewWifiCollector() (Collector, error) {
|
||||||
func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
stat, err := newWifiStater(*collectorWifi)
|
stat, err := newWifiStater(*collectorWifi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Cannot access wifi metrics, report no error
|
// Cannot access wifi metrics, report no error.
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
log.Debug("wifi collector metrics are not available for this system")
|
log.Debug("wifi collector metrics are not available for this system")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if os.IsPermission(err) {
|
||||||
|
log.Debug("wifi collector got permission denied when accessing metrics")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return fmt.Errorf("failed to access wifi data: %v", err)
|
return fmt.Errorf("failed to access wifi data: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue