Skip to content

Commit

Permalink
Now adding in service_name value when flow is seen from an unknown so…
Browse files Browse the repository at this point in the history
…urce
  • Loading branch information
i3149 committed Jan 16, 2025
1 parent 37d133a commit 123b7ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/cat/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ func NewServer(auth *AuthConfig, snmpFile string, log logger.ContextL, serviceNa
s.devicesByID[strconv.Itoa(int(nd.ID))] = nd
nextID += 100
}

// Now add a blank missing device device.
nd := &kt.Device{
ID: nextID,
Name: kt.MissingDeviceName,
SendingIps: []net.IP{net.ParseIP(kt.MissingDeviceIP)},
}
nd.InitUserTags(serviceName, map[string]string{})
s.devicesByID[strconv.Itoa(int(nd.ID))] = nd
}
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/inputs/flow/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ func (t *KentikDriver) toJCHF(fmsg *pp.ProtoProducerMessage) *kt.JCHF {
in.DeviceName = dm
}
}
if mdev, ok := t.devices[kt.MissingDeviceIP]; ok {
mdev.SetUserTags(in.CustomStr)
}
}

if _, ok := t.metrics[in.DeviceName]; !ok {
Expand Down
3 changes: 3 additions & 0 deletions pkg/kt/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ const (
GaugeMetric = "gauge"
CountMetric = "count"
FromGCP = "gcppubsub"

MissingDeviceName = "KT_MISSING_DEVICE"
MissingDeviceIP = "1.1.1.255"
)

type IntId uint64
Expand Down

0 comments on commit 123b7ec

Please sign in to comment.