From 8839640cd1e9af5f66d90d8709ae65b2f370e866 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Fri, 18 Aug 2017 10:19:48 +0200 Subject: [PATCH] Ignore wifi collector permission errors (#646) Ignore the permission denined error when the wifi collector has no permission to read metrics. --- collector/wifi_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/collector/wifi_linux.go b/collector/wifi_linux.go index 117e4ae5..0e3ef9b9 100644 --- a/collector/wifi_linux.go +++ b/collector/wifi_linux.go @@ -144,11 +144,15 @@ func NewWifiCollector() (Collector, error) { func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error { stat, err := newWifiStater(*collectorWifi) if err != nil { - // Cannot access wifi metrics, report no error + // Cannot access wifi metrics, report no error. if os.IsNotExist(err) { log.Debug("wifi collector metrics are not available for this system") 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) }