From dddb273dfc75864f448fb61bf6d6e05d84c22b25 Mon Sep 17 00:00:00 2001 From: Siavash Safi Date: Tue, 14 Jul 2015 01:59:55 +0430 Subject: [PATCH] Fix some error messages. --- collector/cpu_freebsd.go | 2 +- collector/devstat_freebsd.go | 4 ++-- collector/filesystem_freebsd.go | 2 +- collector/loadavg.go | 2 +- collector/meminfo_freebsd.go | 8 ++++---- collector/netdev_freebsd.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/collector/cpu_freebsd.go b/collector/cpu_freebsd.go index d86bc9dc..632f0959 100644 --- a/collector/cpu_freebsd.go +++ b/collector/cpu_freebsd.go @@ -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) diff --git a/collector/devstat_freebsd.go b/collector/devstat_freebsd.go index 5a24f511..2b9300c0 100644 --- a/collector/devstat_freebsd.go +++ b/collector/devstat_freebsd.go @@ -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++ { diff --git a/collector/filesystem_freebsd.go b/collector/filesystem_freebsd.go index 73a15fd9..c1bd6280 100644 --- a/collector/filesystem_freebsd.go +++ b/collector/filesystem_freebsd.go @@ -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)) diff --git a/collector/loadavg.go b/collector/loadavg.go index 74ccbaf4..5ead9e90 100644 --- a/collector/loadavg.go +++ b/collector/loadavg.go @@ -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") } } diff --git a/collector/meminfo_freebsd.go b/collector/meminfo_freebsd.go index d0376d6c..fca410cc 100644 --- a/collector/meminfo_freebsd.go +++ b/collector/meminfo_freebsd.go @@ -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") } } @@ -88,7 +88,7 @@ func (c *meminfoCollector) Update(ch chan<- prometheus.Metric) (err error) { Help: k + " from sysctl()", }) } - // Convert metrics to kB ( same as Linux meminfo). + // Convert metrics to kB (same as Linux meminfo). c.metrics[k].Set(float64(v) * float64(size)) c.metrics[k].Collect(ch) } diff --git a/collector/netdev_freebsd.go b/collector/netdev_freebsd.go index 8892869a..68a96bd3 100644 --- a/collector/netdev_freebsd.go +++ b/collector/netdev_freebsd.go @@ -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)