Monalize

Monaliza is a tool for scanning and analyzing MongoDB database for any performance issues, which lead to high CPU consumption.

GPL-3.0 License

Stars
28
Committers
3

Monalize tool overview

Monaliza is a tool for scanning and analyzing MongoDB database for any performance issues, which lead to high CPU consumption.

The main task is a fast output of names of all databases and collections, indexes and slow queries stats.

Compilation

go build monalize.go

Usage

Compile the tool from src code or install via

MONALIZE=$( curl --silent "https://api.github.com/repos/MongoDB-Cowboys/Monalize/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' ) \
;wget https://github.com/MongoDB-Cowboys/Monalize/releases/download/$MONALIZE/monalize

Don't forget to make it executable:

chmod +x monalize

Then you can run on any Unix like system via ./monalize

Available flags:

  • --db_name (optional) If you need to scan only specific database. (default: nil)
  • --db_uri (optional) Uri to connect to mongodb service. (default: "mongodb://localhost:27017")
  • --excel (optional) To save an output of the script to excel file. (default: false)
  • --logpath (optional) Specify a path to MongoDB service log file. If you use this together with the variable container then this path to the file will be applied to the container. Without the container variable, it will be applied to the local log file. (default "")
  • --container (optional) Specify a name of Docker container. If you leave the logpath variable empty, logs will be read from the container. (default "")
  • --context_timeout (optional) Set context timeout. (default 10)
  • --podman (optional) For using the Podman executable file to check the log file in the container. (default: false)

A help is available via ./monalize --help.

Examples uri:

Full request example:

After successfull run of the monalize tool, all the output artifacts will be saved in working directory:

  • colout.txt COLLSCAN logs.
  • result.csv optional excel file.

Podman

For running Monalize when MongoDB is working in Podman, you should set the DOCKER_HOST variable with the path to the podman.socket file and add the additional flag --podman=true for using the Podman executable file to check the log file in the container. This flag is required only when you want to check a specific log file in the container.

Example:

export DOCKER_HOST=unix:///Users/username/.local/share/containers/podman/machine/podman.sock
monalize --db_uri "mongodb://127.0.0.1:27017"  --container mongo --db_name example --logpath "/tmp/log" --excel=true --podman=true

License

GPL-3.0 License

Package Rankings
Top 6.58% on Proxy.golang.org
Badges
Extracted from project README
Stand With Ukraine