Alarm SBI Suppression Policy
Scenario Overview
An Alarm Policy is a filtering method that allows you to control the alarms on network conditions. An alarm suppression policy can be implemented to prevent unnecessary alerts. With Alarm policies, you can control the alarms generated in the network based on the conditions you specify.
You can create alarm policies to perform the following actions:
- Suppress alarms: Does not generate alarms for the selected events. However, events are created and saved normally.
- Suppress events and alarms: Does not create events and alarms.
Prerequisites
Before running this example, ensure:
- You have obtained an access token. Refer to the 'Getting Started' section for instructions.
- The cnc-api-common.sh script is properly configured.
- Necessary input and output directories exist for storing and retrieving alarm suppression policy files.
Add and Retrieve Alarm Suppression policy
Run the script alarm_suppression_policy.sh
from the example directory.
cd cnc-fault-api-examples;./alarm_suppression_policy.sh
Script Details
#!/bin/bash
. ./cnc-api-common.sh
alarm-suppression-policy() {
# Assume the CNC JWT has already been obtained by running the get-cnc-jwt.sh script.
# Read from jwt file and export it as AUTH_TOKEN_HDR
export_jwt
# STEP 1 : Add alarm suppression policy from CNC_API_INPUT
# STEP 2 : Store the output in CNC_API_OUTPUT file
CNC_API_URL=$CNC_FAULT_API_CTX/suppressionpolicy
CNC_API_INPUT="$PRJ/input/alarm-suppression-policy.json"
CNC_API_OUTPUT="$PRJ/output/alarm-suppression-policy.json"
http_post $CNC_API_URL @$CNC_API_INPUT $CNC_API_OUTPUT
# STEP 3 : Retrieve alarm suppression policy
CNC_API_URL=$CNC_FAULT_API_CTX/suppressionpolicy
CNC_API_OUTPUT="$PRJ/output/alarm-suppression-policy-retrieval.json"
http_get $CNC_API_URL $CNC_API_OUTPUT
}
alarm-suppression-policy