Alarm Notification Policy and Destination
Scenario Overview
This guide demonstrates how to configure alarm notification policies and destinations using Crosswork Fault APIs. These APIs allow network administrators to manage alarms and events generated by the Crosswork Network Controller based on specified conditions. You can configure destinations such as SNMP traps, Syslog, WebSocket, and external Kafka to forward notifications efficiently.Notifications ( alarms and events) can be forwarded in SNMPv2 or SNMPv3 format, also Syslog format. When adding an SNMP notification receiver with the notification type set to UDP, ensure that the receiver is configured to listen on the same UDP port. For the selected category, only events at the INFO level are processed, while alarms with critical, major, minor, and warning levels are handled accordingly.
Prerequisites
Before running these examples, 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 configuration files.
Alarm NBI Destinations
You can configure the Northbound trap or syslog receiver settings to forward alarms generated by the Crosswork Network Controller.
Run the script alarm_destination_trap.sh
from the example directory.
cd cnc-fault-api-examples;./alarm_destination_trap.sh
Script Details
#!/bin/bash
. ./cnc-api-common.sh
alarm_destination_trap() {
# 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 trap destination from CNC_API_INPUT
# STEP 2 : Store the output in CNC_API_OUTPUT file
CNC_API_URL=$CNC_FAULT_API_CTX/destination/trap
CNC_API_INPUT="$PRJ/input/trap-destination.json"
CNC_API_OUTPUT="$PRJ/output/trap-destination.json"
http_post $CNC_API_URL @$CNC_API_INPUT $CNC_API_OUTPUT
# STEP 3 : Retrieve trap destination
CNC_API_URL=$CNC_FAULT_API_CTX/destination/trap
CNC_API_OUTPUT="$PRJ/output/trap-destination-retrieval.json"
http_get $CNC_API_URL $CNC_API_OUTPUT
}
alarm_destination_trap
Run the script alarm_destination_syslog.sh
from the example directory.
cd cnc-fault-api-examples;./alarm_destination_syslog.sh
Script Details
#!/bin/bash
. ./cnc-api-common.sh
alarm_destination_syslog() {
# 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 syslog destination from CNC_API_INPUT
# STEP 2 : store the output in CNC_API_OUTPUT file
CNC_API_URL=$CNC_FAULT_API_CTX/destination/syslog
CNC_API_INPUT="$PRJ/input/syslog-destination.json"
CNC_API_OUTPUT="$PRJ/output/syslog-destination.json"
http_post $CNC_API_URL @$CNC_API_INPUT $CNC_API_OUTPUT
# STEP 3 : Retrieve syslog destination
CNC_API_URL=$CNC_FAULT_API_CTX/destination/syslog
CNC_API_OUTPUT="$PRJ/output/syslog-destination-retrieval.json"
http_get $CNC_API_URL $CNC_API_OUTPUT
}
alarm_destination_syslog
Alarm NBI Forwarding Policy
These APIs create a notification policy for sytem/network and devices.
Run the script alarm_notification_policy.sh
from the example directory.
cd cnc-fault-api-examples;./alarm_notification_policy.sh
Script Details
#!/bin/bash
. ./cnc-api-common.sh
alarm_notification_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 notification policy from CNC_API_INPUT
# STEP 2 : store the output in CNC_API_OUTPUT file
CNC_API_URL=$CNC_FAULT_API_CTX/notificationpolicy
CNC_API_INPUT="$PRJ/input/anp-system-network.json"
CNC_API_OUTPUT="$PRJ/output/anp-system-network.json"
http_post $CNC_API_URL @$CNC_API_INPUT $CNC_API_OUTPUT
# STEP 3 : Retrieve alarm notification policy
CNC_API_URL=$CNC_FAULT_API_CTX/notificationpolicy
CNC_API_OUTPUT="$PRJ/output/anp-system-network-retrieval.json"
http_get $CNC_API_URL $CNC_API_OUTPUT
}
alarm_notification_policy