> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/resilience-testing/3.0/chaos-testing/action-templates/custom-script/index.md).

# Kubernetes Custom Script Action Templates

Pre-built Custom Script Action templates for integrating observability and monitoring tools with your chaos experiments. These templates help you quickly set up actions to annotate dashboards, create events, and enhance visibility during chaos injection.

Here are Custom Script action templates that you can use in your chaos experiments.

<table data-view="cards"><thead><tr><th></th><th></th><th><select multiple><option value="7cgKYg0l" label="grafana" color="blue"></option><option value="sApLy1xa" label="observability" color="blue"></option><option value="Ow8HS5JM" label="annotation" color="blue"></option><option value="BxHoNrI4" label="datadog" color="blue"></option><option value="tGbGoKTc" label="event" color="blue"></option></select></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Grafana Chaos Annotation</strong></td><td>Grafana chaos annotation action annotates the grafana dashboard to highlight the chaos duration.</td><td><span data-option="7cgKYg0l">grafana, </span><span data-option="sApLy1xa">observability, </span><span data-option="Ow8HS5JM">annotation</span></td><td><a href="#grafana-chaos-annotation">#grafana-chaos-annotation</a></td></tr><tr><td><strong>Datadog Chaos Event</strong></td><td>It creates an event for the datadog dashboard to highlight the chaos injection.</td><td><span data-option="BxHoNrI4">datadog, </span><span data-option="sApLy1xa">observability, </span><span data-option="tGbGoKTc">event</span></td><td><a href="#datadog-chaos-event">#datadog-chaos-event</a></td></tr></tbody></table>

#### Grafana Chaos Annotation <a href="#grafana-chaos-annotation" id="grafana-chaos-annotation"></a>

Grafana chaos annotation action annotates the grafana dashboard to highlight the chaos duration.

**Required Environment Variables:**

* `GRAFANA_URL`: URL of the Grafana instance
* `GRAFANA_USERNAME`: Username for Grafana authentication
* `GRAFANA_PASSWORD`: Password for Grafana authentication
* `DASHBOARD_UID`: Dashboard UID of the Grafana instance
* `MODE`: Mode of operation (SOT, EOT, or Continuous)
* `ADDITIONAL_TAGS`: Additional tags for the annotation (optional)

<details>

<summary>Use cases</summary>

* Visualize chaos injection periods on Grafana dashboards
* Correlate chaos events with metrics and alerts
* Track experiment timeline alongside application performance
* Improve incident analysis and debugging

</details>

#### Datadog Chaos Event <a href="#datadog-chaos-event" id="datadog-chaos-event"></a>

It creates an event for the datadog dashboard to highlight the chaos injection.

**Required Environment Variables:**

* `DATADOG_URL`: URL of the Datadog instance
* `DATADOG_API_KEY`: Datadog API key for authentication
* `DATADOG_EVENT_TITLE`: Title of the event
* `DATADOG_EVENT_TEXT`: Text description of the chaos event
* `MODE`: Mode of operation (start or end, default: start)
* `DATADOG_EVENT_TAGS`: Comma-separated tags for the event (optional)
* `DATADOG_EVENT_ALERT_TYPE`: Alert type (info, warning, error, success, default: info)

<details>

<summary>Use cases</summary>

* Create events in Datadog to mark chaos experiment execution
* Track chaos injection alongside application metrics
* Enable correlation between chaos and system behavior
* Enhance observability during resilience testing

</details>
