一个使用 Golang 编写的系统和资源监控工具!
A clean and modern system and resource monitor written purely in golang using termui and gopsutil!
Currently compatible with Linux only.
Using go get:
go get -u github.com/pesos/groferAs an executable:
curl -sSL https://github.com/pesos/grofer/releases/download//grofer_ --output grofer
chmod +x groferarchitecture: underlying system architecture on which grofer will be run
For system wide usage, install grofer to a location on $PATH, e.g. /usr/local/bin
mv grofer /usr/local/binBuilding from source:
git clone https://github.com/pesos/grofer
cd grofer
go build grofer.goGet docker image using
docker pull ghcr.io/pesos/groferNote: This will use the latest image which is built from the stable branch.
For previous releases, you will need to use the version number as the tag. Example: docker pull ghcr.io/pesos/grofer:v1.2.0
For the latest image from the main branch (development image). The tag main can be used. Example: docker pull ghcr.io/pesos/grofer:main
Run using
docker run \
--name grofer \
--rm -it \
-v /:/host:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
--privileged \
--pid=host \
--network=host \
ghcr.io/pesos/groferAdditional subcommands and flags to grofer can be passed directly at the end of the above command:
docker run \
--name grofer \
--rm -it \
-v /:/host:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
--privileged \
--pid=host \
--network=host \
ghcr.io/pesos/grofer proc docker run \
--name grofer \
--rm -it \
-v /:/host:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
--privileged \
--pid=host \
--network=host \
ghcr.io/pesos/grofer --help(Optional) create an alias for docker run to be able to run it using just grofer
alias grofer="docker run \
--name grofer \
--rm -it \
-v /:/host:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
--privileged \
--pid=host \
--network=host \
ghcr.io/pesos/grofer"Then use grofer as normal:
grofer --help grofer procContainer metrics also work inside docker:
grofer containerdocker build -t ghcr.io/pesos/grofer .…grofer [FLAGS]The command displays the default root page which provides overall CPU, Memory, Network and Disk Metrics.
Optional flags:
-c | --cpuinfo: Enabling this flag provides detailed information about CPU loads.
-h | --help: Provides help information about grofer.
-r | --refresh UINT: Sets the UI refresh rate in milliseconds. The number (UINT) provided must be greater than 1000
grofer proc [FLAGS]This command displays a table with information about all running processes. Additionally, it can be used to kill a running process too. Key-bindings for navigation and available process actions can be found by pressing ? in the UI.
Optional flags:
-h | --help: Provides help details for grofer proc.
-p | --pid INT32: Provides in depth metrics about process identified by given PID.
-r | --refresh UINT: Sets the UI refresh rate in milliseconds. Much like the root command, this value must be greater than 1000.
grofer container [FLAGS]This command displays information about all existing containers. Key-bindings for navigation and available container actions can be found by pressing ? in the UI.
Optional flags:
-h | --help: Provides help details for grofer container.
-c | --container-id STRING: Provides in depth metrics about the container identified by given ID.
-r | --refresh UINT: Sets the UI refresh rate in milliseconds. Much like the root command, this value must be greater than 1000.
grofer export [FLAGS]This command exports collected information to a specifc file format.
Optional flags:
-h | --help: Provides help details for grofer export.
-i | --iter UINT32: Set the number of iterations to fetch data.
-p | --pid INT32: Specify the PID of the process to profile. If not set, all processes are are measured.
-t | --type STRING: Specify the export file format. Defaults to LJSON.
-f | --filename STRING: Specify the file to store the exported data in. Defaults to grofer_profile.
-r | --refresh UINT: Specify frequency of data fetch in milliseconds. default value taken as 1000.
groferInformation provided:
grofer --cpuinfoThe -c, --cpuinfo flag displays finer details about the CPU load such as percentage of the time spent servicing software interrupts, hardware interrupts, etc.
Information provided:
grofer procThis lists all running processes and relevant information.
grofer proc -p PIDThis gives information specific to a process, specified by a valid PID.
Passing a PID of 0 will list all the processes instead (same as grofer proc).
Information provided:
CPU utilization %
Memory utilization %
Child processes
Number of voluntary and involuntary context switches
Memory usage (RSS, Data, Stack, Swap)
grofer containerThis provides overall container metrics.
grofer container -c CIDThis provides per container metrics.
Information provided:
CPU and Per CPU utilization %
Memory utilization %
Container processes
Volume Mounts
Attached Networks
Block and Network I/O
Metadata (Image, Name, ID, Status, State, PID)
grofer export -i 1 -p 1This allows exporting of profiled data either of system usage or data particular to that of a process. Data format is JSON by default.
grofer includes a subcommand to generate shell completion scripts to get autocompletion for subcommands and flags
To get completions for current session only,
source > ~/.zshrcTo load completions for each session, the generated script must be placed in a directory in your fpath. For a quick-and-dirty solution, run once:
grofer completion zsh > "${fpath[1]}/_grofer"You will need to start a new shell for this setup to take effect.
To get completions for current session only,
grofer completion fish | sourceTo load completions for each session, the generated script must be moved to the completions directory
grofer completion fish > ~/.config/fish/completions/grofer.fish暂无开放 Issues,或尚未同步最近议题。