Catalyst center issues and events notification email.
This solution allows customization like suppressing multiple event count or you can modify code to suppress based on time - 5 minutes etc.
Catalyst Center Issue Notification with suppression on event count
Use Case: Catalyst Center Issues notification email sent on active issues gets triggered. Custom suppression feature is available on device event count multiples.
Solution: Email notification on events with custom event suppression feature example.
Result: Email notification for events can be triggered based on custom event suppression, if required.
This playbook will send email notification for all active issue whose count is 1. Sample code.
However, this playbook can be modified to generate notification for active events
and ignore some events based on count. It can be modified to suppress based on time too.
Expected output (example): ```[{'Device ID': '4a_id', 'Name': "hostname" Lost Connectivity to the AAA Server 192.168.200.38 in the Physical Network', 'Last Occurrence Time': '09-19-2025 10:28:16'},
{'Device ID': '5c_id', 'Name': 'Network Device DNA0 unreachable from Cisco Catalyst Center', 'Last Occurrence Time': '09-19-2025 10:19:27'},
{'Device ID': 'b5_id', 'Name': "The RADIUS server 'xxx.xxx.xxx.xx:xxxx,xxxx' is not responding to requests being made from the network device 'POD2'", 'Last Occurrence Time': '09-19-2025 10:19:05'}]
**Setup**
Install Visual studio code base on your environment windows or mac.
Install Ansible on Linux:
Fedora:
##sudo dnf install ansible
RHEL and CentOS:
##sudo yum install ansible
Ubuntu:
##sudo apt update
##sudo apt install software-properties-common
##sudo apt-add-repository --yes --update ppa:ansible/ansible
##sudo at install ansible
Install Ansible on Mac
##pip3 install ansible
Ansible Install on slide 8:
https://salesresources.cisco.com/app?ContentId=6430e5b9-57b3-42d2-8f47-2204fecaace0#/doccenter/1da3a786-63d3-404d-8de2-6ba6d0c843b4/doc/%252Fdde6be3a49-2fe4-8c35-3869-b724759234be%252FdfM2Y2MGY5YjEtOWQ2OS00MGNkLTg4ZTAtNmE2ODMzOGMzNWZl%252CPT0%253D%252CRXZlbnRz%252FdfNzI3MmU0NWQtZDk2ZC00NWQwLTk0OWQtOWE3MjI2YmQwMDZk%252CPT0%253D%252CUHJlc2VudGF0aW9ucw%253D%253D%252Flfdde82a32-4d6f-4857-850a-f43a579e87b8/grid/
Install Ansible Windows
Windows does not support Ansible as a native control node, so you cannot install Ansible directly on Windows for execution.
Instead, use Visual Studio Code as an editor on Windows and connect to a Linux environment where Ansible is installed.
Use the Remote - SSH extension in VS Code to connect to a remote Linux machine that has Ansible installed.
Install Windows Subsystem for Linux (WSL) on your Windows machine, then install Ansible inside the WSL Linux environment.
To install Ansible inside WSL:
1. Install Linux on Windows:
Install Windows Subsystem for Linux (WSL) and a Linux Distribution:
i. Enable WSL on your Windows machine. You can find instructions for this on Microsoft's documentation.
ii. Install a Linux distribution from the Microsoft Store (e.g., Ubuntu).
iii. Launch the Linux distribution and update its package lists and installed packages. Follow Install Ansible on Linux based on flavor of Linux
2. i. Open your WSL terminal.
ii. Use the Linux package manager (e.g., apt for Ubuntu) to install Ansible:
##sudo apt update
##sudo apt install ansible
After setting up Ansible in WSL or on a remote Linux host, you can use VS Code to edit your Ansible playbooks and run Ansible commands from the integrated terminal.
3. Install Visual Studio Code and the Ansible Extension:
i. Download and install Visual Studio Code for Windows from the official website.
ii. Open VS Code and navigate to the Extensions view (Ctrl+Shift+X or the Extensions icon on the sidebar).
iii. Search for "Ansible" and install the official Ansible extension by Red Hat. This extension provides language support, syntax highlighting, and other features for working with Ansible playbooks.
4. (Optional) Install the Remote - WSL Extension:
If you want to work with your Ansible projects directly within the WSL environment from VS Code, install the "Remote - WSL" extension by Microsoft. This allows VS Code to seamlessly integrate with your Linux filesystem and tools running in WSL.
5. (Optional) Install Ansible Lint and other tools:
Within your WSL environment, you can also install ansible-lint for linting your playbooks and other Ansible-related tools as needed.
By following these steps, you can establish a robust Ansible development environment within VS Code on your Windows computer, leveraging the power of WSL for a native-like Linux experience.
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
https://docs.ansible.com/
## Installation
Git clone:
```bash
git clone https://github.com/CiscoDevNet/catc_issue_email.git
Go to your project folder
cd catc
Set up Ansible.
Modify catc_issues.yml file. Change the variables below per your environment.
dna_center_url: '<<https://catalystcenteripaddress'>> Change this to your lab environment
# IMPORTANT: Replace with your actual DNA Center username and password
dna_center_user: '<<change this you username plain text>>'
dna_center_password: '<<change this your password plain text for same url region1>>'
smtp_host: "<<mail.com>>" # Replace with your SMTP server
Run ansible-playbook catc_issues.yml
Under - name: Process issues with issue_occurence_count = 1 from active issues, if you change - item.issue_occurence_count == 5 to ignore 5 counts of any event it will do so. Customize.
Once you are satisfied with testing. Then run it on a scheduler from Linux environment as cron job or other schedular that works for your environment.
Recommend: Extensive testing in your lab against all scenarios. Check if it picks up all active issues then check on suppression and modify code as appropriate.
Owner
Contributors
Categories
Products
Catalyst CenterProgramming Languages
License
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community