Skip to main content

Availability Monitoring for HTTP Endpoints

Maintaining the availability and uptime of your services is crucial for delivering seamless experiences to customers and ensuring business continuity. Even with robust infrastructure strategies like multi-zone deployments or redundant DNS setups, proactive monitoring remains essential to detect and address issues before they impact users.

With this template, you can automate availability monitoring by sending periodic HTTP requests to your endpoints and validating responses. It checks for successful responses, retries upon transient failures, and triggers alerts through various channels when downtime is detected.

Conductor features used

This template utilizes the following Conductor features:

How to use the template

  1. Import the template
  2. Understand the workflow logic
  3. Set up providers for sending notifications
  4. Run workflow

Import the template

To import the template:

  1. Go to Template Explorer from the left navigation menu on your Conductor cluster.
  2. Choose Availability Monitoring for HTTP(S) Endpoints and select Import.
  3. Rename the workflow and task names. For example, rename the workflow as “Monitor-HTTP-Endpoint-Availability_your_name”.
  4. Select Save.

The workflow is now imported and ready for use.

Monitoring HTTP Endpoint Workflow

Understand the workflow logic

This section explains the workflow logic and how to execute it.

Workflow inputs:

  • endpoint_url–The HTTP(S) endpoint to be monitored using the workflow.
  • notification_type–The medium for sending notifications if the endpoint is down. Supported values are:
    • SMS
    • EMAIL
    • SLACK
    • PAGERDUTY
  • notification_to–The email or phone number to which the notification is sent if the notification_type is SMS or EMAIL.
  • notification_from–The email or phone number to be displayed as the notification originator if the notification_type is SMS or EMAIL.

Example input payload for sending an SMS alert using Twilio:

{
"notification_type": "SMS",
"endpoint_url": "https://example.com/",
"notification_from": "14XXXXXXXXX",
"notification_to": "12XXXXXXXX"
}

Workflow logic:

  • The workflow begins with an HTTP task that sends a GET request to the specified endpoint.
  • In the next step, the Inline task retrieves the current timestamp from the server.
  • Next, the Switch task evaluates the output of the previous HTTP task to determine if the response indicates a success or failure.
    • If a 200 OK response is returned, the Switch task directs the execution via the defaultCase, ending the workflow.
    • For any other response or failure (e.g., DNS error), the Switch task sends execution to the FAILED path.

Switch task evaluating the HTTP status code

  • The failure path invokes a Sub Workflow, namely Notify-Channels, which sends a failure notification via the specified channel.

Workflow called as a sub workflow

  • This workflow begins with a Switch task confirming that the notification_type is a supported format.
  • Depending on the notification_type, the corresponding switch case executes and sends the notification through the specified channel.

Set up providers for sending notifications

This template sends notifications using the following providers:

  • Twilio–Required for SMS notifications.
  • SendGrid–Required for email notifications.
  • PagerDuty–Required for PagerDuty alerts.
  • Custom Slack webhook–Required for Slack notifications.

Configure your preferred provider and add the required credentials as secrets in Conductor.

Notification TypeProviderCredentials to be saved as Secret in Conductor
SMSTwilioThe account ID of the Twilio account.
  1. In your Twilio console, go to Account Info > Account SID.
  2. Copy the account ID.
  3. Save it as a secret in Orkes Conductor with the name orkes_template_twillio_account_id.
The authentication token of the Twilio account.
  1. In your Twilio console, go to Account Info > Auth Token.
  2. Copy the token.
  3. Combine the Account SID and Auth Token in the format: your_account_id:your_auth_token.
  4. Base64 encode the combined string using the command:
    echo -n "your_account_id:your_auth_token" | base64
  5. Save the encoded string as a secret in Orkes Conductor with the name orkes_template_twilio_base64_encoded_basic_auth.
EMAILSendgridThe API key from Sendgrid.
  1. In your Sendgrid account, go to Settings > API Keys.
  2. Select Create API Key and provide a name for the key.
  3. Set the API Key Permissions to Full Access.
  4. Copy the API key.
  5. Save it as a secret in Orkes Conductor with the name orkes_template_sendgrid_api_key.
SLACKSlackSlack Webhook URL.
  1. Create a custom webhook in Slack to post to a specific channel.
  2. Copy the Webhook URL.
  3. Save it as a secret in Orkes Conductor with the name orkes_template_slack_webhook.
PAGERDUTYPagerdutyRouting key for sending messages to Pagerduty.
  1. In your Pagerduty account, create a Service.
  2. Open the service and go to the Integrations tab.
  3. Select + Add an integration, and choose Events API V2.
  4. Once the integration is added, copy the 32 digit Integration Key, which is the routing key for the workflow.
  5. Save it as a secret in Orkes Conductor with the name orkes_template_pagerduty_eventsv2_integration_key.

The workflow is already configured with the above-mentioned secret names, so no further modifications are needed.

Notes
  • Ensure the credentials are correctly set before running the workflow to avoid errors. The workflow will fail if any of the parameters are incorrect or unreadable.
  • If you use different names for the secrets, ensure the Notify-Channels workflow is updated with the correct secret names. Failure to do so will result in an unauthorized error.

Run workflow

You can run the workflow in different ways.

The Scheduler allows you to set a predefined cadence for running a workflow. Once the schedule is configured, Conductor will automatically invoke the workflow at the specified intervals, requiring no further action from the user.

To schedule workflows:

  1. Go to Definitions > Scheduler from the left navigation menu on your Conductor cluster.
  2. Select + Define Schedule.
  3. Provide a schedule name, select the workflow name and version, and set the schedule using the cron expression.
  4. Select Save > Confirm.

This saves the Schedule definition, and the workflow is now automated to run at specific cadence. Refer to Scheduling Workflows documentation for more details.

Workflow output

The workflow output includes details of the notification sent to the respective platform.

Examples

Example for a notification received in PagerDuty:

Example for a notification received in Pagerduty

This template provides a starting point for customizing the workflow to your needs. You can add additional steps, such as logging events, or add a different provider (like Opsgenie for incident notifications) to suit your business requirements.