This plugin creates a Zenduty Alert when plugin is run.
This operator composes the logic for this plugin. It generates an Incident on Zenduty by sending an Alert to Zenduty. It accepts the following parameters:
api_key
: API Key generated by Zenduty (Required).integration_id
: The Integrationid generated by the API Integration (_Required).title
: Title of the incident that is to be created.summary
: Summary for the incident to be created.
This plugin requires the zenduty-api
python package.
Installation can be done through pip, as follows:
$ pip install zenduty-api
or you may grab the latest source code from GitHub:
$ git clone https://github.com/Zenduty/zenduty-python-sdk
$ python3 setup.py install
from airflow.models import DAG, Variable
from airflow.operators.bash_operator import BashOperator
from airflow.operators.zenduty import ZendutyIncidentOperator
my_test_dag = DAG('example')
op = BashOperator(
dag=my_test_dag,
task_id='my_task',
provide_context=True,
python_callable=my_python_job,
on_failure_callback=zenduty_incident
)
def zenduty_incident():
operator = ZendutyIncidentOperator(
api_key=Variable.get("api_key"),
integration_id=Variable.get("integration_id"),
title="Test Title",
summary="Test Summary"
)
return operator.execute()