Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
103
plugins/inputs/procstat/os_others.go
Normal file
103
plugins/inputs/procstat/os_others.go
Normal file
|
@ -0,0 +1,103 @@
|
|||
//go:build !linux && !windows
|
||||
|
||||
package procstat
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"syscall"
|
||||
|
||||
gopsnet "github.com/shirou/gopsutil/v4/net"
|
||||
gopsprocess "github.com/shirou/gopsutil/v4/process"
|
||||
)
|
||||
|
||||
func processName(p *gopsprocess.Process) (string, error) {
|
||||
return p.Exe()
|
||||
}
|
||||
|
||||
func queryPidWithWinServiceName(string) (uint32, error) {
|
||||
return 0, errors.New("os not supporting win_service option")
|
||||
}
|
||||
|
||||
func collectMemmap(process, string, map[string]any) {}
|
||||
|
||||
func findBySystemdUnits([]string) ([]processGroup, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func findByWindowsServices([]string) ([]processGroup, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func collectTotalReadWrite(process) (r, w uint64, err error) {
|
||||
return 0, 0, errors.ErrUnsupported
|
||||
}
|
||||
|
||||
func statsTCP(conns []gopsnet.ConnectionStat, _ uint8) ([]map[string]interface{}, error) {
|
||||
if len(conns) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Filter the responses via the inodes belonging to the process
|
||||
fieldslist := make([]map[string]interface{}, 0, len(conns))
|
||||
for _, c := range conns {
|
||||
var proto string
|
||||
switch c.Family {
|
||||
case syscall.AF_INET:
|
||||
proto = "tcp4"
|
||||
case syscall.AF_INET6:
|
||||
proto = "tcp6"
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
fields := map[string]interface{}{
|
||||
"protocol": proto,
|
||||
"state": c.Status,
|
||||
"pid": c.Pid,
|
||||
"src": c.Laddr.IP,
|
||||
"src_port": c.Laddr.Port,
|
||||
"dest": c.Raddr.IP,
|
||||
"dest_port": c.Raddr.Port,
|
||||
}
|
||||
fieldslist = append(fieldslist, fields)
|
||||
}
|
||||
|
||||
return fieldslist, nil
|
||||
}
|
||||
|
||||
func statsUDP(conns []gopsnet.ConnectionStat, _ uint8) ([]map[string]interface{}, error) {
|
||||
if len(conns) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Filter the responses via the inodes belonging to the process
|
||||
fieldslist := make([]map[string]interface{}, 0, len(conns))
|
||||
for _, c := range conns {
|
||||
var proto string
|
||||
switch c.Family {
|
||||
case syscall.AF_INET:
|
||||
proto = "udp4"
|
||||
case syscall.AF_INET6:
|
||||
proto = "udp6"
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
fields := map[string]interface{}{
|
||||
"protocol": proto,
|
||||
"state": c.Status,
|
||||
"pid": c.Pid,
|
||||
"src": c.Laddr.IP,
|
||||
"src_port": c.Laddr.Port,
|
||||
"dest": c.Raddr.IP,
|
||||
"dest_port": c.Raddr.Port,
|
||||
}
|
||||
fieldslist = append(fieldslist, fields)
|
||||
}
|
||||
|
||||
return fieldslist, nil
|
||||
}
|
||||
|
||||
func statsUnix([]gopsnet.ConnectionStat) ([]map[string]interface{}, error) {
|
||||
return nil, errors.ErrUnsupported
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue