webhooks

package
v1.28.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 17 Imported by: 14

README

Webhooks Input Plugin

This is a Telegraf service plugin that start a http server and register multiple webhook listeners.

telegraf config -input-filter webhooks -output-filter influxdb > config.conf.new

Change the config file to point to the InfluxDB server you are using and adjust the settings to match your environment. Once that is complete:

cp config.conf.new /etc/telegraf/telegraf.conf
sudo service telegraf start

Service Input

This plugin is a service input. Normal plugins gather metrics determined by the interval setting. Service plugins start a service to listens and waits for metrics or events to occur. Service plugins have two key differences from normal plugins:

  1. The global or plugin specific interval setting may not apply
  2. The CLI options of --test, --test-wait, and --once may not produce output for this plugin

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the CONFIGURATION.md for more details.

Configuration

# A Webhooks Event collector
[[inputs.webhooks]]
  ## Address and port to host Webhook listener on
  service_address = ":1619"

  ## Maximum duration before timing out read of the request
  # read_timeout = "10s"
  ## Maximum duration before timing out write of the response
  # write_timeout = "10s"

  [inputs.webhooks.filestack]
    path = "/filestack"

    ## HTTP basic auth
    #username = ""
    #password = ""

  [inputs.webhooks.github]
    path = "/github"
    # secret = ""

    ## HTTP basic auth
    #username = ""
    #password = ""

  [inputs.webhooks.mandrill]
    path = "/mandrill"

    ## HTTP basic auth
    #username = ""
    #password = ""

  [inputs.webhooks.rollbar]
    path = "/rollbar"

    ## HTTP basic auth
    #username = ""
    #password = ""

  [inputs.webhooks.papertrail]
    path = "/papertrail"

    ## HTTP basic auth
    #username = ""
    #password = ""

  [inputs.webhooks.particle]
    path = "/particle"

    ## HTTP basic auth
    #username = ""
    #password = ""

  [inputs.webhooks.artifactory]
    path = "/artifactory"

Available webhooks

Adding new webhooks plugin

  1. Add your webhook plugin inside the webhooks folder
  2. Your plugin must implement the Webhook interface
  3. Import your plugin in the webhooks.go file and add it to the Webhooks struct

Both Github and Rollbar are good example to follow.

Metrics

Example Output

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Webhook

type Webhook interface {
	Register(router *mux.Router, acc telegraf.Accumulator, log telegraf.Logger)
}

type Webhooks

type Webhooks struct {
	ServiceAddress string          `toml:"service_address"`
	ReadTimeout    config.Duration `toml:"read_timeout"`
	WriteTimeout   config.Duration `toml:"write_timeout"`

	Github      *github.GithubWebhook           `toml:"github"`
	Filestack   *filestack.FilestackWebhook     `toml:"filestack"`
	Mandrill    *mandrill.MandrillWebhook       `toml:"mandrill"`
	Rollbar     *rollbar.RollbarWebhook         `toml:"rollbar"`
	Papertrail  *papertrail.PapertrailWebhook   `toml:"papertrail"`
	Particle    *particle.ParticleWebhook       `toml:"particle"`
	Artifactory *artifactory.ArtifactoryWebhook `toml:"artifactory"`

	Log telegraf.Logger `toml:"-"`
	// contains filtered or unexported fields
}

func NewWebhooks

func NewWebhooks() *Webhooks

func (*Webhooks) AvailableWebhooks

func (wb *Webhooks) AvailableWebhooks() []Webhook

AvailableWebhooks Looks for fields which implement Webhook interface

func (*Webhooks) Gather

func (wb *Webhooks) Gather(_ telegraf.Accumulator) error

func (*Webhooks) SampleConfig

func (*Webhooks) SampleConfig() string

func (*Webhooks) Start

func (wb *Webhooks) Start(acc telegraf.Accumulator) error

func (*Webhooks) Stop

func (wb *Webhooks) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL