DEV Community

Derrick Sherrill for WayScript

Posted on

4 1

How to Automatically Execute Python Code Based on Datadog DevOps Alerts

Introduction

In today’s video, we’re going to take a look at how to setup the Datadog Trigger in WayScript and how to use it. Datadog is a powerful monitoring program that can be utilized in many different ways through WayScript, including triggering code executions and more. Keep reading to learn more!

Building our Script

For this tutorial we’ll simply explore how to set up and connect a Datadog account to WayScript. First, we’ll add the Datadog Trigger module to our program tree. We’ll need to authenticate the account using an API key. To do this, navigate to the toolbar at right and select the button with three bars; from here, click “Add Account.”

tutorial step #1

From here, you will need a nickname, and API key, and an Application key.

To get the API and Application keys, visit the Datadog HQ and access your API key. The Application key can also be found here. You can create a new Application key to use solely for this program. Remember to keep both of these keys hidden and don’t share them with others. Paste both of these keys in the right toolbar in WayScript. Now, WayScript has access to your Datadog account.

After clicking “Update” and the refresh button in the toolbar, select your preferred organization. Next, turn on events in the toolbar by activating the toggle switch. To activate the trigger, switch the toggle within the Trigger module in the tree. Now, we’ve activated the Datadog Trigger module within WayScript. However, we need to visit the Datadog HQ website to take care of a few more things before we can start using it.

First, we’ll go to the Monitors tab on the website. For our account, we already have one running titled Demo Events. Clicking on this we see that we’re sending notifications to @webhook-wayscript-datadog-trigger. We can then copy this, go back to the Monitors tab, and create a new monitor. There are many different things we can monitor using various monitor types, like Events, Custom Checks, and Networks. We’ll monitor an event for this tutorial.

tutorial step #1

For our new event monitor, we’re just sending an event when a user uses an application built through Heroku and hosted on GitHub. We have a default string that says “something big has happened,” so we’ll type “something big” in the “Match events containing” text box to match our string. Next, we’ll set alert conditions above zero, and then in the text box at the bottom we’ll type “Notify” and pass in the @webhook-wayscript-datadog-trigger from earlier.

tutorial step #1

Now add a title and click save, and the new monitor will be found in the monitors tab. We’re now ready to start using Datadog for a number of other applications within WayScript.

Having the ability to use Datadog within WayScript adds even more usability to the program. We can use Datadog to monitor our program and automatically trigger code executions to solve any issues that may arise, along with many other potential uses. Stay tuned for future tutorials using the Datadog trigger!

Conclusion

Questions about this script or anything else? Join our discord. We're always around to help.

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay