0
0
Apache Airflowdevops~20 mins

Integration with PagerDuty and Slack in Apache Airflow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PagerDuty and Slack Integration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of Airflow task notifying PagerDuty
Given this Airflow PythonOperator task code snippet that triggers a PagerDuty incident notification, what will be the output in the Airflow logs if the PagerDuty API key is invalid?
Apache Airflow
def notify_pagerduty():
    import requests
    url = 'https://events.pagerduty.com/v2/enqueue'
    payload = {
        "routing_key": "INVALID_API_KEY",
        "event_action": "trigger",
        "payload": {
            "summary": "Test incident",
            "source": "airflow",
            "severity": "error"
        }
    }
    response = requests.post(url, json=payload)
    print(response.status_code)
    print(response.json())
A
400
{'status': 'error', 'message': 'Invalid routing key', 'errors': ['Routing key is invalid']}
B
200
{'status': 'success', 'message': 'Event processed', 'dedup_key': 'abc123'}
C
500
{'status': 'error', 'message': 'Internal server error'}
D
401
{'status': 'error', 'message': 'Unauthorized', 'errors': ['Invalid API key']}
Attempts:
2 left
💡 Hint
Think about what HTTP status code PagerDuty returns for invalid keys.
Configuration
intermediate
1:30remaining
Correct Slack webhook URL format in Airflow Variable
Which of the following is the correct format to store a Slack Incoming Webhook URL in an Airflow Variable for use in a Slack notification task?
Aslack://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Bhooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Chttp://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Dhttps://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Attempts:
2 left
💡 Hint
Slack webhooks use HTTPS URLs starting with https://
🔀 Workflow
advanced
2:30remaining
Order of steps to integrate Airflow with PagerDuty and Slack
Arrange the steps in the correct order to integrate Airflow with PagerDuty and Slack for alert notifications.
A1,2,3,4
B2,1,3,4
C3,1,2,4
D1,3,2,4
Attempts:
2 left
💡 Hint
Think about what credentials you need before storing and using them.
Troubleshoot
advanced
2:00remaining
Identifying cause of Slack notification failure in Airflow
An Airflow task that sends Slack notifications fails with this error: "requests.exceptions.ConnectionError: HTTPSConnectionPool(host='hooks.slack.com', port=443): Max retries exceeded". What is the most likely cause?
AThe Slack webhook URL is incorrect or malformed
BThe Slack API token has expired
CThe Airflow worker has no internet access or network issues
DThe Airflow DAG code has a syntax error
Attempts:
2 left
💡 Hint
Connection errors usually relate to network problems.
Best Practice
expert
3:00remaining
Best practice for secure storage of PagerDuty and Slack credentials in Airflow
Which is the best practice for securely managing PagerDuty routing keys and Slack webhook URLs in Airflow for production use?
AStore keys in environment variables on Airflow workers only
BUse Airflow's built-in Secret Backend to store and retrieve keys securely
CStore keys as plain text in Airflow Variables with no encryption
DHardcode keys directly in DAG Python code for easy access
Attempts:
2 left
💡 Hint
Think about how to keep secrets safe and avoid exposure in code or UI.