Source
yaml
id: http-check
namespace: company.team
inputs:
  - id: uri
    type: URI
    defaults: https://kestra.io
tasks:
  - id: api
    type: io.kestra.plugin.core.http.Request
    uri: "{{ inputs.uri }}"
  - id: check_status
    type: io.kestra.plugin.core.flow.If
    condition: "{{ outputs.api.code != 200 }}"
    then:
      - id: unhealthy
        type: io.kestra.plugin.core.log.Log
        message: Server unhealthy!!! Response {{ outputs.api.body }}
      - id: send_slack_alert
        type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
        url: "{{ secret('SLACK_WEBHOOK') }}"
        payload: |
          {
            "channel": "#alerts",
            "text": "The server {{ inputs.uri }} is down!"
          }
    else:
      - id: healthy
        type: io.kestra.plugin.core.log.Log
        message: Everything is fine!
triggers:
  - id: daily
    type: io.kestra.plugin.core.trigger.Schedule
    cron: 0 9 * * *
About this blueprint
Notifications API
This flow will check if a given URI is healthy or not. If the response code is not 200, it will send a Slack notification to the #alerts channel. Otherwise, it will log that everything is fine. The flow is scheduled to run daily at 9:00 AM.
More Related Blueprints