Skip to content

Commit

Permalink
Merge pull request #620 from kongfei605/snmp_update
Browse files Browse the repository at this point in the history
snmp icmp update
  • Loading branch information
kongfei605 authored Aug 24, 2023
2 parents 1fd9a7d + bf41971 commit ff86b19
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions inputs/snmp/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func (ins *Instance) up(slist *types.SampleList, i int, topTags, extraTags map[s
host = u.Hostname()
}
extraTags[ins.AgentHostTag] = host

// icmp probe
up := Ping(host, 300)
slist.PushSample(inputName, "icmp_up", up, topTags, extraTags)

// snmp probe
oid := ".1.3.6.1.2.1.1.1.0"
gs, err := ins.getConnection(i)
if err != nil {
Expand Down Expand Up @@ -138,18 +144,6 @@ func (ins *Instance) Gather(slist *types.SampleList) {
log.Printf("agent %s ins: gathering table %s error: %s", agent, t.Name, err)
}
}
// 进行icmp探测

up := Ping(gs.Host(), 300)
fields := map[string]interface{}{
"icmp_up": up,
}
tags := map[string]string{
ins.AgentHostTag: gs.Host(),
}

slist.PushSamples(inputName, fields, tags)

}(i, agent)
}
wg.Wait()
Expand Down

0 comments on commit ff86b19

Please sign in to comment.