mirror of
https://github.com/prometheus/node_exporter
synced 2024-12-25 15:42:10 +00:00
Fix some error messages.
This commit is contained in:
parent
93708f3dda
commit
dddb273dfc
@ -53,7 +53,7 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
var errbuf *C.char
|
||||
kd := C.kvm_open(nil, nil, nil, C.O_RDONLY, errbuf)
|
||||
if errbuf != nil {
|
||||
return errors.New("failed to call kvm_open().")
|
||||
return errors.New("failed to call kvm_open()")
|
||||
}
|
||||
defer C.kvm_close(kd)
|
||||
|
||||
|
@ -191,10 +191,10 @@ func NewDevstatCollector() (Collector, error) {
|
||||
func (c *devstatCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
count := C._get_ndevs()
|
||||
if count == -1 {
|
||||
return errors.New("devstat_getdevs() failed!")
|
||||
return errors.New("devstat_getdevs() failed")
|
||||
}
|
||||
if count == -2 {
|
||||
return errors.New("calloc() failed!")
|
||||
return errors.New("calloc() failed")
|
||||
}
|
||||
|
||||
for i := C.int(0); i < count; i++ {
|
||||
|
@ -98,7 +98,7 @@ func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
var mntbuf *C.struct_statfs
|
||||
count := C.getmntinfo(&mntbuf, C.MNT_NOWAIT)
|
||||
if count == 0 {
|
||||
return errors.New("getmntinfo() failed!")
|
||||
return errors.New("getmntinfo() failed")
|
||||
}
|
||||
|
||||
mnt := (*[1 << 30]C.struct_statfs)(unsafe.Pointer(mntbuf))
|
||||
|
@ -51,7 +51,7 @@ func getLoad1() (float64, error) {
|
||||
if samples > 0 {
|
||||
return float64(loadavg[0]), nil
|
||||
} else {
|
||||
return 0, errors.New("Failed to get load average!")
|
||||
return 0, errors.New("failed to get load average")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,10 +54,10 @@ func (c *meminfoCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
|
||||
size := C._sysctl(C.CString("vm.stats.vm.v_page_size"))
|
||||
if size == -1 {
|
||||
return errors.New("sysctl(vm.stats.vm.v_page_size) failed!")
|
||||
return errors.New("sysctl(vm.stats.vm.v_page_size) failed")
|
||||
}
|
||||
if size == -2 {
|
||||
return errors.New("sysctl(vm.stats.vm.v_page_size) failed, wrong buffer size!")
|
||||
return errors.New("sysctl(vm.stats.vm.v_page_size) failed, wrong buffer size")
|
||||
}
|
||||
|
||||
pages["active"] = C._sysctl(C.CString("vm.stats.vm.v_active_count"))
|
||||
@ -74,7 +74,7 @@ func (c *meminfoCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
return errors.New("sysctl() failed for " + key)
|
||||
}
|
||||
if pages[key] == -2 {
|
||||
return errors.New("sysctl() failed for " + key + ", wrong buffer size!")
|
||||
return errors.New("sysctl() failed for " + key + ", wrong buffer size")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ func getNetDevStats() (map[string]map[string]map[string]string, error) {
|
||||
|
||||
var ifap, ifa *C.struct_ifaddrs
|
||||
if C.getifaddrs(&ifap) == -1 {
|
||||
return nil, errors.New("getifaddrs() failed!")
|
||||
return nil, errors.New("getifaddrs() failed")
|
||||
}
|
||||
defer C.freeifaddrs(ifap)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user