|

[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

  • [ACMA Training #3] RF Transmission Output

    ⏱️ Estimated read time: Approx. 9 minutes (9 min read) All manufacturers, including Aruba, specify the power (output) of the AP's antenna port. RF power can be measured in units of mW (milliwatts) or dBm (decibels per milliwatt). 0 dBm is equal to 1 mW. When the dBm value becomes negative, the milliwatt falls to a decimal point. In other words, mW (milliwatts) represents the data linearly, and…

  • [ACSA Training #35] Routing Types

    ⏱️ Estimated reading time: Approx. 7 minutes (7 min read) We already covered routing in the last post. We examined how actual packets move at Layer 3 along with IP routing tables. Now, let's take a look at the actual types of routing and the protocols involved. Types of routing in AOS-CX Routing devices IP routing…

  • [Aruba DevNet Lecture 5] Completing the NetOps Pipeline with Git and CI/CD

    ⏱️ Estimated reading time: Approx. 3 minutes (3 min read) So far, armed with Python, Ansible, and the New Central API, we have conquered the core elements of network automation one by one. However, in a real-world environment, merely having a few script files on a personal PC cannot be called true automation. Today, in the final installment of this series,…

  • [ACP-DC Training #16] Ethernet VPN (EVPN) Add-ons

    ⏱️ Estimated reading time: Approx. 17 minutes (17 min read) If you learned the basic concepts of EVPN fabric in the previous post, this time we will look at additional features to further optimize and advance the EVPN environment. ARP and ND suppression functions, which improve network performance by suppressing unnecessary broadcast/multicast frames occurring between leaf switches, and VXLAN/EVPN fabric…

  • AOS-CX CLI Commands (2)

    ⏱️ Estimated reading time: Approx. 10 minutes (10 min read) Continuing from the previous post, I would like to cover some more in-depth content this time. We will look at the commands needed to configure the functions required for actual network operations in the field. VLAN Configuration The method for creating and configuring VLANs and VLAN interfaces in AOS-CX is as follows. While it is possible to configure a single VLAN,…

  • Automate Operations with AOS-CX NAE Lite

    ⏱️ Estimated read time: Approx. 10 minutes (10 min read) The AOS-CX switch is equipped with a proprietary analytics engine called the Network Analytics Engine (NAE). The NAE is a unique built-in analytics framework used for network assurance and troubleshooting. The NAE Agent is provided by HPE Aruba and is a Python-based tool for monitoring switch resource and protocol status…