Skip to content

Commit

Permalink
Ignore wifi collector permission errors (prometheus#646)
Browse files Browse the repository at this point in the history
Ignore the permission denined error when the wifi collector has no
permission to read metrics.
  • Loading branch information
SuperQ authored Aug 18, 2017
1 parent b7cc6fb commit 8839640
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion collector/wifi_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 8839640

Please sign in to comment.