prometheus / procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Apache License 2.0
769 stars 319 forks source link

feat: add LoadSysConfig method for read sys config easier #502 #504

Closed Jack-Kingdom closed 1 year ago

Jack-Kingdom commented 1 year ago

@SuperQ yeah, you know there is a batch of sysctl config located under procfs. Under sysctl config file, They looks like this:

# enable fast open
net.ipv4.tcp_fastopen = 3
# turn on path MTU discovery
net.ipv4.tcp_mtu_probing = 1
# tcp window scaling
net.ipv4.tcp_window_scaling = 1

and under procfs, it's saparated files located at different path. for example:

/proc/sys/net/ipv4/tcp_fastopen

at first, I want to provide a struct and read those config into struct. but thosed config very scattered and commonly a file only contains a single config. so I created this helper method to load those config. Is there a better way ?

SuperQ commented 1 year ago

Oh, you want to access sysctls. I would recommend using a dedicated package like https://github.com/lorenzosaino/go-sysctl.

SuperQ commented 1 year ago

I don't think we need a sysctl library here.