Skip to content

Commit

Permalink
17044 FIX gcp_status: Fix KeyError: me-central1
Browse files Browse the repository at this point in the history
This change affects users which have configured the rule 'Google Cloud Platform (GCP) Status'.
Previously, Checkmk did not handle incidents correctly, which had set `me-central1` as an associated location.
This was the corresponding traceback:
```
  File "/omd/sites/mon_home/lib/python3/cmk/plugins/gcp/agent_based/gcp_status.py", line 72, in parse
    data.setdefault(constants.RegionMap[location.id_], []).append(incident)
KeyError: 'me-central1'
```
With this werk, the crash is fixed.

*Updated the Region Mapping based on this link - https://github.com/GoogleCloudPlatform/gcping/blob/main/tools/terraform/regions.json
*Multiple regions have been added - 'africa-south1', 'europe-west10', 'europe-west12', 'me-central1', 'me-central2'

CMK-21087

Change-Id: Ie2a0ca7d249f6c1add07043550cc301bcba5c1da
  • Loading branch information
racicLuka committed Feb 2, 2025
1 parent f721595 commit 0d15bc3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .werks/17044.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[//]: # (werk v2)
# gcp_status: Fix KeyError: me-central1

key | value
---------- | ---
date | 2025-01-29T10:02:48+00:00
version | 2.4.0b1
class | fix
edition | cre
component | checks
level | 1
compatible | yes

This change affects users which have configured the rule 'Google Cloud Platform (GCP) Status'.
Previously, Checkmk did not handle incidents correctly, which had set `me-central1` as an associated location.
This was the corresponding traceback:
```
File "/omd/sites/mon_home/lib/python3/cmk/plugins/gcp/agent_based/gcp_status.py", line 72, in parse
data.setdefault(constants.RegionMap[location.id_], []).append(incident)
KeyError: 'me-central1'
```
With this werk, the crash is fixed.
5 changes: 5 additions & 0 deletions cmk/plugins/gcp/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# https://github.com/GoogleCloudPlatform/gcping/blob/main/tools/terraform/regions.json
# Changes to the right-hand side of this list cause an incompatible change to the service name
# of the check `gcp_status`
"africa-south1": "Johannesburg",
"asia-east1": "Taiwan",
"asia-east2": "Hong Kong",
"asia-northeast1": "Tokyo",
Expand All @@ -31,7 +32,11 @@
"europe-west6": "Zurich",
"europe-west8": "Milan",
"europe-west9": "Paris",
"europe-west10": "Berlin",
"europe-west12": "Turin",
"europe-southwest1": "Madrid",
"me-central1": "Doha",
"me-central2": "Dammam",
"me-west1": "Tel Aviv",
"northamerica-northeast1": "Montréal",
"northamerica-northeast2": "Toronto",
Expand Down

0 comments on commit 0d15bc3

Please sign in to comment.