improve ping
This commit is contained in:
parent
79059d79d3
commit
1f08fcd20d
1 changed files with 3 additions and 5 deletions
|
@ -18,15 +18,13 @@ func Ping(msg json.RawMessage) (Check, error) {
|
|||
cmd := exec.Command("ping", "-c 4", config.Address)
|
||||
|
||||
err := cmd.Run()
|
||||
if _, ok := err.(*exec.ExitError); ok {
|
||||
return StatusDown
|
||||
}
|
||||
if err != nil {
|
||||
return StatusUnknown
|
||||
}
|
||||
|
||||
code := cmd.ProcessState.ExitCode()
|
||||
if code != 0 {
|
||||
return StatusDown
|
||||
}
|
||||
|
||||
return StatusUp
|
||||
}
|
||||
return check, nil
|
||||
|
|
Loading…
Reference in a new issue