mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-30 07:59:53 -08:00
Merge pull request #1938 from prometheus/superq/timex_error
Handle EPERM for syscall in timex collector
This commit is contained in:
commit
87993cdd7e
|
@ -6,6 +6,7 @@
|
||||||
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics
|
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics
|
||||||
* [ENHANCEMENT] Added XFS inode operations to XFS metrics
|
* [ENHANCEMENT] Added XFS inode operations to XFS metrics
|
||||||
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64
|
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64
|
||||||
|
* [BUGFIX] Handle EPERM for syscall in timex collector
|
||||||
* [BUGFIX]
|
* [BUGFIX]
|
||||||
|
|
||||||
## 1.0.1 / 2020-06-15
|
## 1.0.1 / 2020-06-15
|
||||||
|
|
|
@ -17,9 +17,12 @@
|
||||||
package collector
|
package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/go-kit/kit/log"
|
"github.com/go-kit/kit/log"
|
||||||
|
"github.com/go-kit/kit/log/level"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
@ -163,6 +166,10 @@ func (c *timexCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
|
|
||||||
status, err := unix.Adjtimex(timex)
|
status, err := unix.Adjtimex(timex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, os.ErrPermission) {
|
||||||
|
level.Debug(c.logger).Log("msg", "Not collecting timex metrics", "err", err)
|
||||||
|
return ErrNoData
|
||||||
|
}
|
||||||
return fmt.Errorf("failed to retrieve adjtimex stats: %w", err)
|
return fmt.Errorf("failed to retrieve adjtimex stats: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue