mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-09 23:24:09 -08:00
Fix occurreneces of initial uppercase in error strings.
This commit is contained in:
parent
e70cbd2045
commit
a25751e0b3
|
@ -60,7 +60,7 @@ func (c *gmondCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|||
conn, err := net.Dial(gangliaProto, gangliaAddress)
|
||||
log.Debugf("gmondCollector Update")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't connect to gmond: %s", err)
|
||||
return fmt.Errorf("can't connect to gmond: %s", err)
|
||||
}
|
||||
conn.SetDeadline(time.Now().Add(gangliaTimeout))
|
||||
|
||||
|
@ -70,7 +70,7 @@ func (c *gmondCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|||
|
||||
err = decoder.Decode(&ganglia)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't parse xml: %s", err)
|
||||
return fmt.Errorf("couldn't parse xml: %s", err)
|
||||
}
|
||||
|
||||
for _, cluster := range ganglia.Clusters {
|
||||
|
|
|
@ -23,7 +23,7 @@ func splitToInts(str string, sep string) (ints []int, err error) {
|
|||
for _, part := range strings.Split(str, sep) {
|
||||
i, err := strconv.Atoi(part)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Could not split '%s' because %s is no int: %s", str, part, err)
|
||||
return nil, fmt.Errorf("could not split '%s' because %s is no int: %s", str, part, err)
|
||||
}
|
||||
ints = append(ints, i)
|
||||
}
|
||||
|
|
|
@ -53,13 +53,13 @@ func NewInterruptsCollector() (Collector, error) {
|
|||
func (c *interruptsCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
interrupts, err := getInterrupts()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't get interrupts: %s", err)
|
||||
return fmt.Errorf("couldn't get interrupts: %s", err)
|
||||
}
|
||||
for name, interrupt := range interrupts {
|
||||
for cpuNo, value := range interrupt.values {
|
||||
fv, err := strconv.ParseFloat(value, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Invalid value %s in interrupts: %s", value, err)
|
||||
return fmt.Errorf("invalid value %s in interrupts: %s", value, err)
|
||||
}
|
||||
labels := prometheus.Labels{
|
||||
"CPU": strconv.Itoa(cpuNo),
|
||||
|
|
|
@ -53,7 +53,7 @@ func NewLastLoginCollector() (Collector, error) {
|
|||
func (c *lastLoginCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
last, err := getLastLoginTime()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't get last seen: %s", err)
|
||||
return fmt.Errorf("couldn't get last seen: %s", err)
|
||||
}
|
||||
log.Debugf("Set node_last_login_time: %f", last)
|
||||
c.metric.Set(last)
|
||||
|
@ -92,12 +92,12 @@ func getLastLoginTime() (float64, error) {
|
|||
|
||||
dateParts, err := splitToInts(lastDate, "-") // 2013-04-16
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("Couldn't parse date in line '%s': %s", fields, err)
|
||||
return 0, fmt.Errorf("couldn't parse date in line '%s': %s", fields, err)
|
||||
}
|
||||
|
||||
timeParts, err := splitToInts(lastTime, ":") // 11:33
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("Couldn't parse time in line '%s': %s", fields, err)
|
||||
return 0, fmt.Errorf("couldn't parse time in line '%s': %s", fields, err)
|
||||
}
|
||||
|
||||
last_t := time.Date(dateParts[0], time.Month(dateParts[1]), dateParts[2], timeParts[0], timeParts[1], 0, 0, time.UTC)
|
||||
|
|
|
@ -50,7 +50,7 @@ func NewLoadavgCollector() (Collector, error) {
|
|||
func (c *loadavgCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
load, err := getLoad1()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't get load: %s", err)
|
||||
return fmt.Errorf("couldn't get load: %s", err)
|
||||
}
|
||||
log.Debugf("Set node_load: %f", load)
|
||||
c.metric.Set(load)
|
||||
|
|
|
@ -48,7 +48,7 @@ func NewLoadavgCollector() (Collector, error) {
|
|||
func (c *loadavgCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
load, err := getLoad1()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't get load: %s", err)
|
||||
return fmt.Errorf("couldn't get load: %s", err)
|
||||
}
|
||||
log.Debugf("Set node_load: %f", load)
|
||||
c.metric.Set(load)
|
||||
|
@ -68,7 +68,7 @@ func parseLoad(data string) (float64, error) {
|
|||
parts := strings.Fields(data)
|
||||
load, err := strconv.ParseFloat(parts[0], 64)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("Could not parse load '%s': %s", parts[0], err)
|
||||
return 0, fmt.Errorf("could not parse load '%s': %s", parts[0], err)
|
||||
}
|
||||
return load, nil
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ func NewMeminfoCollector() (Collector, error) {
|
|||
func (c *meminfoCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
memInfo, err := getMemInfo()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't get meminfo: %s", err)
|
||||
return fmt.Errorf("couldn't get meminfo: %s", err)
|
||||
}
|
||||
log.Debugf("Set node_mem: %#v", memInfo)
|
||||
for k, v := range memInfo {
|
||||
|
@ -91,14 +91,14 @@ func parseMemInfo(r io.Reader) (map[string]float64, error) {
|
|||
parts := strings.Fields(string(line))
|
||||
fv, err := strconv.ParseFloat(parts[1], 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid value in meminfo: %s", err)
|
||||
return nil, fmt.Errorf("invalid value in meminfo: %s", err)
|
||||
}
|
||||
switch len(parts) {
|
||||
case 2: // no unit
|
||||
case 3: // has unit, we presume kB
|
||||
fv *= 1024
|
||||
default:
|
||||
return nil, fmt.Errorf("Invalid line in meminfo: %s", line)
|
||||
return nil, fmt.Errorf("invalid line in meminfo: %s", line)
|
||||
}
|
||||
key := parts[0][:len(parts[0])-1] // remove trailing : from key
|
||||
// Active(anon) -> Active_anon
|
||||
|
|
|
@ -41,7 +41,7 @@ func init() {
|
|||
// the offset between ntp and the current system time.
|
||||
func NewNtpCollector() (Collector, error) {
|
||||
if *ntpServer == "" {
|
||||
return nil, fmt.Errorf("No NTP server specifies, see --ntpServer")
|
||||
return nil, fmt.Errorf("no NTP server specifies, see --ntpServer")
|
||||
}
|
||||
|
||||
return &ntpCollector{
|
||||
|
@ -56,7 +56,7 @@ func NewNtpCollector() (Collector, error) {
|
|||
func (c *ntpCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
t, err := ntp.Time(*ntpServer)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't get ntp drift: %s", err)
|
||||
return fmt.Errorf("couldn't get ntp drift: %s", err)
|
||||
}
|
||||
drift := t.Sub(time.Now())
|
||||
log.Debugf("Set ntp_drift_seconds: %f", drift.Seconds())
|
||||
|
|
Loading…
Reference in a new issue