g

package
v0.0.0-...-81b9c09 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION          = "5.1.0"
	COLLECT_INTERVAL = time.Second
)

changelog: 3.1.3: code refactor 3.1.4: bugfix ignore configuration 5.0.0: 支持通过配置控制是否开启/run接口;收集udp流量数据;du某个目录的大小 5.1.0: 同步插件的时候不再使用checksum机制

Variables

View Source
var (
	ConfigFile string
)
View Source
var LocalIps []string
View Source
var Root string

定义了Agent的各种参数: Root, LocalIps, HbsClient, TransferClient 以及要监控的各种指标: reportPaths, duPaths, reportProcs等,这些通过心跳信号来获取

Functions

func DuPaths

func DuPaths() []string

func GetCurrPluginVersion

func GetCurrPluginVersion() string

func Hostname

func Hostname() (string, error)

读取当前的Hostname, 优先考虑配置中的Hostname

func IP

func IP() string

获取当前机器的IP

func InitLocalIps

func InitLocalIps()

获取所有的Local Ips

func InitRootDir

func InitRootDir()

func InitRpcClients

func InitRpcClients()

心跳Client& 数据传输Client

func IsTrustable

func IsTrustable(remoteAddr string) bool

func ParseConfig

func ParseConfig(cfg string)

func ReportPorts

func ReportPorts() []int64

func ReportProcs

func ReportProcs() map[string]map[int]string

func SendToTransfer

func SendToTransfer(metrics []*model.MetricValue)

func SetDuPaths

func SetDuPaths(paths []string)

func SetReportPorts

func SetReportPorts(ports []int64)

func SetReportProcs

func SetReportProcs(procs map[string]map[int]string)

func SetTrustableIps

func SetTrustableIps(ipStr string)

func TrustableIps

func TrustableIps() []string

Types

type CollectorConfig

type CollectorConfig struct {
	IfacePrefix []string `json:"ifacePrefix"`
}

type GlobalConfig

type GlobalConfig struct {
	Debug         bool             `json:"debug"`
	Hostname      string           `json:"hostname"`
	IP            string           `json:"ip"`
	Plugin        *PluginConfig    `json:"plugin"`
	Heartbeat     *HeartbeatConfig `json:"heartbeat"`
	Transfer      *TransferConfig  `json:"transfer"`
	Http          *HttpConfig      `json:"http"`
	Collector     *CollectorConfig `json:"collector"`
	IgnoreMetrics map[string]bool  `json:"ignore"`
}

func Config

func Config() *GlobalConfig

type HeartbeatConfig

type HeartbeatConfig struct {
	Enabled  bool   `json:"enabled"`
	Addr     string `json:"addr"`
	Interval int    `json:"interval"`
	Timeout  int    `json:"timeout"`
}

type HttpConfig

type HttpConfig struct {
	Enabled  bool   `json:"enabled"`
	Listen   string `json:"listen"`
	Backdoor bool   `json:"backdoor"`
}

type PluginConfig

type PluginConfig struct {
	Enabled bool   `json:"enabled"`
	Dir     string `json:"dir"`
	Git     string `json:"git"`
	LogDir  string `json:"logs"`
}

type SingleConnRpcClient

type SingleConnRpcClient struct {
	sync.Mutex

	RpcServer string
	Timeout   time.Duration
	// contains filtered or unexported fields
}
var (
	HbsClient      *SingleConnRpcClient
	TransferClient *SingleConnRpcClient
)

func (*SingleConnRpcClient) Call

func (this *SingleConnRpcClient) Call(method string, args interface{}, reply interface{}) error

type TransferConfig

type TransferConfig struct {
	Enabled  bool   `json:"enabled"`
	Addr     string `json:"addr"`
	Interval int    `json:"interval"`
	Timeout  int    `json:"timeout"`
}

Jump to

Keyboard shortcuts

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