Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 14, 2021 08:11 pm GMT

How to Automatically Execute Python Code Based on Datadog DevOps Alerts

Introduction

In todays video, were 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 well simply explore how to set up and connect a Datadog account to WayScript. First, well add the Datadog Trigger module to our program tree. Well 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 dont 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, weve 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, well 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 were 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. Well monitor an event for this tutorial.

tutorial step #1

For our new event monitor, were 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 well type something big in the Match events containing text box to match our string. Next, well set alert conditions above zero, and then in the text box at the bottom well 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. Were 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.


Original Link: https://dev.to/wayscript/how-to-automatically-execute-python-code-based-on-datadog-devops-alerts-3f44

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To