Documentation
¶
Index ¶
- Constants
- func DictedTagstring(s string) map[string]string
- func GetCounter(metric, tag string, tagMap map[string]string) (counter string, err error)
- func HasReservedWords(str string) bool
- func NidToEndpoint(nid string) string
- func PKWhitEndpointAndTags(endpoint, metric, tags string) string
- func PKWithCounter(endpoint, counter string) string
- func PKWithTags(metric, tags string) string
- func SortedTags(tags map[string]string) string
- func SplitTagsString(s string) (tags map[string]string, err error)
- type AggrCalc
- type AggrCalcStra
- type AggrList
- type AggrOut
- type AggrTagsFilter
- type AssignTask
- type Auth
- type BuiltinMetric
- type BuiltinMetricRequest
- type BuiltinMetricResponse
- type BuiltinMetricSlice
- type CentralAggrV2Point
- type CludeRecv
- type EndpointMetricRecv
- type EndpointsRecv
- type Event
- type File
- type History
- type HistoryData
- type IPAndSnmp
- type IPAndSnmpRpcResp
- type IfTags
- type Index
- type IndexByFullTagsRecv
- type IndexByFullTagsResp
- type IndexModel
- type IndexResp
- type IndexTagkvResp
- type InfluxdbItem
- type JsonFloat
- type JudgeItem
- type Lookup
- type Message
- type Metric
- type MetricResp
- type MetricValue
- type Notify
- type NullRpcRequest
- type OpenTsdbItem
- type QueryData
- type QueryDataForUI
- type QueryDataForUIResp
- type QueryDataResp
- type RRDData
- type RRDFile
- type RRDFileQuery
- type RRDFileResp
- type RRDValues
- type RawMetric
- type RawMetricAggrCalc
- type Regexp
- type RegexpExtract
- type ReportRequest
- type ReportResponse
- type ReportTask
- type Secret
- type SimpleRpcResponse
- type TagPair
- type TaskMetaResponse
- type TransferResp
- type TsdbItem
- type TsdbQueryParam
- type TsdbQueryResponse
- type XcludeResp
Constants ¶
View Source
const ( GAUGE = "GAUGE" COUNTER = "COUNTER" SUBTRACT = "SUBTRACT" DERIVE = "DERIVE" SPLIT = "/" )
View Source
const ( MachineDep = 1 MachineIndep = 2 )
View Source
const (
COMMON_MODULE = "common"
)
View Source
const GRAPH = 1
Variables ¶
This section is empty.
Functions ¶
func DictedTagstring ¶
func GetCounter ¶
func HasReservedWords ¶
func NidToEndpoint ¶
func PKWhitEndpointAndTags ¶
func PKWithCounter ¶
func PKWithTags ¶
func SortedTags ¶
Types ¶
type AggrCalc ¶
type AggrCalc struct {
Id int64 `xorm:"id pk autoincr" json:"id"`
Nid int64 `xorm:"nid" json:"nid"`
Category int `xorm:"category" json:"category"`
NewMetric string `xorm:"new_metric" json:"new_metric"`
NewStep int `xorm:"new_step" json:"new_step"`
GroupByString string `xorm:"groupby" json:"-"`
RawMetricsString string `xorm:"raw_metrics" json:"-"`
GlobalOperator string `xorm:"global_operator"json:"global_operator"` //指标聚合方式
Expression string `xorm:"expression" json:"expression"`
RPN string `xorm:"rpn" json:"rpn"`
Status int `xorm:"status" json:"-"`
Quota int `xorm:"quota" json:"quota"`
Comment string `xorm:"comment" json:"comment"`
Creator string `xorm:"creator" json:"creator"`
Created time.Time `xorm:"created" json:"created"`
LastUpdator string `xorm:"last_updator" json:"last_updator"`
LastUpdated time.Time `xorm:"<-" json:"last_updated"`
RawMetrics []*RawMetric `xorm:"-" json:"raw_metrics"`
GroupBy []string `xorm:"-" json:"groupby"`
}
type AggrCalcStra ¶
type AggrCalcStra struct {
SID int64 `json:"sid"`
NID string `json:"nid"`
ResultStep int `json:"step"`
RawStep int `json:"rawStep"`
GroupKey string `json:"key"`
GlobalOperator string `json:"global"`
InnerOperator string `json:"inner"`
VarID string `json:"varID"`
VarNum int `json:"varNum"`
RPN string `json:"RPN"`
Lateness int `json:"lateness"`
}
type AggrList ¶
type AggrList struct {
Data []*CentralAggrV2Point `json:"data"`
}
type AggrOut ¶
type AggrOut struct {
Index string `json:"index"`
Operate int `json:"operate"`
Data struct {
Nid string `json:"nid"`
Step int64 `json:"step"`
GroupTag string `json:"groupTag"`
Value interface{} `json:"value"`
Sid int64 `json:"sid"`
Timestamp int64 `json:"timestamp"`
} `json:"data"`
Type string `json:"type"`
}
type AggrTagsFilter ¶
type AssignTask ¶
type Auth ¶
type Auth struct {
Community Secret `json:"community,omitempty"`
SecurityLevel string `json:"security_level,omitempty"`
Username string `json:"username,omitempty"`
Password Secret `json:"password,omitempty"`
AuthProtocol string `json:"auth_protocol,omitempty"`
PrivProtocol string `json:"priv_protocol,omitempty"`
PrivPassword Secret `json:"priv_password,omitempty"`
ContextName string `json:"context_name,omitempty"`
}
type BuiltinMetric ¶
e.g. tcp.port.listen or proc.num
func (*BuiltinMetric) String ¶
func (bm *BuiltinMetric) String() string
type BuiltinMetricRequest ¶
type BuiltinMetricResponse ¶
type BuiltinMetricResponse struct {
Metrics []*BuiltinMetric
Checksum string
Timestamp int64
ErrCode int
}
func (*BuiltinMetricResponse) String ¶
func (br *BuiltinMetricResponse) String() string
type BuiltinMetricSlice ¶
type BuiltinMetricSlice []*BuiltinMetric
func (BuiltinMetricSlice) Len ¶
func (bm BuiltinMetricSlice) Len() int
func (BuiltinMetricSlice) Less ¶
func (bm BuiltinMetricSlice) Less(i, j int) bool
func (BuiltinMetricSlice) Swap ¶
func (bm BuiltinMetricSlice) Swap(i, j int)
type CentralAggrV2Point ¶
type CentralAggrV2Point struct {
Timestamp int64 `json:"t"`
Value float64 `json:"v"`
Strategys []*AggrCalcStra `json:"s"`
Hash uint64 `json:"h"`
}
type CludeRecv ¶
type CludeRecv struct {
Endpoints []string `json:"endpoints"`
Nids []string `json:"nids"`
Metric string `json:"metric"`
Include []*TagPair `json:"include"`
Exclude []*TagPair `json:"exclude"`
Start int64 `json:"start" description:"inclusive"`
End int64 `json:"end" description:"exclusive"`
StartInclusive time.Time `json:"-"`
EndExclusive time.Time `json:"-"`
}
type EndpointMetricRecv ¶
type EndpointMetricRecv struct {
Endpoints []string `json:"endpoints"`
Nids []string `json:"nids"`
Metrics []string `json:"metrics"`
Start int64 `json:"start" description:"inclusive"`
End int64 `json:"end" description:"exclusive"`
StartInclusive time.Time `json:"-"`
EndExclusive time.Time `json:"-"`
}
func (*EndpointMetricRecv) Validate ¶
func (p *EndpointMetricRecv) Validate() (err error)
type EndpointsRecv ¶
type EndpointsRecv struct {
Endpoints []string `json:"endpoints"`
Nids []string `json:"nids"`
Start int64 `json:"start" description:"inclusive"`
End int64 `json:"end" description:"exclusive"`
StartInclusive time.Time `json:"-"`
EndExclusive time.Time `json:"-"`
}
func (*EndpointsRecv) Validate ¶
func (p *EndpointsRecv) Validate() (err error)
type Event ¶
type Event struct {
ID string `json:"-"`
Sid int64 `json:"sid"`
EventType string `json:"event_type"` // alert/recover
Hashid uint64 `json:"hashid"` // 全局唯一 根据counter计算
Etime int64 `json:"etime"`
Endpoint string `json:"endpoint"`
History []History `json:"-"`
Detail string `json:"detail"`
Info string `json:"info"`
Value string `json:"value"`
Partition string `json:"-"`
CurNid string `json:"cur_nid"`
}
Event 传递到alarm的结构体, 尽可能少的字段, 发出通知需要的信息由alarm自己补全
type HistoryData ¶
type HistoryData struct {
Timestamp int64 `json:"timestamp"`
Value JsonFloat `json:"value"`
Extra string `json:"extra"`
}
func RRDData2HistoryData ¶
func RRDData2HistoryData(datas []*RRDData) []*HistoryData
type IPAndSnmp ¶
type IPAndSnmp struct {
IP string `json:"ip"`
Module string `json:"module"`
Version string `json:"version"`
Auth string `json:"auth"`
Region string `json:"region"`
Step int `json:"step"`
Timeout int `json:"timeout"`
Port int `json:"port"`
Metric Metric `json:"metric"`
LastUpdated time.Time `json:"last_updated"`
}
type IPAndSnmpRpcResp ¶
type IndexByFullTagsRecv ¶
type IndexByFullTagsRecv struct {
Endpoints []string `json:"endpoints"`
Nids []string `json:"nids"`
Metric string `json:"metric"`
Tagkv []TagPair `json:"tagkv"`
Start int64 `json:"start" description:"inclusive"`
End int64 `json:"end" description:"exclusive"`
StartInclusive time.Time `json:"-"`
EndExclusive time.Time `json:"-"`
}
func (*IndexByFullTagsRecv) Validate ¶
func (p *IndexByFullTagsRecv) Validate() (err error)
type IndexByFullTagsResp ¶
type IndexModel ¶
type IndexTagkvResp ¶
type InfluxdbItem ¶
type JudgeItem ¶
type JudgeItem struct {
Nid string `json:"nid"`
Endpoint string `json:"endpoint"`
Metric string `json:"metric"`
Tags string `json:"tags"`
TagsMap map[string]string `json:"tagsMap"`
Value float64 `json:"value"`
Timestamp int64 `json:"timestamp"`
DsType string `json:"dstype"`
Step int `json:"step"`
Sid int64 `json:"sid"`
Extra string `json:"extra"`
}
func (*JudgeItem) PrimaryKey ¶
type Metric ¶
type Metric struct {
Name string `yaml:"name" json:"name"`
Oid string `yaml:"oid" json:"oid"`
Type string `yaml:"type" json:"type"`
Help string `yaml:"help" json:"help"`
Indexes []*Index `yaml:"indexes" json:"indexes,omitempty"`
Lookups []*Lookup `yaml:"lookups" json:"lookups,omitempty"`
RegexpExtracts map[string][]RegexpExtract `yaml:"regex_extracts" json:"regex_extracts,omitempty"`
EnumValues map[int]string `yaml:"enum_values" json:"enum_values,omitempty"`
}
type MetricResp ¶
type MetricResp struct {
Metrics []string `json:"metrics"`
}
type MetricValue ¶
type MetricValue struct {
Nid string `json:"nid"`
Metric string `json:"metric"`
Endpoint string `json:"endpoint"`
Timestamp int64 `json:"timestamp"`
Step int64 `json:"step"`
ValueUntyped interface{} `json:"value"`
Value float64 `json:"-"`
CounterType string `json:"counterType"` // GAUGE | COUNTER | SUBTRACT | DERIVE
Tags string `json:"tags"` // a=1,b=2,c=3
TagsMap map[string]string `json:"tagsMap"` // {"a":1, "b"=2, "c="3} 保留2种格式,方便后端组件使用
Extra string `json:"extra"`
}
func (*MetricValue) CheckValidity ¶
func (m *MetricValue) CheckValidity(now int64) (err error)
func (*MetricValue) PK ¶
func (m *MetricValue) PK() string
type NullRpcRequest ¶
type NullRpcRequest struct {
}
type OpenTsdbItem ¶
type OpenTsdbItem struct {
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
Value float64 `json:"value"`
Timestamp int64 `json:"timestamp"`
}
func (*OpenTsdbItem) OpenTsdbString ¶
func (t *OpenTsdbItem) OpenTsdbString() (s string)
func (*OpenTsdbItem) String ¶
func (t *OpenTsdbItem) String() string
type QueryData ¶
type QueryDataForUI ¶
type QueryDataForUI struct {
Start int64 `json:"start"`
End int64 `json:"end"`
Metric string `json:"metric"`
Endpoints []string `json:"endpoints"`
Nids []string `json:"nids"`
Tags []string `json:"tags"`
Step int `json:"step"`
DsType string `json:"dstype"`
GroupKey []string `json:"groupKey"` //聚合维度
AggrFunc string `json:"aggrFunc" description:"sum,avg,max,min"` //聚合计算
ConsolFunc string `json:"consolFunc" description:"AVERAGE,MIN,MAX,LAST"`
Comparisons []int64 `json:"comparisons"` //环比多少时间
}
type QueryDataForUIResp ¶
type QueryDataResp ¶
type QueryDataResp struct {
Data []*TsdbQueryResponse
Msg string
}
type RRDData ¶
func HistoryData2RRDData ¶
func HistoryData2RRDData(datas []*HistoryData) []*RRDData
func NewRRDData ¶
type RRDFileQuery ¶
type RRDFileQuery struct {
Files []RRDFile
}
type RRDFileResp ¶
type RawMetricAggrCalc ¶
type RawMetricAggrCalc struct {
Sid int64 `json:"sid"`
Nid int64 `json:"nid"`
NewMetric string `json:"newMetric"`
NewStep int `json:"newStep"`
GroupBy []string `json:"groupBy"`
GlobalOperator string `json:"globalOperator"`
InnerOperator string `json:"innerOperator"`
VarID string `json:"varID"`
VarNum int `json:"varNum"`
SourceNid int64 `json:"source_nid"`
SourceMetric string `json:"sourceMetric"`
RPN string `json:"RPN"`
TagFilters []*AggrTagsFilter `json:"tagFilters"`
Lateness int `json:"lateness"`
}
type RegexpExtract ¶
type ReportRequest ¶
type ReportRequest struct {
Ident string
ReportTasks []ReportTask
}
type ReportResponse ¶
type ReportResponse struct {
Message string
AssignTasks []AssignTask
}
type ReportTask ¶
type SimpleRpcResponse ¶
type SimpleRpcResponse struct {
Code int `json:"code"`
}
code == 0 => success code == 1 => bad request
type TaskMetaResponse ¶
type TransferResp ¶
func (*TransferResp) String ¶
func (t *TransferResp) String() string
type TsdbItem ¶
type TsdbItem struct {
Nid string `json:"nid"`
Endpoint string `json:"endpoint"`
Metric string `json:"metric"`
Tags string `json:"tags"`
TagsMap map[string]string `json:"tagsMap"`
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"`
From int `json:"from"`
}
func (*TsdbItem) PrimaryKey ¶
type TsdbQueryParam ¶
type TsdbQueryParam struct {
Start int64 `json:"start"`
End int64 `json:"end"`
ConsolFunc string `json:"consolFunc"`
Nid string `json:"nid"`
Endpoint string `json:"endpoint"`
Counter string `json:"counter"`
Step int `json:"step"`
DsType string `json:"dsType"`
}
ConsolFunc 是RRD中的概念,比如:MIN|MAX|AVERAGE
func (*TsdbQueryParam) PK ¶
func (g *TsdbQueryParam) PK() string
type TsdbQueryResponse ¶
type TsdbQueryResponse struct {
Start int64 `json:"start"`
End int64 `json:"end"`
Endpoint string `json:"endpoint"`
Nid string `json:"nid"`
Counter string `json:"counter"`
DsType string `json:"dstype"`
Step int `json:"step"`
Values []*RRDData `json:"values"`
}
func (*TsdbQueryResponse) Key ¶
func (resp *TsdbQueryResponse) Key() string
Click to show internal directories.
Click to hide internal directories.