code refactor
This commit is contained in:
parent
e2640c083b
commit
78d2ff6ec1
|
@ -2,7 +2,6 @@ package nginx_upstream_check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
@ -113,7 +112,7 @@ func (ins *Instance) Init() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ins.Targets) == 0 {
|
if len(ins.Targets) == 0 {
|
||||||
return errors.New("nginx_upstream_check targets empty")
|
return types.ErrInstancesEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := ins.createHTTPClient()
|
client, err := ins.createHTTPClient()
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ntp
|
package ntp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"flashcat.cloud/categraf/config"
|
"flashcat.cloud/categraf/config"
|
||||||
"flashcat.cloud/categraf/inputs"
|
"flashcat.cloud/categraf/inputs"
|
||||||
|
"flashcat.cloud/categraf/types"
|
||||||
"github.com/toolkits/pkg/container/list"
|
"github.com/toolkits/pkg/container/list"
|
||||||
"github.com/toolkits/pkg/nux"
|
"github.com/toolkits/pkg/nux"
|
||||||
)
|
)
|
||||||
|
@ -33,7 +33,7 @@ func (n *NTPStat) Drop() {}
|
||||||
|
|
||||||
func (n *NTPStat) Init() error {
|
func (n *NTPStat) Init() error {
|
||||||
if len(n.NTPServers) == 0 {
|
if len(n.NTPServers) == 0 {
|
||||||
return errors.New("ntp servers empty")
|
return types.ErrInstancesEmpty
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue