diff --git a/collector/cpu_openbsd_amd64.go b/collector/cpu_openbsd_amd64.go index 293cc41e..83174986 100644 --- a/collector/cpu_openbsd_amd64.go +++ b/collector/cpu_openbsd_amd64.go @@ -33,13 +33,13 @@ type clockinfo struct { } const ( - CP_USER = 0 - CP_NICE = 1 - CP_SYS = 2 - CP_SPIN = 3 - CP_INTR = 4 - CP_IDLE = 5 - CPUSTATES = 6 + CP_USER = iota + CP_NICE + CP_SYS + CP_SPIN + CP_INTR + CP_IDLE + CPUSTATES ) type cpuCollector struct { diff --git a/collector/interrupts_openbsd_amd64.go b/collector/interrupts_openbsd_amd64.go index 2d1847e2..fa3155c6 100644 --- a/collector/interrupts_openbsd_amd64.go +++ b/collector/interrupts_openbsd_amd64.go @@ -67,9 +67,7 @@ func intr(idx _C_int) (itr interrupt, err error) { return } -var ( - interruptLabelNames = []string{"cpu", "type", "devices"} -) +var interruptLabelNames = []string{"cpu", "type", "devices"} func (c *interruptsCollector) Update(ch chan<- prometheus.Metric) error { interrupts, err := getInterrupts() @@ -97,7 +95,6 @@ type interrupt struct { func getInterrupts() (map[string]interrupt, error) { var interrupts = map[string]interrupt{} - n := nintr() for i := _C_int(0); i < n; i++ { @@ -105,7 +102,6 @@ func getInterrupts() (map[string]interrupt, error) { if err != nil { return nil, err } - interrupts[itr.device] = itr } diff --git a/collector/meminfo_openbsd_amd64.go b/collector/meminfo_openbsd_amd64.go index 418e3d75..814cdb2e 100644 --- a/collector/meminfo_openbsd_amd64.go +++ b/collector/meminfo_openbsd_amd64.go @@ -26,7 +26,6 @@ func (c *meminfoCollector) getMemInfo() (map[string]float64, error) { return nil, err } uvmexp := *(*unix.Uvmexp)(unsafe.Pointer(&uvmexpb[0])) - ps := float64(uvmexp.Pagesize) // see uvm(9) diff --git a/collector/netdev_openbsd_amd64.go b/collector/netdev_openbsd_amd64.go index 37227b49..48b89b81 100644 --- a/collector/netdev_openbsd_amd64.go +++ b/collector/netdev_openbsd_amd64.go @@ -63,17 +63,17 @@ func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp, logger log.Log continue } - devStats := map[string]string{} - devStats["receive_packets"] = strconv.Itoa(int(data.Ipackets)) - devStats["transmit_packets"] = strconv.Itoa(int(data.Opackets)) - devStats["receive_errs"] = strconv.Itoa(int(data.Ierrors)) - devStats["transmit_errs"] = strconv.Itoa(int(data.Oerrors)) - devStats["receive_bytes"] = strconv.Itoa(int(data.Ibytes)) - devStats["transmit_bytes"] = strconv.Itoa(int(data.Obytes)) - devStats["receive_multicast"] = strconv.Itoa(int(data.Imcasts)) - devStats["transmit_multicast"] = strconv.Itoa(int(data.Omcasts)) - devStats["receive_drop"] = strconv.Itoa(int(data.Iqdrops)) - netDev[dev] = devStats + netDev[dev] = map[string]string{ + "receive_packets": strconv.Itoa(int(data.Ipackets)), + "transmit_packets": strconv.Itoa(int(data.Opackets)), + "receive_errs": strconv.Itoa(int(data.Ierrors)), + "transmit_errs": strconv.Itoa(int(data.Oerrors)), + "receive_bytes": strconv.Itoa(int(data.Ibytes)), + "transmit_bytes": strconv.Itoa(int(data.Obytes)), + "receive_multicast": strconv.Itoa(int(data.Imcasts)), + "transmit_multicast": strconv.Itoa(int(data.Omcasts)), + "receive_drop": strconv.Itoa(int(data.Iqdrops)), + } } return netDev, nil }