Skip to main content
# README #



### What is this repository for? ###

* To setup datadog monitoring via cloudformation

### What does it do? ###

It setups a lambda function that communicate with the monitors resource
on the datadog api

https://docs.datadoghq.com/api/#monitors

The lambda is invoked via cloudformation custom resource. This repo
supplies custom resource classes for all the 4 Monitor types.
Custom resources have the same exact data structure as the DD api

It uses https://bitbucket.org/nordcloud/cfn_encrypt to securely store
datadog api credentials

### How do I get set up? ###

* clone this repo
~~~~
git clone git@github.com.org:nordcloud/cfn-datadog.git
~~~~

* Build the lambda package
~~~~
chmod +x create_zip.sh && ./create_zip.sh
~~~~

* upload `datadog_lambda.zip` to an s3 bucket
* get your api and application keys from Datadog
* generate the lambda template
~~~~
python lambda-template.py > /tmp/lambda.template
~~~~
* If you have not already set up your encrypt stack do that now ( https://bitbucket.org/nordcloud/cfn_encrypt )
* create a stack from your `lambda.template` file
* The lambda is now set up and ready to use.


### How do i use it to monitor resources created in other stacks? ###

Install the cfn_datadog library
~~~~
pip install cfn-encrypt
~~~~

Import the custom resource classes you want to use
~~~~
from cfn_datadog import (
MetricAlert, MetricAlertOptions, Composite, CompositeOptions,
EventAlert, EvenAlertOptions, ServiceCheck, ServiceCheckOptions
)
~~~~

Add a parameter so that you can reference your lambda stack
~~~~
datadog_lambda_stackname = t.add_parameter(Parameter(
"DatadogLambdaStackname",
Type="String",
Description="Datadog lambda stackname",
))
~~~~

Add the custom resource to the template: For documentation see datadog api
~~~~
t.add_resource(MetricAlert(
'Alert2',
query=Join("",["avg(last_1h):avg:system.net.bytes_rcvd{host:",Ref(my_instance),"} < 40"]),
ServiceToken=ImportValue(
Sub("${DatadogLambdaStackname}-LambdaArn")),
name="Bytes received on mytesthost",
message="Some Message @MyDDHandle",
tags=["tag1", "tag2"],
options=MetricAlertOptions(
notify_no_data= True,
no_data_timeframe=50
)
))
~~~~



Metadata

Release files for cfn-datadog 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for cfn-datadog 0.0.12
File Interpreter ABI Platform Actions
cfn_datadog-0.0.12-py2.py3-none-any.whl Python 2, Python 3 none any Details for cfn_datadog-0.0.12-py2.py3-none-any.whl

Release files / cfn_datadog-0.0.12-py2.py3-none-any.whl

Download URL cfn_datadog-0.0.12-py2.py3-none-any.whl
Size 8.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
eccb26f028f3b3179146d947c792dc286f6ac841b2c6fc27f74d3ec7492f6c98
BLAKE2b-256 checksum
How to use checksums
816b7ea054a635617034530f22bcce11ba3e61914807d37ba8242ca9379403a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cfn-datadog 0.0.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page