Skip to main content
All CollectionsDeveloper Documentation
Celona Network Monitoring API: Integration with Slack
Celona Network Monitoring API: Integration with Slack

Interrupt (vs. polling) event processing for monitoring your Celona network with Slack notifications

Team Celona avatar
Written by Team Celona
Updated over a week ago

Introduction

This article is a step-by-step guide for integrating Slack webhook functionality with the Celona Network Monitoring API.

Celona has 3 publicly available REST API libraries, which are hosted in Swaggerhub:

While the first two APIs (Network Management and Stats and Telemetry) are polling APIs, the Celona Network Monitoring API is a subscription-based API.

Polling APIs require software to interact with the API server to perform an action, such as reading state or making a configuration change. Subscription-based APIs allow software to subscribe to specific API endpoints to be notified on events tracked by the API server.

Subscription-based APIs allow your software and system to do other things while asynchronously waiting for an event. The following uses a simple example of monitoring Celona Access Point (AP) state.

We'll start with a simple polling example for the AP status. Then, we will use a Slack webhook as a precursor to craft a custom automation to handle monitoring events for APSTATUS.

Step by step instructions

In this article, you will learn how to:

  • Obtain a Celona API key

  • Poll enodebs/<serialnumber> for Celona Access Point status

    • Review the swaggerhub page for enodebs/{serialnumber}

    • Obtain the serial number of your Celona Access Point from the Celona Orchestrator

    • Perform a GET polling request for data.status (e.g., using Postman)

      • Under Authorization, Type API Key, enter API Key as X-API-Key

      • Perform GET request for AP, URL: https://api.celona.io/v1/api/cfgm/enodebs/<AP-serial-number>

      • Review response body for data.status

  • List all Events

  • Obtain the customerid

  • Create/obtain your slack webhook URL

  • Configure customer settings to receive notifications

  • Subscribe to APSTATUS

  • Bring up an AP to receive an APSTATUS slack notification

Obtain a Celona API key

In the Celona Orchestrator, navigate in the left pane to Admin Settings > API Keys.

Generate an API key. Make sure to store it safely as it will be used for all API calls.

Poll enodebs/{serial number} for Celona AP status

Let's first review a simple polling API request for AP status (4=Up, 5=Down) from the Celona Network Management API. Once you can do this, you can similarly interact with all other APIs.

Once you can understand the Celona Network Management APIs, then you have most of what's needed to work with the Celona Stats and Telemetry API; the main difference there is that most of the API endpoints require a start and end gettimeofday input in milliseconds (vs. the more common seconds unit of time).

We need a few more data parameters from the system before we can make our polling API call to check on AP status:

  • Review the swaggerhub page for enodebs/{serialnumber}

  • Obtain the serial number of your Celona AP from the Orchestrator

In the Celona Orchestrator, navigate in the left pane to Access Points. Note the serial number of an AP that you control. In this example, we will note the AP serial number ending in AK02.

Perform a GET polling request for data.status (e.g. using Postman)

With the Celona API key and AP serial number, we can use an API tool such as Postman to perform the heavy lifting for API calls.

Note: API keys have been obscured / redacted in the following screenshots. You too should keep your API key safe to prevent unintended access to your Celona APIs.

  • Under Authorization, Type API Key, enter API Key as X-API-Key

  • Perform GET request for AP, URL: https://api.celona.io/v1/api/cfgm/enodebs/{APserialnumber}

  • Review response body for data.status (4 = Up, 5 = Down)

List all Events

For this lesson we will focus on APSTATUS, but this command will let you see all events to which you can subscribe.

Obtain the customerid

Many of the Celona API calls require the customerid as a parameter. Unlike the AP serial number, the customerid is NOT exposed in the Celona Orchestrator; so, you will have to perform an API call to get it.

Note: Why does Celona even bother with a customerid when an API key should be unique to the account? The reason is that the Celona Orchestrator accounts may be configured as managed service provider (MSP) accounts, which may contain multiple customers and customerids.

Note: The customerid in the following screenshots have also been obscured/redacted.

Create/obtain your slack webhook URL

If you do not already have a Slack webhook URL, follow the Slack instructions at https://api.slack.com/messaging/webhooks.

You will supply the webhook URL to configure the Celona Network Monitoring API for sending event messages.

In the Slack API Incoming Webhooks page where you setup your webhook, you can Copy the curl code and execute it in a shell to test your webhook. The sample code should appear in the Slack channel that you designate for your webhook.

Configure customer settings to receive notifications

  • For url, set your slack webhook URL

  • For subscribe_for, set your customerid, from above

Subscribe to APSTATUS

From the list of events, above, let's subscribe to APSTATUS.

Note that unsubscribing interface is the same: just change the http method from POST to DELETE.

Bring up an AP to receive an APSTATUS slack notification

To see the results of your efforts after tackling the instructions in this article, start by triggering an AP status change on your Celona access point and verify the Slack notification. For example, bring up an AP that is currently powered off.

Note: You may have to wait a few minutes after a state change before receiving the slack webhook call.

List all current subscriptions

You can list all of your current event subscriptions.

What you have learned and what's next?

In this lesson, you learned basic polling of Celona APIs and how to subscribe to events from the API. Here are few ideal next steps:

Did this answer your question?