1
1
package cmd
2
2
3
3
import (
4
+ "errors"
4
5
"fmt"
5
6
"math"
6
7
"strconv"
@@ -61,12 +62,12 @@ Note: Time range values e.G. 'go_memstats_alloc_bytes_total[0s]' only the latest
61
62
\_[OK] go_gc_duration_seconds_count{instance="localhost:9090", job="prometheus"} - value: 1599
62
63
\_[CRITICAL] go_gc_duration_seconds_count{instance="node-exporter:9100", job="node-exporter"} - value: 79610
63
64
| value_go_gc_duration_seconds_count_localhost:9090_prometheus=1599 value_go_gc_duration_seconds_count_node-exporter:9100_node-exporter=79610` ,
64
- PreRun : func (cmd * cobra.Command , args []string ) {
65
+ PreRun : func (_ * cobra.Command , _ []string ) {
65
66
if cliQueryConfig .Warning == "" || cliQueryConfig .Critical == "" {
66
- check .ExitError (fmt . Errorf ("please specify warning and critical thresholds" ))
67
+ check .ExitError (errors . New ("please specify warning and critical thresholds" ))
67
68
}
68
69
},
69
- Run : func (cmd * cobra.Command , args []string ) {
70
+ Run : func (_ * cobra.Command , _ []string ) {
70
71
crit , err := check .ParseThreshold (cliQueryConfig .Critical )
71
72
if err != nil {
72
73
check .ExitError (err )
@@ -90,7 +91,7 @@ Note: Time range values e.G. 'go_memstats_alloc_bytes_total[0s]' only the latest
90
91
91
92
if err != nil {
92
93
if strings .Contains (err .Error (), "unmarshalerDecoder: unexpected value type \" string\" " ) {
93
- err = fmt . Errorf ("string value results are not supported" )
94
+ err = errors . New ("string value results are not supported" )
94
95
}
95
96
check .ExitError (err )
96
97
}
@@ -99,15 +100,15 @@ Note: Time range values e.G. 'go_memstats_alloc_bytes_total[0s]' only the latest
99
100
100
101
switch result .Type () {
101
102
default :
102
- check .ExitError (fmt . Errorf ("none value results are not supported" ))
103
+ check .ExitError (errors . New ("none value results are not supported" ))
103
104
// Scalar - a simple numeric floating point value
104
105
case model .ValScalar :
105
- check .ExitError (fmt . Errorf ("scalar value results are not supported" ))
106
+ check .ExitError (errors . New ("scalar value results are not supported" ))
106
107
case model .ValNone :
107
- check .ExitError (fmt . Errorf ("none value results are not supported" ))
108
+ check .ExitError (errors . New ("none value results are not supported" ))
108
109
case model .ValString :
109
110
// String - a simple string value; currently unused
110
- check .ExitError (fmt . Errorf ("string value results are not supported" ))
111
+ check .ExitError (errors . New ("string value results are not supported" ))
111
112
case model .ValVector :
112
113
// Instant vector - a set of time series containing a single sample for each time series, all sharing the same timestamp
113
114
vectorVal := result .(model.Vector )
0 commit comments