Skip to content

Commit 013102b

Browse files
committed
Added the new alerts to the default matching conditions file so they will be enabled by default.
1 parent e75726c commit 013102b

File tree

2 files changed

+78
-4
lines changed

2 files changed

+78
-4
lines changed

Monitoring/monitor-ontap-services/cloudformation.yaml

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ Metadata:
4343
- volumeUtilizationCriticalAlert
4444
- volumeFileUtilizationWarnAlert
4545
- volumeFileUtilizationCriticalAlert
46+
- volumeOfflineAlert
4647
- softQuotaUtilizationAlert
4748
- hardQuotaUtilizationAlert
4849
- inodesQuotaUtilizationAlert
50+
- vserverStateAlert
51+
- vserverNFSProtocolStateAlert
52+
- vserverCIFSProtocolStateAlert
4953

5054
Parameters:
5155
OntapAdminSever:
@@ -220,6 +224,12 @@ Parameters:
220224
Type: Number
221225
Default: 95
222226

227+
volumeOfflineAlert:
228+
Description: "Alert when a volume goes offline."
229+
Type: String
230+
AllowedValues: ["true", "false"]
231+
Default: "true"
232+
223233
softQuotaUtilizationAlert:
224234
Description: "Alert when a soft quota exceeds this threshold in percentage."
225235
Type: Number
@@ -235,6 +245,24 @@ Parameters:
235245
Type: Number
236246
Default: 80
237247

248+
vserverStateAlert:
249+
Description: "Alert when a vserver goes offline."
250+
Type: String
251+
AllowedValues: ["true", "false"]
252+
Default: "true"
253+
254+
vserverNFSProtocolStateAlert:
255+
Description: "Alert when a vserver's NFS protocol goes offline."
256+
Type: String
257+
AllowedValues: ["true", "false"]
258+
Default: "true"
259+
260+
vserverCIFSProtocolStateAlert:
261+
Description: "Alert when a vserver's CIFS protocol goes offline."
262+
Type: String
263+
AllowedValues: ["true", "false"]
264+
Default: "true"
265+
238266
Conditions:
239267
CreateSecretsManagerEndpoint: !Equals [!Ref createSecretsManagerEndpoint, "true"]
240268
CreateSNSEndpoint: !Equals [!Ref createSNSEndpoint, "true"]
@@ -464,9 +492,13 @@ Resources:
464492
initialVolumeUtilizationCriticalAlert: !Ref volumeUtilizationCriticalAlert
465493
initialVolumeFileUtilizationWarnAlert: !Ref volumeFileUtilizationWarnAlert
466494
initialVolumeFileUtilizationCriticalAlert: !Ref volumeFileUtilizationCriticalAlert
495+
initialVolumeOfflineAlert: !Ref volumeOfflineAlert
467496
initialSoftQuotaUtilizationAlert: !Ref softQuotaUtilizationAlert
468497
initialHardQuotaUtilizationAlert: !Ref hardQuotaUtilizationAlert
469498
initialInodesQuotaUtilizationAlert: !Ref inodesQuotaUtilizationAlert
499+
initialVserverStateAlert: !Ref vserverStateAlert
500+
initialVserverNFSProtocolStateAlert: !Ref vserverNFSProtocolStateAlert
501+
initialVserverCIFSProtocolStateAlert: !Ref vserverCIFSProtocolStateAlert
470502
Code:
471503
ZipFile: |
472504
#!/bin/python3
@@ -489,8 +521,8 @@ Resources:
489521
# "matching conditions." It is intended to be run as a Lambda function, but
490522
# can be run as a standalone program.
491523
#
492-
# Version: v2.13
493-
# Date: 2025-04-28-16:26:21
524+
# Version: v2.14
525+
# Date: 2025-04-29-12:53:45
494526
################################################################################
495527
496528
import json
@@ -1733,7 +1765,8 @@ Resources:
17331765
{"name": "ems", "rules": []},
17341766
{"name": "snapmirror", "rules": []},
17351767
{"name": "storage", "rules": []},
1736-
{"name": "quota", "rules": []}
1768+
{"name": "quota", "rules": []},
1769+
{"name": "vserver", "rules": []}
17371770
]}
17381771
#
17391772
# Now, add rules based on the environment variables.
@@ -1797,6 +1830,11 @@ Resources:
17971830
value = int(value)
17981831
if value > 0:
17991832
conditions["services"][getServiceIndex("storage", conditions)]["rules"].append({"volumeCriticalFilesPercentUsed": value})
1833+
elif name == "initialVolumeOfflineAlert":
1834+
if value == "true":
1835+
conditions["services"][getServiceIndex("storage", conditions)]["rules"].append({"offline": True})
1836+
else:
1837+
conditions["services"][getServiceIndex("storage", conditions)]["rules"].append({"offline": False})
18001838
elif name == "initialSoftQuotaUtilizationAlert":
18011839
value = int(value)
18021840
if value > 0:
@@ -1809,6 +1847,21 @@ Resources:
18091847
value = int(value)
18101848
if value > 0:
18111849
conditions["services"][getServiceIndex("quota", conditions)]["rules"].append({"maxQuotaInodesPercentUsed": value})
1850+
elif name == "initialVserverStateAlert":
1851+
if value == "true":
1852+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"vserverState": True})
1853+
else:
1854+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"vserverState": False})
1855+
elif name == "initialVserverNFSProtocolStateAlert":
1856+
if value == "true":
1857+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"nfsProtocolState": True})
1858+
else:
1859+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"nfsProtocolState": False})
1860+
elif name == "initialVserverCIFSProtocolStateAlert":
1861+
if value == "true":
1862+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"cifsProtocolState": True})
1863+
else:
1864+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"cifsProtocolState": False})
18121865
18131866
return conditions
18141867

Monitoring/monitor-ontap-services/monitor_ontap_services.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,8 @@ def buildDefaultMatchingConditions():
12621262
{"name": "ems", "rules": []},
12631263
{"name": "snapmirror", "rules": []},
12641264
{"name": "storage", "rules": []},
1265-
{"name": "quota", "rules": []}
1265+
{"name": "quota", "rules": []},
1266+
{"name": "vserver", "rules": []}
12661267
]}
12671268
#
12681269
# Now, add rules based on the environment variables.
@@ -1326,6 +1327,11 @@ def buildDefaultMatchingConditions():
13261327
value = int(value)
13271328
if value > 0:
13281329
conditions["services"][getServiceIndex("storage", conditions)]["rules"].append({"volumeCriticalFilesPercentUsed": value})
1330+
elif name == "initialVolumeOfflineAlert":
1331+
if value == "true":
1332+
conditions["services"][getServiceIndex("storage", conditions)]["rules"].append({"offline": True})
1333+
else:
1334+
conditions["services"][getServiceIndex("storage", conditions)]["rules"].append({"offline": False})
13291335
elif name == "initialSoftQuotaUtilizationAlert":
13301336
value = int(value)
13311337
if value > 0:
@@ -1338,6 +1344,21 @@ def buildDefaultMatchingConditions():
13381344
value = int(value)
13391345
if value > 0:
13401346
conditions["services"][getServiceIndex("quota", conditions)]["rules"].append({"maxQuotaInodesPercentUsed": value})
1347+
elif name == "initialVserverStateAlert":
1348+
if value == "true":
1349+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"vserverState": True})
1350+
else:
1351+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"vserverState": False})
1352+
elif name == "initialVserverNFSProtocolStateAlert":
1353+
if value == "true":
1354+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"nfsProtocolState": True})
1355+
else:
1356+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"nfsProtocolState": False})
1357+
elif name == "initialVserverCIFSProtocolStateAlert":
1358+
if value == "true":
1359+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"cifsProtocolState": True})
1360+
else:
1361+
conditions["services"][getServiceIndex("vserver", conditions)]["rules"].append({"cifsProtocolState": False})
13411362

13421363
return conditions
13431364

0 commit comments

Comments
 (0)