mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
fix issues
This commit is contained in:
parent
e7bf2f8579
commit
2e027c850e
|
@ -11,8 +11,8 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build dragonfly || freebsd || netbsd || openbsd
|
//go:build dragonfly || freebsd || netbsd || openbsd || 386
|
||||||
// +build dragonfly freebsd netbsd openbsd
|
// +build dragonfly freebsd netbsd openbsd 386
|
||||||
|
|
||||||
package collector
|
package collector
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Expose filesystem fullness.
|
// Expose filesystem fullness.
|
||||||
func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
|
func (c *filesystemCollector) GetStats(p PathConfig) (stats []filesystemStats, err error) {
|
||||||
var mntbuf *C.struct_statfs
|
var mntbuf *C.struct_statfs
|
||||||
count := C.getmntinfo(&mntbuf, C.MNT_NOWAIT)
|
count := C.getmntinfo(&mntbuf, C.MNT_NOWAIT)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
|
@ -70,7 +70,7 @@ func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
|
||||||
stats = append(stats, filesystemStats{
|
stats = append(stats, filesystemStats{
|
||||||
labels: filesystemLabels{
|
labels: filesystemLabels{
|
||||||
device: device,
|
device: device,
|
||||||
mountPoint: rootfsStripPrefix(mountpoint),
|
mountPoint: p.rootfsStripPrefix(mountpoint),
|
||||||
fsType: fstype,
|
fsType: fstype,
|
||||||
},
|
},
|
||||||
size: float64(mnt[i].f_blocks) * float64(mnt[i].f_bsize),
|
size: float64(mnt[i].f_blocks) * float64(mnt[i].f_bsize),
|
||||||
|
|
|
@ -165,7 +165,7 @@ func NewFilesystemCollector(config *NodeCollectorConfig, logger log.Logger) (Col
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
stats, err := c.GetStats()
|
stats, err := c.GetStats(c.config.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ func NewLoadavgCollector(config *NodeCollectorConfig, logger log.Logger) (Collec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *loadavgCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *loadavgCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
loads, err := getLoad(c.config)
|
loads, err := getLoad()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("couldn't get load: %w", err)
|
return fmt.Errorf("couldn't get load: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ func (c *netDevCollector) metricDesc(key string) *prometheus.Desc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
netDev, err := getNetDevStats(c.config, c.config.NetDev.Netlink, &c.deviceFilter, c.logger)
|
netDev, err := getNetDevStats(&c.deviceFilter, c.logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("couldn't get netstats: %w", err)
|
return fmt.Errorf("couldn't get netstats: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue