Skip to content

Commit 071e5b5

Browse files
Merge pull request #22 from denisabrantesredis/main
added support for Valkey and Redis Cluster instances
2 parents 8e74ce3 + cf0f8ab commit 071e5b5

4 files changed

Lines changed: 485 additions & 9 deletions

File tree

README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,33 @@ Copy your service account .json files in the root directory of the project:
4343
cp path/to/service_account.json .
4444
```
4545

46-
Execute
46+
### Run the msstats.py script
47+
48+
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.
4749

4850
```
49-
# To use the copied service-account:
5051
python msstats.py
51-
52-
# or, to use the `gcloud` user (then, you _need_ to give a precise project):
53-
python3 msstats.py --user-account --project-id my-gcp-project
5452
```
5553

5654
This generates a file named <your project>.xlsx. You need to get that file and send it to Redis.
55+
56+
57+
### Run the memorystore.py script
58+
59+
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.
60+
61+
```
62+
# To use the copied service-account:
63+
python memorystore.py --project YOUR_PROJECT_ID --credentials /path/to/sa.json --out /path/to/out.csv
64+
65+
```
66+
67+
This generates a csv file. You need to get that file and send it to Redis.
5768
By default, it uses steps of 60 seconds and a period of 7 days (604800 seconds).
5869
You can set different values as follows:
5970

6071
````
61-
python msstats.py --duration 1800 --step 300
72+
python memorystore.py --project YOUR_PROJECT_ID --credentials /path/to/sa.json --out /path/to/out.csv --duration 1800 --step 300
6273
````
6374

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

90-
Execute
101+
Edit the `batch_run_msstats.sh` file to set the right path to the credentials file.
102+
103+
To collect metrics and information for Redis standalone instances, execute:
104+
105+
```
106+
./batch_run_msstats.sh
107+
```
108+
109+
To collect metrics and information for Redis, Valkey and Redis Cluster instances, execute:
91110

92111
```
93112
./batch_run_msstats.sh
94113
```
95114

96-
Remove monitoring.viewer role from the service account in all associated Google Cloud projects
115+
116+
117+
Remove monitoring.viewer role from the service account in all associated Google Cloud projects.
97118

98119
```
99120
./remove_sa_monitoring_viewer.sh <service_account>

batch_run_memorystore.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
projects=$(gcloud projects list | awk 'NR>1 {print $1}')
4+
5+
echo "$projects" | while read -r project_id; do
6+
python memorystore.py --project $project_id --credentials /path/to/sa.json --out /path/to/$project_id.csv
7+
done

batch_run_msstats.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ projects=$(gcloud projects list | awk 'NR>1 {print $1}')
44

55
echo "$projects" | while read -r project_id; do
66
python msstats.py -p $project_id
7-
done
7+
done

0 commit comments

Comments
 (0)