|

[Aruba DevNet Lecture 4] Central Webhooks Meet Slack

⏱️ Estimated reading time: Approx. 16 minutes (16 min read)

The destiny of a network engineer is to 'fight against failures'.
But if you only realize the problem after receiving a call in the middle of the night, it's already too late.

today Webhooks in Aruba Central By leveraging this feature, we will build an intelligent control system that immediately sends a notification to Slack when a specific event (AP Down, switch port error, etc.) occurs.


What is a Webhook?

Many people confuse APIs with webhooks. The simplest distinction is "who initiates the conversation?".
To put it simply, if an API is a 'question' that we ask for information, a webhook is a 'request' that the device informs us of.‘trot‘'no see.

[Aruba DevNet 4강] Central Webhook과 Slack의 만남 - image 54
  • API: “Hey, is AP 1 still alive?” (You have to keep asking periodically – Polling)
  • Webhook: (When an event occurs) "Administrator! AP 1 just died!" (Sent immediately when an event occurs)

What you need: Create a Slack app and a webhook URL

First, in the Slack channel where you want to receive notifications ‘'Incoming Webhook'’ You will need to obtain a unique URL through settings.

  1. Slack API Portal Login > Create New App
  2. Incoming Webhooks Activation and Add New Webhook to Workspace Click
  3. After selecting the channel to receive notifications, Webhook URL copy

Real-World! A "Bridge" Script Connecting Central and Slack

We need a simple Python server that converts the webhook data sent from Central into a format that Slack can understand.
(Considering the company security network environment, it runs well on Windows Python as well. Flask)

[webhook_receiver.py]

Python
from flask import Flask, request, jsonify
import requests

app = Flask(__name__)

# ==========================================
# 1. Enter setup information
# ==========================================
# [Security Settings] Must be identical to the API Key entered when setting up New Central Webhook.
MY_SECRET_API_KEY = ""Rubaruba_Secret_999!""

# [Slack Settings] Enter the Slack Webhook URL you received.
SLACK_WEBHOOK_URL = ""https://hooks.slack.com/services/XXXX/XXXX/XXXX""

@app.route(''/central_webhook'', methods=[''POST''])
def handle_webhook():
    # ==========================================
    # 2. API Key Authentication Verification (Security Logic)
    # ==========================================
    # New Central usually sends the key in the 'Authorization' header or 'X-API-Key'.
    # (Header name may vary depending on your environment, so modify as needed)
    received_key = request.headers.get('Authorization')
    
    if received_key != MY_SECRET_API_KEY:
        print(f""❌ Security Alert: Invalid API Key Access (Entered Key: {received_key})"")
        return jsonify({""error"": ""Unauthorized""}), 401

    print(""✅ Authentication successful! Data received from New Central."")

    # ==========================================
    # 3. Parsing New Central Payload (JSON) Data
    # ==========================================
    payload = request.json
    
    # Extracts the required values based on the actual JSON structure received.
    alert_name = payload.get(""name"", ""Unknown Event"")
    severity = payload.get(""severity"", ""Info"")
    state = payload.get(""state"", ""Unknown"")
    summary = payload.get(""summary"", ""No details"")
    device_type = payload.get(""deviceType"", ""Unknown"")
    alert_time = payload.get(""time"", """")

    Extract the serial number of the # faulty device (since it is in list format, extract the first value)
    impacted_entities = payload.get(""impactedEntities"", {})
    device_serials = impacted_entities.get(""deviceSerial"", [])
    serial_num = device_serials[0] if device_serials else ""N/A""

    # ==========================================
    # 4. Slack Notification Message Design (Block Kit & Attachments)
    # ==========================================
    # Specifies different colors for the left side of Slack messages depending on the severity.
    if severity == ""Critical"":
        color = ""#FF0000""  # Red
    elif severity == ""Warning"":
        color = ""#FFA500""  # Orange
    else:
        color = ""#36A64F""  # Green (Normal/Other)
        
    slack_msg = {
        ""attachments"": [
            {
                ""fallback"": f""New Central Alert: {alert_name}""",
                ""color"": color,
                ""title"": f""🚨 [New Central Outage Notification] {alert_name}""",
                ""fields"": [
                    {""title"": ""Severity"", ""value"": severity, ""short"": True},
                    {""title"": ""State"", ""value"": state, ""short"": True},
                    {""title"": ""Equipment Type"", ""value"": device_type, ""short"": True},
                    {""title"": ""Equipment Serial"", ""value"": serial_num, ""short"": True},
                    {""title"": ""Summary"", ""value"": summary, ""short"": False},
                    {""title"": ""Time of occurrence"", ""value"": alert_time, ""short"": False}
                ],
                ""footer"": ""Rubaruba DevNet Monitoring | egstory.net""
            }
        ]
    }

    # ==========================================
    # 5. Sending a message via Slack
    # ==========================================
    response = requests.post(SLACK_WEBHOOK_URL, json=slack_msg)
    
    if response.status_code == 200:
        print(""🚀 Notification sent to Slack!"")
    else:
        print(f""❌ Slack transmission failed: Code {response.status_code}""")

    return jsonify({""status"": ""success""}), 200

if __name__ == ''__main__'':
    # Run the server on port 5000.
    app.run(host='0.0.0.0', port=5000)

Setting up a webhook in New Central

Now we need to tell Central, "If something goes wrong, notify me at that Python server address!".

  1. Access Central > Click the left menu icon > API Gateway Select a card
[Aruba DevNet 4강] Central Webhook과 Slack의 만남 - image 55
  1. Click Webhooks > Create Webhook Click
  2. Enter the following items
  • Name: Webhook identifier (e.g. Slack_Alert_Prod)
  • Target URL: Receiving server address (e.g. http://your-server-ip:5000/endpoint)
  • Authentication Method: Choose a security method
    – API Key: Use unique keys for simple and secure authentication between systems
    – OIDC: High-level security authentication based on OAuth 2.0 (Client ID/Secret required)
  1. Click the left menu icon again > Notification Rules Select a card
  2. After clicking Create Rule, select the event for which you want to receive notifications via Slack.
[Aruba DevNet 4강] Central Webhook과 Slack의 만남 - image 56
  1. The Webhook created above(Slack_Alert_Prod) select

Webhook Points Changed in New Central

Webhooks have become more powerful and secure as they evolve into New Central.

itemExisting CentralNew Central (AOS 10)
Management MenuOrganization > WebhooksIntegrated management within the API Gateway card
Authentication SecuritySimple Header TokenAPI Key and OIDC (OpenID Connect) support
pliabilityLimited event notificationsStreaming API integration and service unit subscription available
UI/UXList format listingIntuitive card-based workflow

especially OIDC authenticationThis support provides a foundation for building automated pipelines with confidence even in demanding financial or enterprise environments.


In conclusion: From ‘Control‘ to ‘Response’

At New Central API GatewayManaging webhooks through is a very important change.
This means that network automation is no longer a simple 'add-on', but has become a 'standard interface' for infrastructure operations.

Many engineers are content with just receiving an alert. But true engineers need to think beyond that.

Add a 'reboot device button' to your Slack notification message, or simultaneously with the notification Lecture 2Excel report created inWhat if we could automatically generate and attach the New Central API and Webhooks? The combination of the New Central API and Webhooks goes beyond simple monitoring. automated operating systemis the starting point.

Similar Posts

  • [acp-dc training#10] vsx (2)

    ⏱️ Estimated reading time: Approx. 8 minutes (8 min read) In the previous post, we explored VSX, the virtualization technology of HPE Aruba Networking AOS-CX switches. We explained the components of VSX, the differences from VSF, and its advantages. Today, we would like to cover the practical aspects. We will examine how to actually utilize VSX to perform live software upgrades and look at technologies such as Split Brain… .

  • No interruptions in traffic even during firmware updates? The ISSU Complete Guide

    ⏱️ Estimated reading time: Approx. 5 minutes (5 min read) One of the first disconcerting moments you experience after joining a company as a network engineer is when a senior colleague says, “We’re going to update the switch firmware at 2 AM tonight, so get ready.” Whenever you update a smartphone or PC, you always have to reboot and become unusable for a few minutes. Network switches are the same…

  • [ACSA Training #10] Network Devices

    ⏱️ Estimated reading time: Approx. 9 minutes (9 min read) In enterprise network environments, hundreds or thousands of computer devices enable digital communication using different network elements. Today, we would like to discuss network devices typically deployed in LAN Campus networks. Layer 2 switches, Layer 3 routers, multi-layer switches…

  • [Monitoring with Icinga Part 1] Basic Integration with Icinga 2 – SNMP & REST API

    ⏱️ Estimated Reading Time: Approx. 6 minutes (6 min read) 1. Introduction: Infrastructure Monitoring, Why Icinga 2? When operating enterprise networks and infrastructure, Zabbix is by far the most familiar open-source monitoring tool to engineers in Korea. Thanks to its intuitive web GUI, various default templates, and an all-in-one environment consisting of a single package, numerous enterprise…

  • [ACMA Training #1] Introduction to Wireless LAN (802.11)

    ⏱️ Estimated reading time: Approx. 12 minutes (12 min read) Following the previous basic training on ArubaCX switches, this time we would like to proceed with training on Aruba Wireless LAN (WLAN, Wireless Local Area Network). In this post, we will provide a basic introduction to wireless LAN and explain the technology. Introduction to the Wireless LAN Organization To break down the terminology of wireless LAN, wireless short-range…

  • [ACP-DC Training #13] Spine-Leaf Architecture

    ⏱️ Estimated read time: Approx. 8 minutes (8 min read) The Spine-Leaf architecture consists of Spine switches acting as the core, Leaf switches serving as the access layer, and numerous endpoints responsible for the data center's computing and storage resources. This structure is highly scalable and efficient, and is optimized for low-latency communication, making it suitable for modern data centers requiring high-performance networks…