Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BashPool ¶
type BashPool struct { OutCh chan MSGLine ConfUserShells []*UserShell `toml:"user_shell"` ConfCmdDefs []*CmdDef `toml:"cmd_define"` UserShells map[string]*UserShell //key by id CmdDefs map[string]*CmdDef Log telegraf.Logger ScriptDir string // contains filtered or unexported fields }
BashPool is an input plugin that collects external metrics sent via HTTP
func (*BashPool) Description ¶
Description -- input interface function
func (*BashPool) Gather ¶
func (B *BashPool) Gather(_ telegraf.Accumulator) error
Gather -- input interface function. Not use it in this service.
func (*BashPool) SampleConfig ¶
SampleConfig -- input interface function
func (*BashPool) StartContext ¶
StartContext -- start the service. invoked by telegraf framwork
type CmdDef ¶
type CmdDef struct { ID string `toml:"id"` //unique ShellID string `toml:"shell_id"` IntervalSec uint `toml:"interval_second"` CmdLine string `toml:"cmd_line"` Tags []string `toml:"tags"` // contains filtered or unexported fields }
CmdDef -- bash script define
type MSGType ¶
type MSGType byte
MSGType -- for send msg by channels of different kinds
const ( //OTStdout -- out type for stdout. in current, only support influxdb format OTStdout MSGType = iota //OTStderr -- out type for stderr. maybe will not be used OTStderr //OTEOFStdOut -- end of stdout after finish executing command OTEOFStdOut //OTEOFStdErr -- end of stderr after finish executing command OTEOFStdErr //OTProbe -- for probe to make sure shell is working OTProbe //ProbeStr -- ProbeStr = `!@#PROBE#@!` SEPERATOR = `[@S#P#T@]` )
type UserShell ¶
type UserShell struct { ID string `toml:"id"` OSUser string `toml:"os_user"` Cmd *exec.Cmd CmdReady bool //ok after su - user StdinPipe io.WriteCloser StdoutPipe io.ReadCloser StderrPipe io.ReadCloser *sync.Mutex // contains filtered or unexported fields }
UserShell -- exec.Cmd with os user
Click to show internal directories.
Click to hide internal directories.