Skip to content

Instantly share code, notes, and snippets.

@winter-code
Last active August 10, 2022 19:39
Show Gist options
  • Save winter-code/2b4d4aa8023fa7a8159cf0591e59ebbb to your computer and use it in GitHub Desktop.
Save winter-code/2b4d4aa8023fa7a8159cf0591e59ebbb to your computer and use it in GitHub Desktop.
Generating mFit report - JSON

Ssh into the machine we have the application to be analyzed.

gcloud compute ssh <machine_name> - tunnel-through-iap

Create a directory m4a and cd into it.

mkdir m4a && cd m4a

Download the latest version of the mfit assessment tool.

curl -O "https://mfit-release.storage.googleapis.com/$(curl -s https://mfit-release.storage.googleapis.com/latest)/mfit"

Make it executable.

chmod +x mfit

Download the latets version of the collector tool.

The collector tools works complimentary to the assessment tool. It collects the required data and creates a tar file to be assessed. If you have multiple machines to be assessed, you can install the collector on all of them, install the assessment tool in a host machine with ssh access to the other machines, and run the assessment from one single machine.

curl -O "https://mfit-release.storage.googleapis.com/$(curl -s https://mfit-release.storage.googleapis.com/latest)/mfit-linux-collect.sh"

Make the collector file exceutable.

chmod +x mfit-linux-collect.sh

Execute the collector.

sudo ./mfit-linux-collect.sh

Run the assessment on the tar file using mfit assess

./mfit assess sample <file-generated-after-data-collection>.tar - format json > app-mfit-report.json

Copy this report into your cloudshell and then download it into your local machine using this command –

gcloud compute scp - tunnel-through-iap \ <machine_name>:~/m4a/app-mfit-report.json ${HOME}/ cloudshell download app-mfit-report.json

You have downloaded the JSON (not so pretty) version of the report. The rest of the work is to be done in the GCP console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment