Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,33 @@ Copy your service account .json files in the root directory of the project:
cp path/to/service_account.json .
```

Execute
### Run the msstats.py script

This script only retrieves information and metrics for Redis standalone instances. It does not capture information about Valkey or Redis Cluster instances. If you have Valkey or Redis Cluster instances, run the `memorystore.py` script instead.

```
# To use the copied service-account:
python msstats.py

# or, to use the `gcloud` user (then, you _need_ to give a precise project):
python3 msstats.py --user-account --project-id my-gcp-project
```

This generates a file named <your project>.xlsx. You need to get that file and send it to Redis.


### Run the memorystore.py script

This script retrieves information and metrics for Redis, Valkey and Redis Cluster instances. It leverages logic from the `msstats.py` script to consolidate and package the metrics.

```
# To use the copied service-account:
python memorystore.py --project YOUR_PROJECT_ID --credentials /path/to/sa.json --out /path/to/out.csv

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make a separate section with a short explanation of the new memorystore script?


```

This generates a csv file. You need to get that file and send it to Redis.
By default, it uses steps of 60 seconds and a period of 7 days (604800 seconds).
You can set different values as follows:

````
python msstats.py --duration 1800 --step 300
python memorystore.py --project YOUR_PROJECT_ID --credentials /path/to/sa.json --out /path/to/out.csv --duration 1800 --step 300
````

This can help solving issue like:
Expand Down Expand Up @@ -87,13 +98,23 @@ For example,
./grant_sa_monitoring_viewer.sh gmflau-sa@gcp-dev-day-nyc.iam.gserviceaccount.com
```

Execute
Edit the `batch_run_msstats.sh` file to set the right path to the credentials file.

To collect metrics and information for Redis standalone instances, execute:

```
./batch_run_msstats.sh
```

To collect metrics and information for Redis, Valkey and Redis Cluster instances, execute:

```
./batch_run_msstats.sh
```

Remove monitoring.viewer role from the service account in all associated Google Cloud projects


Remove monitoring.viewer role from the service account in all associated Google Cloud projects.

```
./remove_sa_monitoring_viewer.sh <service_account>
Expand Down
7 changes: 7 additions & 0 deletions batch_run_memorystore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

projects=$(gcloud projects list | awk 'NR>1 {print $1}')

echo "$projects" | while read -r project_id; do
python memorystore.py --project $project_id --credentials /path/to/sa.json --out /path/to/$project_id.csv
done
2 changes: 1 addition & 1 deletion batch_run_msstats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ projects=$(gcloud projects list | awk 'NR>1 {print $1}')

echo "$projects" | while read -r project_id; do
python msstats.py -p $project_id
done
done
Loading