Documentation
¶
Index ¶
- Constants
- func ExtractPage(arrayObject interface{}, paging *Paging) interface{}
- func GetOrderByAndLimit(paging *Paging, dialect *OrderByDialect) string
- func GetSqlLimit(paging *Paging) string
- type AgentHeartbeatRequest
- type AgentPluginsResponse
- type AgentReportRequest
- type AgentUpdateInfo
- type BuiltinMetric
- type BuiltinMetricResponse
- type BuiltinMetricSlice
- type Config
- type Event
- func (this *Event) ActionId() int
- func (this *Event) Counter() string
- func (this *Event) ExpressionId() int
- func (this *Event) FormattedTime() string
- func (this *Event) Func() string
- func (this *Event) MaxStep() int
- func (this *Event) Metric() string
- func (this *Event) Note() string
- func (this *Event) Operator() string
- func (this *Event) Priority() int
- func (this *Event) RightValue() float64
- func (this *Event) StrategyId() int
- func (this *Event) String() string
- func (this *Event) Tpl() *Template
- func (this *Event) TplId() int
- type Expression
- type ExpressionResponse
- type FalconAgentHeartbeat
- type FalconAgentHeartbeatResult
- type GraphAccurateQueryParam
- type GraphAccurateQueryResponse
- type GraphDeleteParam
- type GraphDeleteResp
- type GraphFullyInfo
- type GraphInfoParam
- type GraphInfoResp
- type GraphItem
- type GraphLastParam
- type GraphLastResp
- type GraphLastRespList
- type GraphQueryParam
- type GraphQueryResponse
- type GraphQueryResponseList
- type HistoryData
- type Host
- type HostStrategy
- type JsonFloat
- type JsonMetaData
- type JudgeItem
- type MeasurementsProperty
- type MetaData
- type MetricValue
- type NewAgentPluginsResponse
- type NewBuiltinMetric
- type NewBuiltinMetricResponse
- type NewBuiltinMetricSlice
- type NewExpression
- type NewHostStrategy
- type NewStrategy
- type NewTemplate
- type NodataConfig
- type NodataItem
- type NqmAgent
- type NqmTarget
- type NqmTaskRequest
- type NqmTaskResponse
- type NullRpcRequest
- type OrderByDialect
- type OrderByEntity
- type Paging
- type RRDData
- type SimpleRpcResponse
- type StrategiesResponse
- type Strategy
- type Template
- type TransferResponse
- type TsdbItem
Constants ¶
const ( // Value of undefined id UNDEFINED_ID = -1 UNDEFINED_ISP_ID = int16(UNDEFINED_ID) UNDEFINED_PROVINCE_ID = int16(UNDEFINED_ID) UNDEFINED_CITY_ID = int16(UNDEFINED_ID) UNDEFINED_NAME_TAG_ID = int16(UNDEFINED_ID) // Value of undefined string UNDEFINED_STRING = "<UNDEFINED>" )
const ( DefaultDirection byte = 0 // Sorting by ascending Ascending byte = 1 // Sorting by descending Descending byte = 2 )
Deprecated: use utils instead
Variables ¶
This section is empty.
Functions ¶
func ExtractPage ¶
func ExtractPage(arrayObject interface{}, paging *Paging) interface{}
Extracts page from array or slice
This function would call Paging.SetTotalCount function on input paging
func GetOrderByAndLimit ¶
func GetOrderByAndLimit(paging *Paging, dialect *OrderByDialect) string
func GetSqlLimit ¶
Types ¶
type AgentHeartbeatRequest ¶
func (*AgentHeartbeatRequest) String ¶
func (this *AgentHeartbeatRequest) String() string
type AgentPluginsResponse ¶
type AgentPluginsResponse struct {
Plugins []string
Timestamp int64
GitRepo string
GitUpdate bool
GitRepoUpdate bool
}
func (*AgentPluginsResponse) String ¶
func (this *AgentPluginsResponse) String() string
type AgentReportRequest ¶
type AgentReportRequest struct {
Hostname string
IP string
AgentVersion string
PluginVersion string
GitRepo string
}
func (*AgentReportRequest) String ¶
func (this *AgentReportRequest) String() string
type AgentUpdateInfo ¶
type AgentUpdateInfo struct {
LastUpdate int64
ReportRequest *AgentReportRequest
}
type BuiltinMetric ¶
e.g. net.port.listen or proc.num
func (*BuiltinMetric) String ¶
func (this *BuiltinMetric) String() string
type BuiltinMetricResponse ¶
type BuiltinMetricResponse struct {
Metrics []*BuiltinMetric
Checksum string
Timestamp int64
}
func (*BuiltinMetricResponse) String ¶
func (this *BuiltinMetricResponse) String() string
type BuiltinMetricSlice ¶
type BuiltinMetricSlice []*BuiltinMetric
func (BuiltinMetricSlice) Len ¶
func (this BuiltinMetricSlice) Len() int
func (BuiltinMetricSlice) Less ¶
func (this BuiltinMetricSlice) Less(i, j int) bool
func (BuiltinMetricSlice) Swap ¶
func (this BuiltinMetricSlice) Swap(i, j int)
type Event ¶
type Event struct {
Id string `json:"id"`
Strategy *Strategy `json:"strategy"`
Expression *Expression `json:"expression"`
Status string `json:"status"` // OK or PROBLEM
Endpoint string `json:"endpoint"`
LeftValue float64 `json:"leftValue"`
CurrentStep int `json:"currentStep"`
PushedTags map[string]string `json:"pushedTags"`
EventTime int64 `json:"eventTime"`
SourceTimestamp int64 `json:"sourceTimestamp"`
}
机器监控和实例监控都会产生Event,共用这么一个struct
func (*Event) ExpressionId ¶
func (*Event) FormattedTime ¶
func (*Event) RightValue ¶
func (*Event) StrategyId ¶
type Expression ¶
type Expression struct {
Id int `json:"id"`
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
Func string `json:"func"` // e.g. max(#3) all(#3)
Operator string `json:"operator"` // e.g. < !=
RightValue float64 `json:"rightValue"` // critical value
MaxStep int `json:"maxStep"`
Priority int `json:"priority"`
Note string `json:"note"`
ActionId int `json:"actionId"`
}
func (*Expression) String ¶
func (this *Expression) String() string
type ExpressionResponse ¶
type ExpressionResponse struct {
Expressions []*Expression `json:"expressions"`
}
type FalconAgentHeartbeat ¶
type FalconAgentHeartbeatResult ¶
type FalconAgentHeartbeatResult struct {
RowsAffected int64 `json:"rows_affected"`
}
type GraphAccurateQueryParam ¶
type GraphAccurateQueryParam struct {
Checksum string `json:"checksum"`
Start int64 `json:"start"`
End int64 `json:"end"`
ConsolFun string `json:"consolFuc"`
DsType string `json:"dsType"`
Step int `json:"step"`
}
页面上已经可以看到DsType和Step了,直接带进查询条件,Graph更易处理
type GraphAccurateQueryResponse ¶
type GraphAccurateQueryResponse struct {
Values []*RRDData `json:"values"`
}
type GraphDeleteParam ¶
type GraphDeleteResp ¶
type GraphDeleteResp struct {
}
type GraphFullyInfo ¶
type GraphInfoParam ¶
type GraphInfoResp ¶
type GraphItem ¶
type GraphItem struct {
Endpoint string `json:"endpoint"`
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
Value float64 `json:"value"`
Timestamp int64 `json:"timestamp"`
DsType string `json:"dstype"`
Step int `json:"step"`
Heartbeat int `json:"heartbeat"`
Min string `json:"min"`
Max string `json:"max"`
}
DsType 即RRD中的Datasource的类型:GAUGE|COUNTER|DERIVE
func (*GraphItem) PrimaryKey ¶
type GraphLastParam ¶
type GraphLastResp ¶
type GraphLastRespList ¶
type GraphLastRespList struct {
List *[]GraphLastResp
}
type GraphQueryParam ¶
type GraphQueryParam struct {
Start int64 `json:"start"`
End int64 `json:"end"`
ConsolFun string `json:"consolFuc"`
Endpoint string `json:"endpoint"`
Counter string `json:"counter"`
Step int `json:"step"`
}
ConsolFun 是RRD中的概念,比如:MIN|MAX|AVERAGE
type GraphQueryResponse ¶
type GraphQueryResponseList ¶
type GraphQueryResponseList struct {
List *[]*GraphQueryResponse
}
type HistoryData ¶
type HostStrategy ¶
type HostStrategy struct {
Hostname string `json:"hostname"`
Strategies []Strategy `json:"strategies"`
}
func (*HostStrategy) String ¶
func (this *HostStrategy) String() string
type JsonMetaData ¶
type JsonMetaData struct {
Metric string `json:"metric"`
Endpoint string `json:"endpoint"`
Timestamp int64 `json:"timestamp"`
Step int64 `json:"step"`
Value interface{} `json:"value"`
CounterType string `json:"counterType"`
Tags string `json:"tags"`
}
Same As `MetricValue`
func (*JsonMetaData) String ¶
func (t *JsonMetaData) String() string
type JudgeItem ¶
type JudgeItem struct {
Endpoint string `json:"endpoint"`
Metric string `json:"metric"`
Value float64 `json:"value"`
JudgeType string `json:"judgeType"`
Tags map[string]string `json:"tags"`
Timestamp int64 `json:"timestamp"`
SourceTimestamp int64 `json:"source_timestamp"`
}
func (*JudgeItem) PrimaryKey ¶
type MeasurementsProperty ¶
type MetaData ¶
type MetricValue ¶
type MetricValue struct {
Endpoint string `json:"endpoint"`
Metric string `json:"metric"`
Value interface{} `json:"value"`
Step int64 `json:"step"`
Type string `json:"counterType"`
Tags string `json:"tags"`
Timestamp int64 `json:"timestamp"`
}
func (*MetricValue) String ¶
func (this *MetricValue) String() string
type NewAgentPluginsResponse ¶
type NewAgentPluginsResponse struct {
Plugins []string `json:"plugins"`
Timestamp int64 `json:"timestamp"`
GitRepo string `json:"git_repo" conform:"trim"`
}
func (*NewAgentPluginsResponse) String ¶
func (this *NewAgentPluginsResponse) String() string
type NewBuiltinMetric ¶
e.g. net.port.listen or proc.num
func (*NewBuiltinMetric) String ¶
func (this *NewBuiltinMetric) String() string
type NewBuiltinMetricResponse ¶
type NewBuiltinMetricResponse struct {
Metrics []*NewBuiltinMetric `json:"metrics"`
Checksum string `json:"checksum"`
Timestamp int64 `json:"timestamp"`
}
func (*NewBuiltinMetricResponse) String ¶
func (this *NewBuiltinMetricResponse) String() string
type NewBuiltinMetricSlice ¶
type NewBuiltinMetricSlice []*NewBuiltinMetric
func (NewBuiltinMetricSlice) Len ¶
func (this NewBuiltinMetricSlice) Len() int
func (NewBuiltinMetricSlice) Less ¶
func (this NewBuiltinMetricSlice) Less(i, j int) bool
func (NewBuiltinMetricSlice) Swap ¶
func (this NewBuiltinMetricSlice) Swap(i, j int)
type NewExpression ¶
type NewExpression struct {
ID int `json:"id"`
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
Func string `json:"func"` // e.g. max(#3) all(#3)
Operator string `json:"operator"` // e.g. < !=
RightValue float64 `json:"right_value"` // critical value
MaxStep int `json:"max_step"`
Priority int `json:"priority"`
Note string `json:"note"`
ActionID int `json:"action_id"`
}
func (NewExpression) String ¶
func (this NewExpression) String() string
type NewHostStrategy ¶
type NewHostStrategy struct {
Hostname string `json:"hostname"`
Strategies []*NewStrategy `json:"strategies"`
}
type NewStrategy ¶
type NewStrategy struct {
ID int `json:"id"`
Metric string `json:"metric"`
Tags map[string]string
TagsStr string `json:"tags"`
Func string `json:"func"` // e.g. max(#3) all(#3)
Operator string `json:"operator"` // e.g. < !=
RightValue float64 `json:"right_value,string"` // critical value
MaxStep int `json:"max_step"`
Priority int `json:"priority"`
Note string `json:"note"`
Tpl *NewTemplate `json:"tpl"`
}
func (*NewStrategy) AfterLoad ¶
func (s *NewStrategy) AfterLoad()
func (*NewStrategy) String ¶
func (this *NewStrategy) String() string
type NewTemplate ¶
type NewTemplate struct {
ID int `json:"id"`
Name string `json:"name"`
ParentID int `json:"parent_id"`
ActionID int `json:"action_id"`
Creator string `json:"creator"`
}
func (*NewTemplate) String ¶
func (this *NewTemplate) String() string
type NodataConfig ¶
type NodataConfig struct {
Id int `json:"id"`
Name string `json:"name"`
ObjType string `json:"objType"`
Endpoint string `json:"endpoint"`
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
Type string `json:"type"`
Step int64 `json:"step"`
Mock float64 `json:"mock"`
}
func NewNodataConfig ¶
func (*NodataConfig) String ¶
func (this *NodataConfig) String() string
type NodataItem ¶
type NodataItem struct {
Counter string `json:"counter"`
Ts int64 `json:"ts"`
FStatus string `json:"fstatus"`
FTs int64 `json:"fts"`
}
func (*NodataItem) String ¶
func (this *NodataItem) String() string
type NqmAgent ¶
type NqmAgent struct {
// The id of agent
Id int
// The name of agent
Name string
// The id of ISP, UNDEFINED_ID means there is not such data for this target
IspId int16
// The name of ISP
IspName string
// The id of province, UNDEFINED_ID means there is not such data for this target
ProvinceId int16
// The name of province
ProvinceName string
// The id of city, UNDEFINED_ID means there is not such data for this target
CityId int16
// The name of city
CityName string
NameTagId int16
// The id of group tags
GroupTagIds []int32
}
Represents the data of agent
type NqmTarget ¶
type NqmTarget struct {
// The id of target
Id int
// The IP address or FQDN used by ping command
Host string
// The id of ISP, UNDEFINED_ID means there is not such data for this target
IspId int16
// The name of ISP
IspName string
// The id of province, UNDEFINED_ID means there is not such data for this target
ProvinceId int16
// The name of province
ProvinceName string
// The id of city, UNDEFINED_ID means there is not such data for this target
CityId int16
// The name of city
CityName string
// The id of name tag
NameTagId int16
// The name tag of the target
NameTag string
// The id of group tags
GroupTagIds []int32
}
Represents the data of target used by NQM agent
type NqmTaskRequest ¶
type NqmTaskRequest struct {
// The connection id of agent(used to identify task configurations)
ConnectionId string `valid:"required"`
// The hostname of agent
Hostname string `valid:"required"`
// The IP address of agent
// Could be IPv4 or IPv6 format
IpAddress string `valid:"required"`
}
NqmTaskRequest represents the request for ping task by NQM agent
type NqmTaskResponse ¶
type NqmTaskResponse struct {
// Whether or not the task should be performed
NeedPing bool
// The data of agent
// nil if there is no need for ping
Agent *NqmAgent
// The list of target hosts to be probed(ping)
// nil if there is no need for ping
Targets []NqmTarget
// The command/arguments of command to be executed
// nil if there is no need for ping
Measurements map[string]MeasurementsProperty
}
NqmTaskResponse represents the response for ping task requested from NQM agent
If NeedPing is false, Targets and Command would be empty array
type NullRpcRequest ¶
type NullRpcRequest struct {
}
type OrderByDialect ¶
type OrderByDialect struct {
Separator string
PropertyMapping map[string]string
DirectionMapping map[byte]string
FuncEntityToSyntax func(*OrderByEntity) (string, error)
}
Dialect used to mapping property to column. And direction of sorting
func NewSqlOrderByDialect ¶
func NewSqlOrderByDialect(propertyMapping map[string]string) *OrderByDialect
Builds a dialect for default SQL language
DefaultDirection - nothing(by default value of database) Ascending - Omit "ASC" Descending - Omit "DESC"
func (*OrderByDialect) ToQuerySyntax ¶
func (dialect *OrderByDialect) ToQuerySyntax(entities []*OrderByEntity) (string, error)
Converts the entities of order to Query syntax
If some of mapping could be found, the returned error would be non-nil
type OrderByEntity ¶
type OrderByEntity struct {
// Could name of column, property or any user-defined text
Expr string
// See Asc/Desc constant
Direction byte
}
The order by
func (*OrderByEntity) String ¶
func (entity *OrderByEntity) String() string
type Paging ¶
type Paging struct {
Size int32
Position int32
TotalCount int32
PageMore bool
OrderBy []*OrderByEntity
}
The paging object used to hold information
func NewUndefinedPaging ¶
func NewUndefinedPaging() *Paging
Initialize the paging with default values
Paging.Size: -1 Paging.Position: -1 Paging.TotalCount: -1 Paging.PageMore: false
func (*Paging) SetTotalCount ¶
Sets the total count of data and set-up PageMore flag
type RRDData ¶
func NewRRDData ¶
type SimpleRpcResponse ¶
type SimpleRpcResponse struct {
Code int `json:"code"`
}
code == 0 => success code == 1 => bad request
func (*SimpleRpcResponse) String ¶
func (this *SimpleRpcResponse) String() string
type StrategiesResponse ¶
type StrategiesResponse struct {
HostStrategies []*HostStrategy `json:"hostStrategies"`
}
type Strategy ¶
type Strategy struct {
Id int `json:"id"`
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
Func string `json:"func"` // e.g. max(#3) all(#3)
Operator string `json:"operator"` // e.g. < !=
RightValue float64 `json:"rightValue"` // critical value
MaxStep int `json:"maxStep"`
Priority int `json:"priority"`
Note string `json:"note"`
Tpl *Template `json:"tpl"`
}
type Template ¶
type TransferResponse ¶
func (*TransferResponse) String ¶
func (this *TransferResponse) String() string