A JFrog CLI plugin or standalone binary to show open-metrics formatted data in a terminal based graph.
This JFrog CLI plugin is for viewing JFrog products metrics in real time in a terminal.
To build the metrics-viewer binary
go buildTo build the metrics-viewer binary for multiple operating systems and architectures (Mac, Linux and Windows)
./build-binary.sh# Just run the tests
go test ./...
# Run the tests and create a coverage report
mkdir -p out && go test -coverprofile=out/coverage.out ./... && go tool cover -html=out/coverage.outTo build the metrics-viewer into a Docker image and use it
# Build the Docker image
docker build -t metrics-viewer:0.3.0 .
# Test the Docker image
docker run --rm metrics-viewer:0.3.0 --versionIf you don't want to install the plugin from the JFrog CLI Plugins Registry, it needs to be built and installed manually.
Follow these steps to install and use this plugin with JFrog CLI.
- Make sure JFrog CLI is installed on you machine by running
jf. If it is not installed, install it. - Create a directory named
pluginsunder~/.jfrog/if it does not exist already. - Clone this repository.
- CD into the root directory of the cloned project.
- Run
go buildto create the binary in the current directory. - Copy the binary into the
~/.jfrog/pluginsdirectory.
Installing the latest version:
jf plugin install metrics-viewerInstalling a specific version:
jf plugin install metrics-viewer@versionUninstalling a plugin
jf plugin uninstall metrics-viewerYou can view Artifactory Metrics in various ways.
To try it out, you can run Artifactory as Docker container.
-
Start Artifactory as a Docker container and enable its metrics
-
Once Artifactory is up, you can see the metrics log file or REST API endpoint
# See the metrics log files. For example, Artifactory and Metadata logs
cat artifactory/log/artifactory-metrics.log
cat artifactory/log/metadata-metrics.log
# Get the metrics from Artifactory REST API
curl -s -uadmin:password http://localhost:8082/artifactory/api/v1/metricsThe metrics-viewer can be run as a JFrog CLI Plugin or directly as a binary
- Usage
jf metrics-viewer <command> [options]- Commands: See available commands by just running the binary
jf metrics-viewer
jf metrics-viewer help- Options: To see available options for each command, call it with the help
jf metrics-viewer help graph
jf metrics-viewer help print - Usage
./metrics-viewer <command> [options]- Commands: See available commands by just running the binary
./metrics-viewer
./metrics-viewer help- Options: To see available options for each command, call it with the help
./metrics-viewer help graph
./metrics-viewer help print - Using the metrics-viewer binary
# Use with the default Artifactory that is configured by the JFrog CLI
jf metrics-viewer graph
# Use with direct Artifactory metrics API URL
jf metrics-viewer graph --url http://localhost:8082/artifactory/api/v1/metrics --user admin --password password
# Use with direct Metadata metrics API URL (NOTE: must get an access token from Artifactory)
jf metrics-viewer graph --url http://localhost:8082/metadata/api/v1/metrics --token ${TOKEN}
# Print metrics of the default Artifactory that is configured by the JFrog CLI
jf metrics-viewer print
# Print metrics of the "art17" Artifactory with name matching the "app_" filter
jf metrics-viewer print --server-id art17 --filter 'app_.*'
# Print selected Artifactory metrics as CSV
jf metrics-viewer print --url http://localhost:8082/artifactory/api/v1/metrics --user admin --password password \
--format csv --metrics jfrt_runtime_heap_totalmemory_bytes,jfrt_db_connections_active_total- Using the metrics-viewer binary
# Use with the default Artifactory that is configured by the JFrog CLI
./metrics-viewer graph
# Use with direct Artifactory metrics API URL
./metrics-viewer graph --url http://localhost:8082/artifactory/api/v1/metrics --user admin --password password
# Use with direct Metadata metrics API URL (NOTE: must get an access token from Artifactory)
./metrics-viewer graph --url http://localhost:8082/metadata/api/v1/metrics --token ${TOKEN}
# Print metrics of the default Artifactory that is configured by the JFrog CLI
./metrics-viewer print
# Print metrics of the "art17" Artifactory with name matching the "app_" filter
./metrics-viewer print --server-id art17 --filter 'app_.*'
# Print selected Artifactory metrics as CSV
./metrics-viewer print --url http://localhost:8082/artifactory/api/v1/metrics --user admin --password password \
--format csv --metrics jfrt_runtime_heap_totalmemory_bytes,jfrt_db_connections_active_total- Using the Docker image
# Use with direct Artifactory metrics API URL
# NOTE: The server URL has to be accessible from within the Docker container
docker run --rm --name metrics-viewer metrics-viewer:0.3.0 \
graph --url http://artifactory-server/artifactory/api/v1/metrics --user admin --password password
# Print specific metrics as CSV
# NOTE: The Docker container needs to access the file system for the logs, so need to mount it into the container
docker run --rm --name metrics-viewer -v $(pwd)/artifactory:/artifactory metrics-viewer:0.3.0 \
print --file /artifactory/log/artifactory-metrics.log \
--format csv --metrics jfrt_runtime_heap_freememory_bytes,jfrt_runtime_heap_totalmemory_bytesOnce running, the viewer will show 3 main sections
- Left pane: Box with selected metrics and another box with list of available metrics (matching search pattern if set)
- Center pane: Graph of selected metrics
- Right pane: Selected metrics metadata and Max, Min and Current values
- Up/Down arrow keys: Move between available metrics
- Space/Enter: Select/Deselect metric to view
- "/": Search pattern in available metrics (supprts regex)
- Enter to apply pattern and jump back to metrics list
- ESC to clear search text
- Ctrl+C: Exit metrics-viewer
The release notes are available here.
A big THANK YOU to the real developers here for joining me for this idea!

