nmon

package
v0.0.0-...-2987df4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ping

func Ping(c *config.DeviceCfg, log *logrus.Logger, apidbg bool, filename string) (*sftp.Client, *ssh.Client, time.Duration, string, error)

Ping check connection to the

func SetDBConfig

func SetDBConfig(c *config.DBConfig, d *config.DatabaseCfg)

SetDBConfig set agent config

func SetLogDir

func SetLogDir(l string)

SetLogDir set log dir

Types

type NmonFile

type NmonFile struct {
	File *rfile.File

	FilePattern string
	CurFile     string
	Delimiter   string
	//Hostname     string <-not really needed
	//OS           string <-not really needed
	//Serial       string <-not really needed
	TextContent []string
	Sections    map[string]NmonSection

	HostName     string
	PendingLines []string

	LastTime    time.Time
	RotateDelay int
	UserFilters map[string]*regexp.Regexp
	// contains filtered or unexported fields
}

NmonFile type for remote NmonFiles

func NewNmonFile

func NewNmonFile(sftp *sftp.Client, l *logrus.Logger, pattern string, host string, delay int, filtermap map[string]*regexp.Regexp) *NmonFile

NewNmonFile create a NmonFile , Hostname needed to Parse pattern

func (*NmonFile) AddNmonSection

func (nf *NmonFile) AddNmonSection(line string) bool

AddNmonSection add new Section

func (*NmonFile) AppendText

func (nf *NmonFile) AppendText(text string)

AppendText add text section to dashboard

func (*NmonFile) Init

func (nf *NmonFile) Init(timezone string) (int64, error)

Init Initialize NmonFile struct return current position after initialized

func (*NmonFile) InitSectionDefs

func (nf *NmonFile) InitSectionDefs() (int64, error)

InitSectionDefs Initialize section definitions.

func (*NmonFile) ProcessChunk

func (nf *NmonFile) ProcessChunk(pa *pointarray.PointArray, Tags map[string]string, t time.Time, timeID string, lines []string)

ProcessChunk process a

func (*NmonFile) ProcessPending

func (nf *NmonFile) ProcessPending(points *pointarray.PointArray, tags map[string]string)

ProcessPending process last

func (*NmonFile) Reopen

func (nf *NmonFile) Reopen()

Reopen check and reopen again if needed

func (*NmonFile) ReopenIfChanged

func (nf *NmonFile) ReopenIfChanged() bool

ReopenIfChanged check if file has changed read last data in previous file and reopen again if needed

func (*NmonFile) ResetPending

func (nf *NmonFile) ResetPending()

ResetPending remove buffered data

func (*NmonFile) ResetText

func (nf *NmonFile) ResetText()

ResetText remove buffered data

func (*NmonFile) SetPosition

func (nf *NmonFile) SetPosition(newpos int64) error

SetPosition set remote file at newPos Posistion

func (*NmonFile) SetTimeZoneLocation

func (nf *NmonFile) SetTimeZoneLocation(tz string) (err error)

SetTimeZoneLocation set the timezone used to input metrics in InfluxDB

func (*NmonFile) UpdateContent

func (nf *NmonFile) UpdateContent() (int, int64)

UpdateContent from remoteFile return num of new lines , and new pos

type NmonSection

type NmonSection struct {
	Description string
	Columns     []string
}

NmonSection data

type Server

type Server struct {
	devices.Base
	Timezone string

	NmonFile  *NmonFile
	FilterMap map[string]*regexp.Regexp
	// contains filtered or unexported fields
}

Server contains all runtime device related device configu ns and state

func New

func New(c *config.DeviceCfg, tz string) *Server

New create and Initialice a device Object

func (*Server) GetNmonData

func (d *Server) GetNmonData()

GetNmonData get data from Device

func (*Server) GetOutSenderFromMap

func (d *Server) GetOutSenderFromMap(influxdb map[string]*output.InfluxDB) (*output.InfluxDB, error)

GetOutSenderFromMap to get info about the sender will use

func (*Server) ImportData

func (d *Server) ImportData(points *pointarray.PointArray) error

ImportData getmon N data from Remote devices

func (*Server) Init

func (d *Server) Init(c *config.DeviceCfg) error

Init does the following

- Initialize not set variables to some defaults - Initialize logfile for this device - Initialize comunication channels and initial device state

func (*Server) SSHRemoteExec

func (d *Server) SSHRemoteExec(cmd string) (string, error)

SSHRemoteExec a way to exec basic commands

func (*Server) ScanNmonDevice

func (d *Server) ScanNmonDevice() error

ScanNmonDevice scan Device

func (*Server) ToJSON

func (d *Server) ToJSON() ([]byte, error)

ToJSON return a JSON version of the device data

Jump to

Keyboard shortcuts

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