Home

Awesome

<p align="center"> <img src="images/README/logo.png" style="width:300px;" /> </p>

grofer

Go Checks License Check Go Report Card Go Reference Publish Development Docker Image Publish Stable Docker Image Mentioned in Awesome Go

Latest Stable Version: GitHub tag (latest SemVer)

A clean and modern system and resource monitor written purely in golang using termui and gopsutil!

Currently compatible with Linux only.

Installation

Using go get:

go get -u github.com/pesos/grofer

As an executable:

curl -sSL https://github.com/pesos/grofer/releases/download/<version tag>/grofer_<architecture> --output grofer
chmod +x grofer

architecture: 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/bin

Building from source:

git clone https://github.com/pesos/grofer
cd grofer
go build grofer.go

Docker

  1. Get docker image using

      docker pull ghcr.io/pesos/grofer
    

    Note: 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

  2. 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/grofer
    

    Additional 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
    
  3. (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 proc
    

    Container metrics also work inside docker:

         grofer container
    

Building Docker image

docker build -t ghcr.io/pesos/grofer .

Usage

grofer is a system and resource monitor written in golang.

While using a TUI based command, press ? to get information about key bindings (if any) for that command.

Usage:
  grofer [flags]
  grofer [command]

Available Commands:
  about       about is a command that gives information about the project in a cute way
  completion  Generate completion script
  container   container command is used to get information related to docker containers
  export      Used to export profiled data.
  help        Help about any command
  proc        proc command is used to get per-process information

Flags:
      --config string   config file (default is $HOME/.grofer.yaml)
  -c, --cpuinfo         Info about the CPU Load over all CPUs
  -h, --help            help for grofer
  -r, --refresh uint    Overall stats UI refreshes rate in milliseconds greater than 1000 (default 1000)

Use "grofer [command] --help" for more information about a command.

Display Overall Metrics

grofer [FLAGS]

The command displays the default root page which provides overall CPU, Memory, Network and Disk Metrics.

Optional flags:

Display Process Metrics

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:

Display Container Metrics

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:

Export Metrics

grofer export [FLAGS]

This command exports collected information to a specifc file format.

Optional flags:

Examples

grofer

grofer

Information provided:


grofer --cpuinfo

The -c, --cpuinfo flag displays finer details about the CPU load such as percentage of the time spent servicing software interrupts, hardware interrupts, etc.

grofer-cpu

Information provided:


grofer proc

This lists all running processes and relevant information.

grofer-proc


grofer proc -p PID

This 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).

grofer-proc-pid

Information provided:


grofer container

This provides overall container metrics.

grofer-container


grofer container -c CID

This provides per container metrics.

grofer-container-cid

Information provided:


grofer export -i 1 -p 1

This allows exporting of profiled data either of system usage or data particular to that of a process. Data format is JSON by default.

grofer-export


Shell Completions

grofer includes a subcommand to generate shell completion scripts to get autocompletion for subcommands and flags

Bash

To get completions for current session only,

source <(grofer completion bash)

To load completions for each session, the generated script must be moved to the completions directory. Take a look at the third question here to find out the right place to put the script

Zsh

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:

echo "autoload -U compinit; compinit" >> ~/.zshrc

To 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.

Fish

To get completions for current session only,

grofer completion fish | source

To load completions for each session, the generated script must be moved to the completions directory

grofer completion fish > ~/.config/fish/completions/grofer.fish

Credits