Merge pull request #279 from Erope/master
Fix: fix icmp ping & fix agent action build Co-authored-by: Erope <44471469+Erope@users.noreply.github.com>
This commit is contained in:
commit
9e9cada57d
2
.github/workflows/agent.yml
vendored
2
.github/workflows/agent.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: goreleaser/goreleaser-cross
|
image: goreleaser/goreleaser-cross:v1.19.2
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
|
@ -337,7 +337,12 @@ func handleIcmpPingTask(task *pb.Task, result *pb.TaskResult) {
|
|||||||
err = pinger.Run() // Blocks until finished.
|
err = pinger.Run() // Blocks until finished.
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
result.Delay = float32(pinger.Statistics().AvgRtt.Microseconds()) / 1000.0
|
stat := pinger.Statistics()
|
||||||
|
if stat.PacketsRecv == 0 {
|
||||||
|
result.Data = "pockets recv 0"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result.Delay = float32(stat.AvgRtt.Microseconds()) / 1000.0
|
||||||
result.Successful = true
|
result.Successful = true
|
||||||
} else {
|
} else {
|
||||||
result.Data = err.Error()
|
result.Data = err.Error()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user