|

[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

  • How to migrate to AOS 10 and what to keep in mind

    ⏱️ Estimated reading time: Approx. 7 minutes (7 min read) It has already been nearly five years since HPE Aruba Networking introduced AOS 10 as its next-generation wireless network operating system. A significant number of Aruba wireless LAN users are still using an architecture based on AOS 8. However, since the new Wi-Fi 7 access points only support the AOS 10 operating system…

  • [ACSA Education #34] VRRP

    ⏱️ Estimated reading time: Approx. 10 minutes (10 min read) In the previous post, we looked at the Default Gateway. An endpoint can have only one Default Gateway. And it can be a single point of failure. Looking at the figure below, if Core-1 fails, PC-1 and others using Core-1 as the Default Gateway…

  • Configuring RoCE in AOS-CX (1) – Theory

    ⏱️ Estimated read time: Approx. 8 minutes (8 min read) Today's mission-critical storage environments require higher consistency, predictability, and performance to meet high business demands. Data centers require more I/O capacity to accommodate vast amounts of data, applications, and workloads. Along with this surge in data…

  • [ACP-DC Training #14] VXLAN

    ⏱️ Estimated read time: Approx. 9 min read Why VXLAN? The foundation of VXLAN functionality is the RFC 7348 standard, which provides an alternative to the existing traditional VLAN concept. 1. Overcoming the limitations of the number of VLANs (ID scalability) Traditional VLANs use 12-bit numeric tags inside the 802.1Q header….

  • [APSC Training #5] Aruba Central Subscription Management

    ⏱️ Estimated reading time: Approx. 3 minutes (3 min read) In the previous post, we looked at adding Aruba devices to the cloud. Now, to actually operate them, we need to map subscription licenses to the devices. Let's take a look at subscription assignment and key management. HPE GreenLake Device Assignment HPE GreenLake is HPE's common…

  • [ACP-DC Training#7] Deploying Data Center Switches

    ⏱️ Estimated read time: Approx. 16 minutes (16 min read) Deploying data center switches may look similar to installing campus switches, but there are unique aspects specific to data centers. In particular, data center switches often undergo a 'staging' process to prepare their configurations before being brought into the field. Today, we will look at what switch staging is, and two…