Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@datadog/datadog-api-client

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/datadog-api-client

OpenAPI client for Datadog APIs

  • 1.30.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @datadog/datadog-api-client?

@datadog/datadog-api-client is an official Node.js client library for interacting with the Datadog API. It allows developers to programmatically manage and interact with Datadog's monitoring, logging, and tracing services. This includes creating and managing dashboards, monitors, events, and more.

What are @datadog/datadog-api-client's main functionalities?

Create a Dashboard

This code sample demonstrates how to create a new dashboard in Datadog using the @datadog/datadog-api-client package.

const { v1: datadog } = require('@datadog/datadog-api-client');
const configuration = datadog.createConfiguration();
const apiInstance = new datadog.DashboardsApi(configuration);

const params = {
  body: {
    title: 'Example-Dashboard',
    widgets: [],
    layoutType: 'ordered',
    description: 'A sample dashboard',
    isReadOnly: false,
    notifyList: []
  }
};

apiInstance.createDashboard(params).then((data) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error) => {
  console.error(error);
});

Create a Monitor

This code sample demonstrates how to create a new monitor in Datadog using the @datadog/datadog-api-client package.

const { v1: datadog } = require('@datadog/datadog-api-client');
const configuration = datadog.createConfiguration();
const apiInstance = new datadog.MonitorsApi(configuration);

const params = {
  body: {
    name: 'Example-Monitor',
    type: 'metric alert',
    query: 'avg(last_5m):avg:system.cpu.user{host:host0} > 75',
    message: 'CPU usage is high on host0',
    tags: ['env:production'],
    options: {
      thresholds: {
        critical: 75
      }
    }
  }
};

apiInstance.createMonitor(params).then((data) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error) => {
  console.error(error);
});

Post an Event

This code sample demonstrates how to post a new event to Datadog using the @datadog/datadog-api-client package.

const { v1: datadog } = require('@datadog/datadog-api-client');
const configuration = datadog.createConfiguration();
const apiInstance = new datadog.EventsApi(configuration);

const params = {
  body: {
    title: 'Example-Event',
    text: 'An example event for Datadog',
    tags: ['env:production'],
    alertType: 'info'
  }
};

apiInstance.createEvent(params).then((data) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error) => {
  console.error(error);
});

Other packages similar to @datadog/datadog-api-client

Keywords

FAQs

Package last updated on 07 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc