Table: datadog_host - Query Datadog Hosts using SQL
Datadog is a monitoring and analytics platform for cloud-scale applications, providing full-stack observability through logs, metrics, and traces. It allows you to monitor, troubleshoot, and optimize application performance, as well as enhance cross-team collaboration. Datadog Hosts are the individual servers, containers, or devices that your application runs on, and this service provides detailed information about each host.
Table Usage Guide
The datadog_host
table provides insights into each host monitored by Datadog. As a DevOps engineer, explore host-specific details through this table, including host names, metrics, and associated metadata. Utilize it to uncover information about hosts, such as their status, uptime, and the apps running on them.
Examples
Basic info
Explore which Datadog hosts are currently active and when they last reported in. This is useful to maintain an up-to-date understanding of your system's operational status and to quickly identify any potentially muted or unresponsive hosts.
select name, id, up, last_reported_time, is_muted, jsonb_pretty(aliases) as aliasesfrom datadog_host;
select name, id, up, last_reported_time, is_muted, aliasesfrom datadog_host;
Find hosts that don't use systemd and contain the AWS region ap-southeast-2
in their DNS record
Explore which hosts in your infrastructure are not utilizing the 'systemd' application and are associated with the 'ap-southeast-2' AWS region. This can be beneficial in identifying potential inconsistencies in your system setup and ensuring regional compliance.
select name, jsonb_pretty(apps) as appsfrom datadog_hostwhere not apps @> '["systemd"]' :: jsonb and name like '%ap-southeast-2%';
select name, appsfrom datadog_hostwhere json_typeof(json_extract(apps, '$.systemd')) is null and name like '%ap-southeast-2%';
Count instance sizes of each host by their attached AWS tags
Analyze your AWS-hosted instances to understand the distribution of instance sizes across different hosts. This can help optimize resource allocation and improve cost efficiency.
select tags, count(tags)from ( select jsonb_array_elements_text(tags_by_source -> 'Amazon Web Services') as tags from datadog_host ) as foowhere tags like '%instance-type%'group by tags;
select tags, count(tags)from ( select json_extract(tags_by_source, '$."Amazon Web Services"') as tags from datadog_host ) as foowhere tags like '%instance-type%'group by tags;
List hosts that have reported metrics within the last 10 minutes
Explore which hosts have recently reported metrics to stay updated on their status. This is useful for real-time monitoring and prompt issue detection.
select name, last_reported_time, upfrom datadog_hostwhere last_reported_time > current_timestamp - interval '10 minutes';
select name, last_reported_time, upfrom datadog_hostwhere last_reported_time > datetime('now', '-10 minutes');
Schema for datadog_host
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
aliases | jsonb | An array of aliases that the host is known by such as AWS EC2 instance name, AWS internal IP address etc. | |
apps | jsonb | An array containing host apps such as system services, containers and more. | |
aws_name | text | AWS name of the host. | |
id | text | ID of the host. | |
is_muted | boolean | Whether or not the host is muted. | |
last_reported_time | timestamp with time zone | Last time the host reported a metric data point. | |
meta | jsonb | An object containing host metadata such as operating system and version. | |
metrics | jsonb | An object containing host metrics such as CPU, iowait and load. | |
mute_timeout | bigint | The timeout of the mute applied to the host. | |
name | text | = | Name of the host. |
sources | jsonb | An array containing the sources of the host metrics. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tags_by_source | jsonb | An object containing tags for each data source such as AWS, Datadog Agent etc. | |
up | boolean | Whether the expected metrics for the host are being received or not. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- datadog
You can pass the configuration to the command with the --config
argument:
steampipe_export_datadog --config '<your_config>' datadog_host