forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Go execd plugins with shim (influxdata#7283)
- Loading branch information
Showing
58 changed files
with
915 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# External Plugins | ||
|
||
This is a list of plugins that can be compiled outside of Telegraf and used via the execd input. | ||
|
||
Pull requests welcome. | ||
|
||
## Inputs | ||
- [rand](https://github.com/ssoroka/rand) - Generate random numbers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package config | ||
|
||
import ( | ||
"bytes" | ||
"strconv" | ||
"time" | ||
|
||
"github.com/alecthomas/units" | ||
) | ||
|
||
// Duration is a time.Duration | ||
type Duration time.Duration | ||
|
||
// Size is an int64 | ||
type Size int64 | ||
|
||
// Number is a float | ||
type Number float64 | ||
|
||
// UnmarshalTOML parses the duration from the TOML config file | ||
func (d Duration) UnmarshalTOML(b []byte) error { | ||
var err error | ||
b = bytes.Trim(b, `'`) | ||
|
||
// see if we can directly convert it | ||
dur, err := time.ParseDuration(string(b)) | ||
if err == nil { | ||
d = Duration(dur) | ||
return nil | ||
} | ||
|
||
// Parse string duration, ie, "1s" | ||
if uq, err := strconv.Unquote(string(b)); err == nil && len(uq) > 0 { | ||
dur, err := time.ParseDuration(uq) | ||
if err == nil { | ||
d = Duration(dur) | ||
return nil | ||
} | ||
} | ||
|
||
// First try parsing as integer seconds | ||
sI, err := strconv.ParseInt(string(b), 10, 64) | ||
if err == nil { | ||
dur := time.Second * time.Duration(sI) | ||
d = Duration(dur) | ||
return nil | ||
} | ||
// Second try parsing as float seconds | ||
sF, err := strconv.ParseFloat(string(b), 64) | ||
if err == nil { | ||
dur := time.Second * time.Duration(sF) | ||
d = Duration(dur) | ||
return nil | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (s Size) UnmarshalTOML(b []byte) error { | ||
var err error | ||
b = bytes.Trim(b, `'`) | ||
|
||
val, err := strconv.ParseInt(string(b), 10, 64) | ||
if err == nil { | ||
s = Size(val) | ||
return nil | ||
} | ||
uq, err := strconv.Unquote(string(b)) | ||
if err != nil { | ||
return err | ||
} | ||
val, err = units.ParseStrictBytes(uq) | ||
if err != nil { | ||
return err | ||
} | ||
s = Size(val) | ||
return nil | ||
} | ||
|
||
func (n Number) UnmarshalTOML(b []byte) error { | ||
value, err := strconv.ParseFloat(string(b), 64) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
n = Number(value) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
## Example in bash using STDIN signaling | ||
|
||
counter=0 | ||
|
||
while read; do | ||
while read LINE; do | ||
echo "counter_bash count=${counter}" | ||
let counter=counter+1 | ||
counter=$((counter+1)) | ||
done | ||
|
||
(>&2 echo "terminate") | ||
trap "echo terminate 1>&2" EXIT |
Oops, something went wrong.