exec

package
Version: v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2016 License: MIT Imports: 7 Imported by: 0

README

Exec Plugin

The exec plugin can execute arbitrary commands which output JSON. Then it flattens JSON and finds all numeric values, treating them as floats.

For example, if you have a json-returning command called mycollector, you could setup the exec plugin with:

[[inputs.exec]]
  command = "/usr/bin/mycollector --output=json"
  name_suffix = "_mycollector"
  interval = "10s"

The name suffix is appended to exec as "exec_name_suffix" to identify the input stream.

The interval is used to determine how often a particular command should be run. Each time the exec plugin runs, it will only run a particular command if it has been at least interval seconds since the exec plugin last ran the command.

Sample

Let's say that we have a command with the name_suffix "_mycollector", which gives the following output:

{
    "a": 0.5,
    "b": {
        "c": 0.1,
        "d": 5
    }
}

The collected metrics will be stored as field values under the same measurement "exec_mycollector":

 exec_mycollector a=0.5,b_c=0.1,b_d=5 1452815002357578567

Other options for modifying the measurement names are:

name_override = "newname"
name_prefix = "prefix_"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner struct{}

func (CommandRunner) Run

func (c CommandRunner) Run(e *Exec) ([]byte, error)

type Exec

type Exec struct {
	Command string
	// contains filtered or unexported fields
}

func NewExec

func NewExec() *Exec

func (*Exec) Description

func (e *Exec) Description() string

func (*Exec) Gather

func (e *Exec) Gather(acc inputs.Accumulator) error

func (*Exec) SampleConfig

func (e *Exec) SampleConfig() string

type Runner

type Runner interface {
	Run(*Exec) ([]byte, error)
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL