Git Product home page Git Product logo

fluent-plugin-pagerduty's Introduction

fluent-plugin-pagerduty

Fluentd Output plugin to relay alert notification from application to PagerDuty.

Installation

install with td-agnet-gem or fluent-gem, gem command as:

# for td-agent2 (recommend)
$ sudo td-agent-gem install fluent-plugin-pagerduty -v 0.0.1

# for td-agent
$ sudo /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-pagerduty -v 0.0.1

# for system installed fluentd
$ gem install fluent-plugin-pagerduty

Usage

screenshot 2017-03-18 18 20 43

  1. add service selecting Service Type : Generic API system on PagerDuty websites
  2. copy API Key from the Services page.
  3. install fluent-plugin-pagerduty with gem or fluent-gem command.
  4. create fluentd configuration like below.
  5. restart fluentd process.
  6. send test message for fluent-plugin-pagerduty

Examples

Simple alert (JSON pass-thru)

In this example, a JSON record already conforming to the PagerDuty API is processed by Fluentd and passed through to PagerDuty as-is, triggering a simple alert.

<source>
  @type forward
</source>

<source>
  @type http
  port 8888
</source>

<match notify.pagerduty>
  type pagerduty
  service_key ******************
</match>
# via forward
$ echo '{"description":"Form validation has failed","details":{"name":"success","mail":"failed"}}' | fluent-cat notify.pagerduty

# via http
$ curl http://localhost:8888/notify.pagerduty -F 'json={"description":"Form validation has failed","details":{"name":"success","mail":"failed"}}'

Advanced alert (transformed JSON)

In this example, a JSON record is referenced to build a PagerDuty event with an incident key for managing de-duplication.

<source>
  @type forward
</source>

<source>
  @type http
  port 8888
</source>

<match notify.pagerduty>
  type pagerduty
  service_key   ******************
  description   Alarm@${Node["Location"]}:: ${Log["Message"]}
  incident_key  [${tag_parts[-1]}] ${Log["File"]}:${Log["Line"]}
</match>
# via forward
$ echo '{"Node":{"Location":"Somewhere","IP Address":"10.0.0.1"},"Log":{"Level": "ERROR","File":"FooBar.cpp","Line":42,"Message":"A very important logging message"}}' | fluent-cat notify.pagerduty

# via http
$ curl http://localhost:8888/notify.pagerduty -F 'json={"Node":{"Location":"Somewhere","IP Address":"10.0.0.1"},"Log":{"Level": "ERROR","File":"FooBar.cpp","Line":42,"Message":"A very important logging message"}}'

Option Parameters

  • service_key (required)

    The unique API identifier generated for each PagerDuty service belonging to a PagerDuty account. Must be present for any PagerDuty events.

  • event_type (optional)

    The PagerDuty event type: trigger, acknowledge, or resolve. If unspecified, the default is trigger.

  • description (conditionally required)

    The message content of a PagerDuty event. PagerDuty event types of trigger must contain a description. The content of the description may be built using Placeholders (see next section).

  • incident_key (optional)

    The identifier used for PagerDuty's de-duplication of events. The content of the incident key may be built using Placeholders (see next section).

Placeholders

These placeholders are available:

  • ${โ€ฆ}
    • hashName["key"] Value of key in named hash

    • arrayName[N] Value at index N in named array

    • primitive Value of named primitive

      Placeholders are built recursively and concatenated. For example, a specific value within a hash containing an array of hashes could be referenced as: ${foo["bar"][2]["baz"]}.

  • ${tag} Input tag
  • ${tag_parts[N]} Input tag splitted by '.' indexed with N such as ${tag_parts[0]}, ${tag_parts[-1]}.

Placeholder functionality is derived from features of fluent-plugin-record-reformer.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

TODO

patches welcome!

Copyright

Copyright (c) 2013- Kentaro Yoshida (@yoshi_ken)

License

Apache License, Version 2.0

fluent-plugin-pagerduty's People

Contributors

mkarlesky avatar y-ken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fluent-plugin-pagerduty's Issues

Planning migration to v0.14 API

Hello @okkez
I'm afraid could you please revise up-to-date with latest fluentd?
It should be better to follow latest fluentd api.

There is a user in this plugin
#3

Unable to gem install plugin

I receive the following error when I try to install this plugin. Is the plugin still published? I've also tried using fluent-gem to install and run into the same error.

gem install fluent-plugin-pagerduty
ERROR:  Could not find a valid gem 'fluent-plugin-pagerduty' (>= 0) in any repository
ERROR:  Possible alternatives: fluent-plugin-tagdata, fluent-plugin-tagged_udp, fluent-plugin-arduino, fluent-plugin-assert, fluent-plugin-dedup

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.