Use SQL to instantly query Datadog resources across accounts. Open source CLI. No DB required.

steampipe-plugin-datadog

image

Datadog Plugin for Steampipe

Use SQL to query dashboards, users, roles and more from Datadog.

Quick start

Install the plugin with Steampipe:

steampipe plugin install datadog

Run a query:

select email, id, name, status, disabled from datadog_user;

Developing

Prerequisites:

Clone:

git clone https://github.com/turbot/steampipe-plugin-datadog.git
cd steampipe-plugin-datadog

Build, which automatically installs the new version to your ~/.steampipe/plugins directory:

make

Configure the plugin:

cp config/* ~/.steampipe/config
vi ~/.steampipe/config/datadog.spc

Try it!

steampipe query
> .inspect datadog

Further reading:

Contributing

Please see the contribution guidelines and our code of conduct. All contributions are subject to the Apache 2.0 open source license.

help wanted issues:

Owner
Turbot
Get cloud work done with Turbot — Creators of https://turbot.com/v5 and https://steampipe.io
Turbot
Comments
  • Add SLO table for DataDog Plugin

    Add SLO table for DataDog Plugin

    Example query results

    Adding Table for SLO's image

    Adding an SLO table to allow the user to search SLO's in DataDog and query based on various aspects of the SLO, like targets or timeframes. This is my first time committing a table to this plugin, So if anything needs to be changed more than happy to tweak it. I followed what was set up in the DataDog monitor and plan to continue to add a table for SLO history.

    Results
    select
      name,
      thresholds
    from
      datadog_slo
    where
      type in ('monitor') and
      thresholds @> '[{"timeframe":"90d"}]'::jsonb
    limit 5;
    
    +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | name                                                | thresholds                                                                                                                                                                                                                                      |
    +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Datatech_sql_Host_uptime SLO                        | [{"target":99,"target_display":"99.","timeframe":"90d"}]                                                                                                                                                                                        |
    | Kafka: Offline Partitions                           | [{"target":99.9,"target_display":"99.9","timeframe":"7d"},{"target":99.9,"target_display":"99.9","timeframe":"30d"},{"target":99.9,"target_display":"99.9","timeframe":"90d"}]                                                                  |
    | Retriever: chatNodeJsErrorLogs by minute (Clone)    | [{"target":99.9,"target_display":"99.9","timeframe":"90d","warning":99.95,"warning_display":"99.95"}]                                                                                                                                           |
    | Kafka SLI: Produce request latency                  | [{"target":95,"target_display":"95.","timeframe":"7d","warning":98,"warning_display":"98."},{"target":95,"target_display":"95.","timeframe":"30d","warning":98,"warning_display":"98."},{"target":95,"target_display":"95.","timeframe":"90d"}] |
    | Kafka SLI: Consume request latency                  | [{"target":95,"target_display":"95.","timeframe":"7d","warning":98,"warning_display":"98."},{"target":95,"target_display":"95.","timeframe":"30d","warning":98,"warning_display":"98."},{"target":95,"target_display":"95.","timeframe":"90d"}] |
    +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    
  • Add table datadog_host

    Add table datadog_host

    Hi there, First thank you for this nice plugin!

    Here a suggestion to add a table: to get the list of hosts (infrastructure_hosts)

    Have a nice day,

    References https://docs.datadoghq.com/developers/guide/query-the-infrastructure-list-via-the-api/

  • Add table for `datadog_host`

    Add table for `datadog_host`

    Tables added

    +------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
    | table                              | description                                                                                                             |
    +------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
    | datadog_host                       | A host is any piece of infrastructure that runs an instance of the Datadog Agent such as a bare metal instance or a VM. |
    +------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
    

    Closes: #19

    This is my first steampipe contribution so I expect I might have overlooked some things but I've tried to adhere to the style of the existing tables where possible.

    There are a few things worth pointing out:

    • While I've tried to wire up pagination properly, my workplace doesn't actually have enough hosts to properly test that it actually works (the page limit is 1000+)
    • I don't really understand the specifics of hydration when it comes to the absence of something. The Datadog hosts API will apparently serve results for any host that is live within the last 3 hours by default. Presumably if you were to open Steampipe, close it then open it again in a week, Steampipe would still retain older hosts rather than magically setting up to false. If Steampipe removes an entry from the table upon trying to rehydrate it and getting a 404, then this isn't such a big deal but either way, it kind of makes the up field redundant if it is always set to true
    • While I tried to craft some more "Advanced" queries, I'm not that great with SQL so some queries can probably be rewritten to be less complex
    • I haven't mapped host_name, which is available in the hosts API, as it appears to contain the exact same data as name based on the description.

    Anyway, I didn't worry too much about the edge cases since they can be ironed out over time I'm sure.

    You can do quite a lot of fun queries by making use of jsonb which I've heard about for a few years now but I've never actually seen it in action before now.

    CleanShot 2022-07-23 at 17 49 34@2x
  • Add table datadog_<custom metric resource> using dynamic table creation

    Add table datadog_ using dynamic table creation

    References Add table to get details of metrics in realtime

    https://github.com/DataDog/datadog-api-client-go/blob/master/api/v2/datadog/docs/MetricsApi.md#metricsapi https://github.com/DataDog/datadog-api-client-go/blob/master/api/v1/datadog/docs/MetricsApi.md#metricsapi

  • Add table datadog_metrics data

    Add table datadog_metrics data

    References Add table to get details of metrics in realtime

    https://github.com/DataDog/datadog-api-client-go/blob/master/api/v2/datadog/docs/MetricsApi.md#metricsapi https://github.com/DataDog/datadog-api-client-go/blob/master/api/v1/datadog/docs/MetricsApi.md#metricsapi

  • Update config to use server instead of api_url

    Update config to use server instead of api_url

    The api_url of the configuration file has currently no effect. The way to change the server has documented on the datadog-api-client-go is to set the site property, see https://github.com/DataDog/datadog-api-client-go#changing-server

    I thought it would be easier to rename the current configuration property from api_url to server has multiple values are possible (datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ddog-gov.com).

  • Fix : Plugin not working with `api_url =

    Fix : Plugin not working with `api_url = "https://api.datadoghq.eu/"`. Fixes #7

    Example query results

    Results
    Time: 8.975788ms
    +-----------------------+--------------------------------------+
    | name                  | id                                   |
    +-----------------------+--------------------------------------+
    | Subhajit Kumar Mondal | 0f550528-30e1-11ec-9255-da7ad0900002 |
    | turbot-router-events  | f0717bea-30b4-405a-9c8f-34f0b3d28804 |
    | <null>                | 252dcb01-30e1-11ec-9255-da7ad0900002 |
    | <null>                | 130f3218-38b8-11ec-9b20-da7ad0900002 |
    | Lalit Bhardwaj        | 45c9984e-30a0-11ec-9224-da7ad0900002 |
    +-----------------------+--------------------------------------+
    > select name, id from datadog_eu.datadog_user
    
    Time: 1.031153257s
    +----------------+--------------------------------------+
    | name           | id                                   |
    +----------------+--------------------------------------+
    | Lalit Bhardwaj | 26506476-4765-11ec-9a52-da7ad0900005 |
    +----------------+--------------------------------------+
    

    Connection config

    connection "datadog" {
      plugin  = "datadog"
      api_key = "reacted"
      app_key = "reacted"
    }
    
    connection "datadog_eu" {
      plugin  = "datadog"
      api_key = "reacted"
      app_key = "reacted"
      api_url = "https://api.datadoghq.eu/"
    }
    
  • Plugin not working with `api_url =

    Plugin not working with `api_url = "https://api.datadoghq.eu/"`

    Describe the bug

    > select name, id from datadog_eu.datadog_user
    Error: rpc error: code = Internal desc = hydrate function listUsers failed with panic runtime error: invalid memory address or nil pointer dereference
    > select name, id from datadog.datadog_user
    
    Time: 7.954036ms
    +-----------------------+--------------------------------------+
    | name                  | id                                   |
    +-----------------------+--------------------------------------+
    | <null>                | 130f3218-38b8-11ec-9b20-da7ad0900002 |
    | <null>                | 252dcb01-30e1-11ec-9255-da7ad0900002 |
    | turbot-router-events  | f0717bea-30b4-405a-9c8f-34f0b3d28804 |
    | Lalit Bhardwaj        | 45c9984e-30a0-11ec-9224-da7ad0900002 |
    | Subhajit Kumar Mondal | 0f550528-30e1-11ec-9255-da7ad0900002 |
    +-----------------------+--------------------------------------+
    

    Steampipe version (steampipe -v) Example: v0.9.0

    Plugin version (steampipe plugin list) Example: v0.0.1

    To reproduce setup connection config

    connection "datadog_eu" {
      plugin  = "datadog"
      api_key = "reacted"
      app_key = "reacted"
      api_url = "https://api.datadoghq.eu/"
    }
    
    
  • Add tables for `dashboard`, `RBAC`, `monitor`, `logs_metric`, `security_monitoring`

    Add tables for `dashboard`, `RBAC`, `monitor`, `logs_metric`, `security_monitoring`

    Tables Added

    +------------------------------------+-------------------------------------------------------------------------------------------------------------------+
    | table                              | description                                                                                                       |
    +------------------------------------+-------------------------------------------------------------------------------------------------------------------+
    | datadog_dashboard                  | A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying key performance metrics.           |
    | datadog_integration_aws            | Datadog AWS integration resource.                                                                                 |
    | datadog_log_event                  | Datadog log events are records of notable changes in your environments.                                           |
    | datadog_logs_metric                | Log-based metrics are a cost-efficient way to summarize log data from the entire ingest stream.                   |
    | datadog_monitor                    | A monitor provides alerts and notifications if a specific metric is above or below a certain threshold.           |
    | datadog_permission                 | Permissions provide the base level of access for roles.                                                           |
    | datadog_role                       | Roles categorize users and define what account permissions those users have.                                      |
    | datadog_security_monitoring_rule   | Security monitoring rules define conditional logic that is applied to all ingested logs and cloud configurations. |
    | datadog_security_monitoring_signal | Signals are threats detected based on a security monitoring rule.                                                 |
    | datadog_user                       | A user belongs to an organization and can be assigned roles.                                                      |
    +------------------------------------+-------------------------------------------------------------------------------------------------------------------+
    

    Integration test logs

    Logs
    Add passing integration test logs here
    

    Example query results

    Results
    Add example SQL query results here (please include the input queries as well)
    

    output.txt v

Use SQL to instantly query resources, data sources and more from Terraform code. Open source CLI. No DB required.
Use SQL to instantly query resources, data sources and more from Terraform code. Open source CLI. No DB required.

Terraform Plugin for Steampipe Use SQL to query data from Terraform configuration files. Get started → Documentation: Table definitions & examples Com

Dec 22, 2022
Use SQL to instantly query users, groups, applications and more from Okta. Open source CLI. No DB required.
Use SQL to instantly query users, groups, applications and more from Okta. Open source CLI. No DB required.

Okta Plugin for Steampipe Use SQL to query infrastructure including users, groups, applications and more from Okta. Get started → Documentation: Table

Nov 10, 2022
Use SQL to instantly query instances, networks, databases, and more from Scaleway. Open source CLI. No DB required.
Use SQL to instantly query instances, networks, databases, and more from Scaleway. Open source CLI. No DB required.

Scaleway Plugin for Steampipe Use SQL to query infrastructure servers, networks, databases and more from your Scaleway project. Get started → Document

Nov 16, 2022
Use SQL to instantly query Algolia indexes and configuration. Open source CLI. No DB required

Use SQL to instantly query Algolia indexes and configuration. Open source CLI. No DB required

Oct 1, 2022
Use SQL to query host, DNS and exploit information using Shodan. Open source CLI. No DB required.

Shodan Plugin for Steampipe Query Shodan with SQL Use SQL to query host, DNS and exploit information using Shodan. For example: select * from shod

Nov 10, 2022
Use SQL to data from CSV files. Open source CLI. No DB required.
Use SQL to data from CSV files. Open source CLI. No DB required.

CSV Plugin for Steampipe Use SQL to query data from CSV files. Get started → Documentation: Table definitions & examples Community: Slack Channel Get

Nov 10, 2022
Use SQL to instantly query file, domain, URL and IP scanning results from VirusTotal.
Use SQL to instantly query file, domain, URL and IP scanning results from VirusTotal.

VirusTotal Plugin for Steampipe Use SQL to query file, domain, URL and IP scanning results from VirusTotal. Get started → Documentation: Table definit

Nov 10, 2022
Use SQL to query information including Users, Groups, Clients, Roles and more from Keycloak.

Keycloak Plugin for Steampipe [WIP] THIS IS NOT ACTIVE NOR WORKING YET - DO NOT USE Use SQL to query information including Users, Groups, Clients, Rol

Jan 6, 2023
Use SQL to query instances, domains and more from Prometheus.
Use SQL to query instances, domains and more from Prometheus.

Use SQL to instantly query Prometheus metrics, alerts, labels and more. Open source CLI. No DB required.

Nov 28, 2022
Use SQL to query databases, logs and more from PlanetScale

Use SQL to instantly query PlanetScale databases, branches and more. Open source CLI. No DB required.

Sep 30, 2022
This is the code example how to use SQL to query data from any relational databases in Go programming language.

Go with SQL example This is the code example how to use SQL to query data from any relational databases in Go programming language. To start, please m

Mar 12, 2022
Go-Postgresql-Query-Builder - A query builder for Postgresql in Go

Postgresql Query Builder for Go This query builder aims to make complex queries

Nov 17, 2022
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.

OctoSQL OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases, streaming sources and file formats using

Dec 29, 2022
A Go SQL query builder and struct mapper.

godb - a Go query builder and struct mapper godb is a simple Go query builder and struct mapper, not a full-featured ORM. godb does not manage relatio

Dec 6, 2022
Query and Provision Cloud Infrastructure using an extensible SQL based grammar
Query and Provision Cloud Infrastructure using an extensible SQL based grammar

Deploy, Manage and Query Cloud Infrastructure using SQL [Documentation] [Developer Guide] Cloud infrastructure coding using SQL InfraQL allows you to

Oct 25, 2022
Query redis with SQL
Query redis with SQL

reqlite reqlite makes it possible to query data in Redis with SQL. Queries are executed client-side with SQLite (not on the redis server). This projec

Dec 23, 2022
write APIs using direct SQL queries with no hassle, let's rethink about SQL

SQLer SQL-er is a tiny portable server enables you to write APIs using SQL query to be executed when anyone hits it, also it enables you to define val

Jan 7, 2023
Parses a file and associate SQL queries to a map. Useful for separating SQL from code logic

goyesql This package is based on nleof/goyesql but is not compatible with it any more. This package introduces support for arbitrary tag types and cha

Oct 20, 2021
Go-sql-reader - Go utility to read the externalised sql with predefined tags

go-sql-reader go utility to read the externalised sql with predefined tags Usage

Jan 25, 2022