GithubHelp home page GithubHelp logo

datadog-event-resource's Introduction

Datadog Event Resource

Fetch or emit events to Datadog.

Source Configuration

  • application_key: Required. The application key to use when accessing Datadog.

  • api_key: Required. The api key to use when accessing Datadog.

  • filter: Optional. Regexp to filter events by title when checking.

  • datadog_host: Optional. Datadog host url to switch from US to Europe datacenter, default to US.

Behavior

check: Listen for events in the event stream from the last 32 days.

Detects new events that have been published to the Datadog event stream within the last 32 days.

in: Fetch an event

Places the following files in the destination:

  • event.json: The event fetched, as JSON. Example:

    {
        "date_happened": 1346449298,
        "id": 1378859526682864843,
        "priority": "normal",
        "tags": [
            "environment:test"
        ],
        "text": "Oh boy!",
        "title": "Did you hear the news today?",
        "url": "https://app.datadoghq.com/event/jump_to?event_id=1378859526682864843"
    }
  • version: The ID of the event fetched.

Parameters

None.

out: Emit an event to Datadog

Emits an event based on the static configuration defined in your parameters. Based on the Datadog API

Parameters

Required

  • title: The event title. Limited to 100 characters.

One of the following:

  • text: Static text for the body of the event. Environment variables can be used here to show the build metadata. Please refer to the Concourse documentation for a list of allowed variables.

  • text_file Path to a file containing text for the body of the event. This allows the message to be generated by a previous task step in the Concourse job.

Limited to 4000 characters. The text supports markdown.

Optional

  • priority: The priority of the event ('normal' or 'low').

  • host: Host name to associate with the event.

  • tags: A list of tags to apply to the event.

  • alert_type: "error", "warning", "info" or "success".

  • aggregation_key: An arbitrary string to use for aggregation, max length of 100 characters. If you specify a key, all events using that key will be grouped together in the Event Stream.

  • source_type_name: The type of event being posted. Options: nagios, hudson, jenkins, user, my apps, feed, chef, puppet, git, bitbucket, fabric, capistrano

Example Configuration

Resource

resource_types:
- name: datadog-event
  type: docker-image
  source:
    repository: concourse/datadog-event-resource

resources:
- name: datadog-event
  type: datadog-event
  source:
    api_key: API-KEY
    application_key: APPLICATION-KEY
    filter: "event-.*-regexp"

Plan

- get: datadog-event
- put: datadog-event
  params:
    title: Did you hear the news today?
    text: Oh boy!
    priority: normal
    tags:
    - environment:test
    alert_type: info

Development

Prerequisites

  • golang is required - version 1.12.x is tested; earlier versions may also work.
  • docker is required - version 18.09.x is tested; earlier versions may also work.

Running the tests

The tests have been embedded with the Dockerfile; ensuring that the testing environment is consistent across any docker enabled platform. When the docker image builds, the test are run inside the docker container, on failure they will stop the build.

Run the tests with the following command:

docker build -t datadog-event-resource --build-arg base_image=concourse/resource-types-base-image-static .

Contributing

Please make all pull requests to the master branch and ensure tests pass locally.

Caveats

Unless you are planning on using datadog events for triggering jobs, make sure to disable automatic resource checking, like so:

resources:
- name: datadog-event
  type: datadog-event
  check_every: never
  source:
    api_key: API-KEY
    application_key: APPLICATION-KEY

And in case you do plan on using datadog events to trigger jobs, make sure you're using event filtering:

resources:
- name: datadog-event
  type: datadog-event
  source:
    api_key: API-KEY
    application_key: APPLICATION-KEY
    filter: "event-.*-regexp"

Otherwise you're running a risk of bloating the concourse database if the volume of events going through datadog is high enough.

datadog-event-resource's People

Contributors

chenbh avatar chendrix avatar cirocosta avatar dcsg avatar dustinvanbuskirk avatar ofriharlev avatar pivotal-bin-ju avatar taylorsilva avatar tscolari avatar vito avatar xtremerui avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datadog-event-resource's Issues

Certificate error after switch to alpine image

After the change to alpine based image I am not able to post events to datadog:

panic: Post https://app.datadoghq.com/api/v1/events?api_key=xxx&application_key=xxx: x509: failed to load system roots and no roots provided

goroutine 1 [running]:
main.main()
	/go/src/github.com/concourse/datadog-event-resource/cmd/out/main.go:42 +0x61d

I hijacked the container and found /etc/ssl was missing, so I:
apk add ca-certificates

Then I was able to curl https://app.datadoghq.com

Docker image latest tag is not being updated

Today I changed from my repository to concourse repository and I noticed that the latest tag for the docker image is not being updated with the latest merges, is this expected? In the readme it does not mention nothing regarding this so I would expect the latest tag to be updated at every merge?

Allow connecting to datadog europe api

Hi, we use datadog europe datacenter and I noticed that this resource does not allow to connect to it.

In the go datadog api package, that this package uses, I noticed it is possible to change the datadog host by using the DATADOG_HOST env var, see here: https://github.com/zorkian/go-datadog-api/blob/9e2c892691035a7685a16d5839910cfc54e42fb6/client.go#L55.

I tried to set it on params on the get and put but didn't work.

Is there a way to do it? If it requires code implementation I could do it if you provide some guidelines.

Thanks in advance.

Expose Concourse metatdata to tags

Is your feature request related to a problem? Please describe.

It would be great if we can expose the Concourse metadata e.g. $BUILD_ID, $BUILD_NAME, etc to tags

Describe the solution you'd like

When building the Concourse pipeline yml file, any variables under the tag section will not interpolate

- put: datadog-event
  params:
    title: Did you hear the news today?
    text: Oh boy!
    priority: normal
    tags:
    - environment:test
    - build-id:$BUILD_ID
    alert_type: info

Describe alternatives you've considered

No response

Additional context

No response

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.