fix the uint conversion to strings

This commit is contained in:
Kai Storbeck 2016-04-16 14:38:55 +02:00
parent dd76a68f3c
commit 1122ce49c7

View file

@ -53,16 +53,16 @@ func getNetDevStats(ignore *regexp.Regexp) (map[string]map[string]string, error)
devStats := map[string]string{} devStats := map[string]string{}
data := (*C.struct_if_data)(ifa.ifa_data) data := (*C.struct_if_data)(ifa.ifa_data)
devStats["receive_packets"] = strconv.Itoa(int(data.ifi_ipackets)) devStats["receive_packets"] = strconv.FormatUint(uint64(data.ifi_ipackets), 10)
devStats["transmit_packets"] = strconv.Itoa(int(data.ifi_opackets)) devStats["transmit_packets"] = strconv.FormatUint(uint64(data.ifi_opackets), 10)
devStats["receive_errs"] = strconv.Itoa(int(data.ifi_ierrors)) devStats["receive_errs"] = strconv.FormatUint(uint64(data.ifi_ierrors), 10)
devStats["transmit_errs"] = strconv.Itoa(int(data.ifi_oerrors)) devStats["transmit_errs"] = strconv.FormatUint(uint64(data.ifi_oerrors), 10)
devStats["receive_bytes"] = strconv.Itoa(int(data.ifi_ibytes)) devStats["receive_bytes"] = strconv.FormatUint(uint64(data.ifi_ibytes), 10)
devStats["transmit_bytes"] = strconv.Itoa(int(data.ifi_obytes)) devStats["transmit_bytes"] = strconv.FormatUint(uint64(data.ifi_obytes), 10)
devStats["receive_multicast"] = strconv.Itoa(int(data.ifi_imcasts)) devStats["receive_multicast"] = strconv.FormatUint(uint64(data.ifi_imcasts), 10)
devStats["transmit_multicast"] = strconv.Itoa(int(data.ifi_omcasts)) devStats["transmit_multicast"] = strconv.FormatUint(uint64(data.ifi_omcasts), 10)
devStats["receive_drop"] = strconv.Itoa(int(data.ifi_iqdrops)) devStats["receive_drop"] = strconv.FormatUint(uint64(data.ifi_iqdrops), 10)
devStats["transmit_drop"] = strconv.Itoa(int(data.ifi_oqdrops)) devStats["transmit_drop"] = strconv.FormatUint(uint64(data.ifi_oqdrops), 10)
netDev[dev] = devStats netDev[dev] = devStats
} }
} }