model

package
v0.0.0-...-9625d7e Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const GBConversion = 1024 * 1024 * 1024

GBConversion the multiple of GB --> Byte

Variables

This section is empty.

Functions

func AliasMetricName

func AliasMetricName(metricName string) string

AliasMetricName ...

func GenerateHashID

func GenerateHashID(pname string, pid int32) string

GenerateHashID generate hashid string by pname and pid

func GenerateHashIDByPname

func GenerateHashIDByPname(pname string) string

GenerateHashIDByPname generate hashid string by pname

func GetMountPrefix

func GetMountPrefix(name string) string

GetMountPrefix ...

Types

type CPUProcess

type CPUProcess struct {
	Pid        int32   `json:"pid"`
	Pname      string  `json:"name"`
	CPU        float64 `json:"cpu"`
	Cmdline    string  `json:"cmdline"`
	CreateTime int64   `json:"create_time"`
	Process    *process.Process
}

CPUProcess the type for top5 cpu process

type CPUProcessList

type CPUProcessList []*CPUProcess

CPUProcessList the type for CPUProcess slice

func (CPUProcessList) Len

func (c CPUProcessList) Len() int

used for sort by cpu desc

func (CPUProcessList) Less

func (c CPUProcessList) Less(i, j int) bool

func (CPUProcessList) String

func (c CPUProcessList) String() string

func (CPUProcessList) Swap

func (c CPUProcessList) Swap(i, j int)

type CesEventData

type CesEventData struct {
	EventName   string         `json:"event_name"`
	EventSource string         `json:"event_source,omitempty"`
	Time        int64          `json:"time"`
	Detail      CesEventDetail `json:"detail"`
}

CesEventData ...

type CesEventDataArr

type CesEventDataArr []CesEventData

CesEventDataArr ...

func EventPluginCmd

func EventPluginCmd(plugin *config.EachPluginConfig) CesEventDataArr

EventPluginCmd output the plugin metric data by a plugin config

type CesEventDetail

type CesEventDetail struct {
	Content      string `json:"content,omitempty"`
	GroupID      string `json:"group_id,omitempty"`
	ResourceID   string `json:"resource_id,omitempty"`
	ResourceName string `json:"resource_name"`
	EventState   string `json:"event_state"`
	EventLevel   string `json:"event_level"`
	EventUser    string `json:"event_user"`
	EventType    string `json:"event_type,omitempty"`
}

CesEventDetail ...

type CesMetricData

type CesMetricData struct {
	Metric      MetricType `json:"metric"`
	TTL         int        `json:"ttl"`
	CollectTime int64      `json:"collect_time"`
	Value       float64    `json:"value"`
	Unit        string     `json:"unit"`
}

CesMetricData the type for post metric data

type CesMetricDataArr

type CesMetricDataArr []CesMetricData

CesMetricDataArr the type for metric data array

func BuildCesMetricData

func BuildCesMetricData(inputMetric *InputMetric, isAggregated bool) CesMetricDataArr

BuildCesMetricData build ces metric data

func CustomMonitorPluginCmd

func CustomMonitorPluginCmd(plugin *config.EachPluginConfig) CesMetricDataArr

CustomMonitorPluginCmd output the plugin metric data by a plugin config

type CesMetricExtraInfo

type CesMetricExtraInfo struct {
	OriginMetricName string `json:"origin_metric_name"`
	MetricPrefix     string `json:"metric_prefix,omitempty"`
	MetricType       string `json:"metric_type,omitempty"`
	CustomProcName   string `json:"custom_proc_name,omitempty"`
}

CesMetricExtraInfo ...

type ChProcessList

type ChProcessList []*ProcessInfo

ChProcessList used in channel

func GetTop5CpuProcessList

func GetTop5CpuProcessList() ChProcessList

GetTop5CpuProcessList get top5 cpu process list for channel

func (ChProcessList) String

func (c ChProcessList) String() string

type CustomMonitorPluginScheduler

type CustomMonitorPluginScheduler PluginScheduler

CustomMonitorPluginScheduler ...

func NewCustomMonitorPluginScheduler

func NewCustomMonitorPluginScheduler(p *config.EachPluginConfig) *CustomMonitorPluginScheduler

NewCustomMonitorPluginScheduler create a plugin scheduler by a plugin config

func (*CustomMonitorPluginScheduler) Schedule

func (ps *CustomMonitorPluginScheduler) Schedule(data chan CesMetricDataArr)

Schedule cron job for plugin collector

type DimensionType

type DimensionType struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

DimensionType the type for dimension

type EventPluginScheduler

type EventPluginScheduler PluginScheduler

EventPluginScheduler ...

func NewEventPluginScheduler

func NewEventPluginScheduler(p *config.EachPluginConfig) *EventPluginScheduler

NewEventPluginScheduler create a plugin scheduler by a plugin config

func (*EventPluginScheduler) Schedule

func (ps *EventPluginScheduler) Schedule(data chan CesEventDataArr)

Schedule cron job for plugin collector

type HashProcess

type HashProcess struct {
	ProcessHashID string      `json:"process_hashid"`
	Info          ProcessInfo `json:"info"`
}

HashProcess the type for hash process

type InputMetric

type InputMetric struct {
	CollectTime int64    `json:"collect_time"`
	Type        string   `json:"-"`
	Data        []Metric `json:"data"`
}

InputMetric the type for input metric

func BuildMetric

func BuildMetric(collectTime int64, data []Metric) *InputMetric

BuildMetric build metric as input metricpro

func PluginCmd

func PluginCmd(plugin *config.EachPluginConfig) *InputMetric

PluginCmd output the plugin metric data by a plugin config

type InputMetricSlice

type InputMetricSlice []*InputMetric

InputMetricSlice the type for input metric slice

type Metric

type Metric struct {
	MetricName     string  `json:"metric_name"`
	MetricValue    float64 `json:"metric_value"`
	MetricPrefix   string  `json:"metric_prefix,omitempty"`
	CustomProcName string  `json:"custom_proc_name,omitempty"`
}

Metric the type for metric data

type MetricType

type MetricType struct {
	Namespace       string              `json:"namespace"`
	Dimensions      []DimensionType     `json:"dimensions"`
	MetricName      string              `json:"metric_name"`
	MetricExtraInfo *CesMetricExtraInfo `json:"extra_info,omitempty"`
}

MetricType the type for metric

type PluginScheduler

type PluginScheduler struct {
	Ticker *time.Ticker
	Plugin *config.EachPluginConfig
}

PluginScheduler is the type for plugin scheduler

func NewPluginScheduler

func NewPluginScheduler(p *config.EachPluginConfig) *PluginScheduler

NewPluginScheduler create a plugin scheduler by a plugin config

func (*PluginScheduler) Schedule

func (ps *PluginScheduler) Schedule(data chan *InputMetric)

Schedule cron job for plugin collector

type ProcessInfo

type ProcessInfo struct {
	Pid        int32  `json:"pid"`
	Pname      string `json:"name"`
	Status     bool   `json:"status"`
	Cmdline    string `json:"cmdline"`
	CreateTime int64  `json:"create_time"`
}

ProcessInfo the type for process info

type ProcessInfoDB

type ProcessInfoDB struct {
	InstanceID string        `json:"instance_id"`
	Processes  []HashProcess `json:"processes"`
}

ProcessInfoDB the type for process info in request

func BuildProcessInfoByList

func BuildProcessInfoByList(processList ChProcessList) ProcessInfoDB

BuildProcessInfoByList used to build process info for api request

Jump to

Keyboard shortcuts

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