GithubHelp home page GithubHelp logo

cran / datadogr Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 17 KB

:exclamation: This is a read-only mirror of the CRAN R package repository. datadogr — R Client for 'Datadog' API. Homepage: https://yutannihilation.github.io/K9 Report bugs for this package: https://github.com/yutannihilation/K9/issues

License: Other

R 100.00%

datadogr's Introduction

datadogr

Travis-CI Build Status AppVeyor Build Status CRAN_Status_Badge

About

datadogr is a simple package for querying data from Datadog.

Installation

datadogr is on CRAN now. You can install the released version from CRAN:

install.packages("datadogr")

Or the the development version from GitHub:

# install.packages("devtools")
devtools::install_github("yutannihilation/K9")

Usage

Authentication

You must have an API key for Datadog to use APIs. Follow the instruction on the official document: http://docs.datadoghq.com/api/#authentication

datadogr package uses DATADOG_API_KEY environmental variable for the API key. You can set this by:

  • defining the environmental variables in .Renviron and restart R session.
  • inputting on the popup of k9_auth() interactively.

Get List of Metrics

k9_list_metrics()

Get Metrics Values

A query can be specified with query argument using a query string:

k9_get_metrics(
  query = "system.cpu.idle{role:db,environment:test}by{host,region}",
  from  = Sys.time() - 3600,
  to    = Sys.time()
)

Or, the same thing can be done with metric, scope and by separetely:

k9_get_metrics(
  metric = "system.cpu.idle",
  scope = list(role = "db", environment = "test"),
  by    = c("host", "region"),
  from  = Sys.time() - 3600,
  to    = Sys.time()
)

The result will look like this:

#> # A tibble: 2 x 8
#>             timestamp    value          metric    display_name query_index interval                     host
#> *              <dttm>    <dbl>           <chr>           <chr>       <int>    <int>                    <chr>
#> 1 2015-04-29 21:50:00 98.19376 system.cpu.idle system.cpu.idle           0      600 vagrant-ubuntu-trusty-64
#> 2 2015-04-29 22:00:00 99.85857 system.cpu.idle system.cpu.idle           0      600 vagrant-ubuntu-trusty-64
#> # ... with 3 more variables: environment <chr>, role <chr>, region <chr>, expression <chr>

Get Events

(This function is a but experimental.)

k9_get_events(start = Sys.Date() - 7, end = Sys.Date(), tags = list(role = "db"))

datadogr's People

Contributors

yutannihilation avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.