Documentation ¶
Index ¶
- Constants
- Variables
- func AgentSelfUpgrade()
- func BackUpFile(old string) (err error)
- func CheckFileExist(filename string) bool
- func CheckMd5(fp, argMd5 string) (same bool)
- func CheckPathAndMkdir(path string) error
- func CopyFile(dstName, srcName string)
- func DuPaths() []string
- func ExeShellCommand(cmdStr string) (string, error)
- func ExeSysCommand(cmdStr string) string
- func GetCurrPluginVersion() string
- func GetDynamicMonitoringConfig() map[string]int
- func Hostname() (string, error)
- func IP() string
- func InitLocalIp()
- func InitLog(level string) (err error)
- func InitRootDir()
- func InitRpcClients()
- func InitUpgradeChannel()
- func IntArrayToStringArr(intArr []int) []string
- func IntSliceEqualBCE(a, b []int) bool
- func IsTrustable(remoteAddr string) bool
- func ParseConfig(cfg string)
- func ReportPorts() []int64
- func ReportProcs() map[string]map[int]string
- func ReportUrls() map[string]string
- func SendMetrics(metrics []*model.MetricValue, resp *model.TransferResponse)
- func SendToTransfer(metrics []*model.MetricValue)
- func SetDuPaths(paths []string)
- func SetDynamicMonitoringConfig(cfg map[string]int)
- func SetReportPorts(ports []int64)
- func SetReportProcs(procs map[string]map[int]string)
- func SetReportUrls(urls map[string]string)
- func SetTrustableIps(ipStr string)
- func ShellCmdTimeout(timeout int, cmd string, args ...string) (stdout, stderr string, e error)
- func StrSliceEqualBCE(a, b []string) bool
- func TrustableIps() []string
- type CollectorConfig
- type GlobalConfig
- type HeartbeatConfig
- type HttpConfig
- type MetricLevelIntervalConfig
- type PluginConfig
- type Service
- type SingleConnRpcClient
- type TransferConfig
Constants ¶
const ( VERSION = "6.1.0" COLLECT_INTERVAL = time.Second URL_CHECK_HEALTH = "url.check.health" NET_PORT_LISTEN = "net.port.listen" DU_BS = "du.bs" PROC_NUM = "proc.num" UPTIME = "sys.uptime" )
changelog: 3.1.3: code refactor 3.1.4: bugfix ignore configuration 5.0.0: 支持通过配置控制是否开启/run接口;收集udp流量数据;du某个目录的大小 5.1.0: 同步插件的时候不再使用checksum机制 5.1.1: 修复往多个transfer发送数据的时候crash的问题 5.1.2: ignore mount point when blocks=0 6.0.0: agent自升级,新增一些监控项 6.0.1: agent collect level 6.0.2: 添加单核监控开关默认不打开,单核监控tag变更为core=core0x ,添加mem.available.percent 6.0.3: 增加sys.uptime 6.0.4: 修复cpu.iowait>100的bug 6.0.5: 添加进程采集监控,间隔30s 6.0.6: 调整内置的采集func间隔 disk io相关和tcp 10s-->30s,agent_version 整数代表当前版本,去掉动态监控方法 6.0.7: ntp 支持chronyc ,服务监控rpc call 间隔调整为一分钟 6.0.8: 修改监控项抓取时间间隔, 10s只保留cpu,解决断点问题 6.0.9: 修复dfa dfb块设备采集,修复不同版本ss-s的bug 6.1.0: 修复机器上主机名被改case,使ip转化为nxx-xx-xx的形式
Variables ¶
var ( ConfigFile string ServiceChangeSigns = make(map[string]chan int) )
var ( TransferClientsLock *sync.RWMutex = new(sync.RWMutex) TransferClients map[string]*SingleConnRpcClient = map[string]*SingleConnRpcClient{} )
定义transfer的rpcClient对应Map, transferClients读写锁
var ( Root string LocalIp string UpgradeChannel chan *model.AgentUpgradeArgs HbsClient *SingleConnRpcClient InUpgrading bool )
Functions ¶
func AgentSelfUpgrade ¶
func AgentSelfUpgrade()
func BackUpFile ¶
func CheckFileExist ¶
func CheckPathAndMkdir ¶
func ExeShellCommand ¶
func ExeSysCommand ¶
func GetCurrPluginVersion ¶
func GetCurrPluginVersion() string
func InitLocalIp ¶
func InitLocalIp()
func InitRootDir ¶
func InitRootDir()
func InitRpcClients ¶
func InitRpcClients()
func InitUpgradeChannel ¶
func InitUpgradeChannel()
func IntArrayToStringArr ¶
func IsTrustable ¶
func ParseConfig ¶
func ParseConfig(cfg string)
func ReportPorts ¶
func ReportPorts() []int64
func ReportProcs ¶
func ReportUrls ¶
func SendMetrics ¶
func SendMetrics(metrics []*model.MetricValue, resp *model.TransferResponse)
发送数据到随机的transfer
func SendToTransfer ¶
func SendToTransfer(metrics []*model.MetricValue)
func SetDuPaths ¶
func SetDuPaths(paths []string)
func SetReportPorts ¶
func SetReportPorts(ports []int64)
func SetReportProcs ¶
func SetReportUrls ¶
func SetTrustableIps ¶
func SetTrustableIps(ipStr string)
func ShellCmdTimeout ¶
运行Shell命令,设定超时时间(秒)
func StrSliceEqualBCE ¶
func TrustableIps ¶
func TrustableIps() []string
Types ¶
type CollectorConfig ¶
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"` DefaultTags map[string]string `json:"default_tags"` IgnoreMetrics map[string]bool `json:"ignore"` MetricLevelIntervalConfig *MetricLevelIntervalConfig `json:"metric_level_interval"` AppBaseDir string `json:"app_base_dir"` SelfUpgrade bool `json:"self_upgrade"` CpuPerCoreCollect bool `json:"cpu_per_core_collect"` }
func Config ¶
func Config() *GlobalConfig
type HeartbeatConfig ¶
type HttpConfig ¶
type PluginConfig ¶
type SingleConnRpcClient ¶
type SingleConnRpcClient struct { sync.Mutex RpcServer string Timeout time.Duration // contains filtered or unexported fields }
简单封装rpc.Cilent
func (*SingleConnRpcClient) Call ¶
func (this *SingleConnRpcClient) Call(method string, args interface{}, reply interface{}) error
rpc client调用hbs函数