fix issues

This commit is contained in:
matt durham 2023-09-27 12:24:00 -04:00
parent e7bf2f8579
commit 2e027c850e
No known key found for this signature in database
GPG key ID: A62E920AE398897B
5 changed files with 7 additions and 7 deletions

View file

@ -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

View file

@ -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),

View file

@ -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
} }

View file

@ -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)
} }

View file

@ -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)
} }