Skip to content

deanhouseholder/datadog-send-alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

DataDog Send Alert Bash Function

Simple Bash function to send alerts to DataDog. This assumes that you have already installed the datadog-agent on the localhost and it is listening on the default UDP port 8125.

Basic usage:

#!/bin/bash
source datadog_send_alert.sh

send_dd_alert "alert title" "alert body text"

Advanced usage:

#!/bin/bash
source datadog_send_alert.sh

# Environment variables
host='127.0.0.1'
port='8125'

# Define message vars
body="Alert message body"
tags="script_name"
group="$(date +%s)" # Unique string to group related alerts

# Send Grouped Alerts
send_dd_alert "Script starting" "$body" "info" "$group" "$tags"
send_dd_alert "Successfully did a thing" "$body" "success" "$group" "$tags"
send_dd_alert "Noticed something" "$body" "info" "$group" "$tags"
send_dd_alert "Hmmm, this doesn't seem right" "$body" "warning" "$group" "$tags"
send_dd_alert "Oh snap! An error!" "$body" "error" "$group" "$tags"

Detailed API documentation:

https://docs.datadoghq.com/developers/dogstatsd/datagram_shell/?tab=events

About

Bash script to submit DataDog alerts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages