Skip to content

Commit

Permalink
Use inode as name if name is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan committed Jul 17, 2024
1 parent 4583495 commit 6c6b618
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions plugins/inputs/procstat/os_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,17 @@ func statsUnix(conns []net.ConnectionStat) ([]map[string]interface{}, error) {
continue
}

name := c.Laddr.IP
if name == "" {
name = fmt.Sprintf("inode-%d", r.DiagMsg.INode)
}

fields := map[string]interface{}{
"protocol": "unix",
"type": "stream",
"state": socketStateName(r.DiagMsg.State),
"pid": c.Pid,
"name": c.Laddr.IP,
"name": name,
"rx_queue": r.Queue.RQueue,
"tx_queue": r.Queue.WQueue,
"inode": r.DiagMsg.INode,
Expand All @@ -360,12 +365,17 @@ func statsUnix(conns []net.ConnectionStat) ([]map[string]interface{}, error) {
continue
}

name := c.Laddr.IP
if name == "" {
name = fmt.Sprintf("inode-%d", inode)
}

fields := map[string]interface{}{
"protocol": "unix",
"type": socketTypeName(uint8(c.Type)),
"state": "close",
"pid": c.Pid,
"name": c.Laddr.IP,
"name": name,
"rx_queue": uint32(0),
"tx_queue": uint32(0),
"inode": inode,
Expand Down

0 comments on commit 6c6b618

Please sign in to comment.