_
_
Back to Blog
Datadog
Infrastructure

RapDev's Open Source Host List Generator

Get visibility into your Datadog hosts with this open-source tool.
3
min read
|
by
Paul Kim
June 30, 2022

One of the core philosophies at RapDev is "fuck it, ship it". 

It's a concept that encompasses years of experience and culture and software development observations. It's a (casual) creed that inevitably leads to improvement and actionable iteration. As engineers rapidly build products and tools for daily deliverables, some utilities find more common uses and practicalities between projects. One of those tools that were developed was the RapDev Datadog Host List Generator

Datadog is commonly used to find and gain visibility into hundreds or thousands of machines to monitor their performance and obtain useful metrics from them. Although the platform makes most information available from the browser, some items are just easier to read straight from their extensive API. This is why RapDev engineers designed an extensive open-source utilities library to help Datadog users adapt the platform to their organization's needs. 

Datadog's API allows any user to find and get information from their Datadog instance by simply authenticating and then hitting one of their many endpoints. From managing the entire account to taking a snapshot of a time series graph, Datadog allows their users to programmatically use their platform. A common use of the Hosts API is to get an inventory of all hosts live on your Datadog instance. The team at RapDev have, at many different points, built a utility to get all hosts and generate a report by querying the API and filtering by different specifications. After writing this script enough times, it made sense to open source this utility and allow others to use and modify this utility and iterate upon it for their own use cases. You can find it here, at RapDev's Datadog Open Source Repository

To use this Python script, you can simply run the script with a search term(or terms) to pull every active host. 

For example to get all hosts:  

`python3 list_datadog_hosts.py`

Or for something more interesting, to get all hosts without agents:  

`python3 list_datadog_hosts.py field:metadata_agent_version:noagent`

Or, for something even more interesting, to get all hosts without agents on AWS:  

`python3 list_datadog_hosts.py field:metadata_agent_version:noagent,field:apps:aws`

The command will generate a file called `host_list<CURRENTTIME>.csv` the host name, all the tags, and other useful host metadata.

As you can see, this utility can be very powerful and can be used as an extension to the already powerful Datadog platform. For assistance, questions, feature requests, or anywhere in between, please reach out to integrations@rapdev.io and look forward to more being added to our open source repository!

Written by
Paul Kim
Boston
Avid Board Gamer and Software Engineer turned Datadog Engineer. Discovering the power of application monitoring, Cloud infrastructure, and trading 1 wood for 2 sheep.
you might also like
back to blog