nqm

package
v3.12.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Validator = validator.New()

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Id                    int32   `gorm:"primary_key:true;column:ag_id"`
	Name                  *string `gorm:"column:ag_name"`
	ConnectionId          string  `gorm:"column:ag_connection_id"`
	Hostname              string  `gorm:"column:ag_hostname"`
	NumOfEnabledPingtasks int32   `gorm:"column:ag_num_of_enabled_pingtasks"`

	IpAddress net.IP `gorm:"column:ag_ip_address"`

	Status        bool             `gorm:"column:ag_status"`
	Comment       *string          `gorm:"column:ag_comment"`
	LastHeartBeat owlJson.JsonTime `gorm:"column:ag_last_heartbeat"`

	IspId   int16  `gorm:"column:isp_id"`
	IspName string `gorm:"column:isp_name"`

	ProvinceId   int16  `gorm:"column:pv_id"`
	ProvinceName string `gorm:"column:pv_name"`

	CityId   int16  `gorm:"column:ct_id"`
	CityName string `gorm:"column:ct_name"`

	NameTagId    int16  `gorm:"column:nt_id"`
	NameTagValue string `gorm:"column:nt_value"`

	IdsOfGroupTags   string `gorm:"column:gt_ids"`
	NamesOfGroupTags string `gorm:"column:gt_names"`
	GroupTags        []*owlModel.GroupTag
}

func (*Agent) AfterLoad

func (agentView *Agent) AfterLoad()

func (*Agent) MarshalJSON

func (agentView *Agent) MarshalJSON() ([]byte, error)

func (*Agent) String

func (agent *Agent) String() string

func (Agent) TableName

func (Agent) TableName() string

func (*Agent) ToAgentForAdding

func (agentView *Agent) ToAgentForAdding() *AgentForAdding

func (*Agent) ToSimpleJson

func (agentView *Agent) ToSimpleJson() *json.Json

type AgentFilter

type AgentFilter struct {
	Name         []string `json:"name" digest:"1"`
	Hostname     []string `json:"hostname" digest:"2"`
	IpAddress    []string `json:"ip_address" digest:"3"`
	ConnectionId []string `json:"connection_id" digest:"4"`
	IspIds       []int16  `json:"isp_ids" digest:"21"`
	ProvinceIds  []int16  `json:"province_ids" digest:"22"`
	CityIds      []int16  `json:"city_ids" digest:"23"`
	NameTagIds   []int16  `json:"name_tag_ids" digest:"24"`
	GroupTagIds  []int32  `json:"group_tag_ids" digest:"25"`
}

func (*AgentFilter) HasAgentDescriptive

func (f *AgentFilter) HasAgentDescriptive() bool

type AgentForAdding

type AgentForAdding struct {
	Id           int32   `json:"-"`
	Name         *string `json:"name" conform:"trimToNil"`
	Comment      *string `json:"comment" conform:"trimToNil"`
	ConnectionId string  `json:"connection_id" conform:"trim" validate:"min=1"`
	Status       bool    `json:"status"`

	Hostname  string `json:"hostname" conform:"trim" validate:"min=1"`
	IpAddress net.IP `json:"-"`

	IspId      int16 `json:"isp_id" validate:"nonZeroId"`
	ProvinceId int16 `json:"province_id" validate:"nonZeroId"`
	CityId     int16 `json:"city_id" validate:"nonZeroId"`

	NameTagId    int16   `json:"-"`
	NameTagValue *string `json:"name_tag" conform:"trim"`

	GroupTags []string `json:"group_tags" conform:"trim"`
}

func NewAgentForAdding

func NewAgentForAdding() *AgentForAdding

func (*AgentForAdding) AreGroupTagsSame

func (agent *AgentForAdding) AreGroupTagsSame(anotherAgent *AgentForAdding) bool

func (*AgentForAdding) GetIpAddressAsBytes

func (agent *AgentForAdding) GetIpAddressAsBytes() []byte

func (*AgentForAdding) GetIpAddressAsString

func (agent *AgentForAdding) GetIpAddressAsString() string

func (*AgentForAdding) UniqueGroupTags

func (agent *AgentForAdding) UniqueGroupTags()

type AgentPingListTarget

type AgentPingListTarget struct {
	Target
	AgentPingListTimeAccess time.Time        `gorm:"column:tg_apl_time_access"`
	ProbedTime              owlJson.JsonTime //`json:"probed_time"`
}

func (*AgentPingListTarget) MarshalJSON

func (target *AgentPingListTarget) MarshalJSON() ([]byte, error)

type AgentPingtask

type AgentPingtask struct {
	AgentID    int32
	PingtaskID int32
}

type AgentQuery

type AgentQuery struct {
	Name         string `mvc:"query[name]" conform:"trim"`
	ConnectionId string `mvc:"query[connection_id]" conform:"trim"`
	Hostname     string `mvc:"query[hostname]" conform:"trim"`
	IpAddress    string `mvc:"query[ip_address]" conform:"trim"`

	IspId         int16 `mvc:"query[isp_id]"`
	HasIspIdParam bool  `mvc:"query[?isp_id]"`

	Status         bool `mvc:"query[status]"`
	HasStatusParam bool `mvc:"query[?status]"`
}

The query conditions of agent

func (*AgentQuery) GetIpForLikeCondition

func (query *AgentQuery) GetIpForLikeCondition() []byte

Gets the []byte used to perform like in MySql

type AgentQueryWithPingTask

type AgentQueryWithPingTask struct {
	AgentQuery
	PingTaskId int32  `mvc:"param[pingtask_id]"`
	Applied    bool   `mvc:"query[applied]"`
	HasApplied string `mvc:"query[applied] default[!N!]"`
}

func (*AgentQueryWithPingTask) HasAppliedCondition

func (query *AgentQueryWithPingTask) HasAppliedCondition() bool

type AgentView

type AgentView struct {
	Id                    int32            `json:"id"`
	Name                  string           `json:"name"`
	ConnectionId          string           `json:"connection_id"`
	Hostname              string           `json:"hostname"`
	IpAddress             net.IP           `json:"ip_address"`
	Status                bool             `json:"status"`
	Comment               *string          `json:"comment"`
	LastHeartBeat         owlJson.JsonTime `json:"last_heartbeat_time"`
	NumOfEnabledPingtasks int32            `json:"num_of_enabled_pingtasks"`

	ISP       *ISP      `json:"isp"`
	Province  *Province `json:"province"`
	City      *City     `json:"city"`
	NameTag   *NameTag  `json:"name_tag"`
	GroupTags []int32   `json:"group_tags"`
}

func (AgentView) String

func (a AgentView) String() string

type AgentWithPingTask

type AgentWithPingTask struct {
	Agent
	ApplyingPingTask bool `gorm:"column:applying_ping_task"`
}

func (*AgentWithPingTask) MarshalJSON

func (a *AgentWithPingTask) MarshalJSON() ([]byte, error)

type CacheAgentPingListLog

type CacheAgentPingListLog struct {
	ApllAgId          int32     `gorm:"primary_key:true;column:apll_ag_id"`
	CachedRefreshTime time.Time `gorm:"column:apll_time_refresh"`
}

func (CacheAgentPingListLog) TableName

func (CacheAgentPingListLog) TableName() string

type City

type City struct {
	ID   int16  `json:"id"`
	Name string `json:"name"`
}

type ClearCacheView

type ClearCacheView struct {
	RowsAffected int8 `json:"rows_affected"`
}

type HeartbeatRequest

type HeartbeatRequest struct {
	// The connection id of the NQM agent
	ConnectionId string `json:"connection_id" binding:"required"`
	// The hostname of the machine running NQM agent
	Hostname string `json:"hostname" binding:"required"`
	// The IP address of the NQM agent. It supports both IPv4 and IPv6 format
	IpAddress owlJson.IP `json:"ip_address" binding:"required"`
	// The timestamp generated by hbs
	Timestamp owlJson.JsonTime `json:"timestamp" binding:"required"`
}

func (*HeartbeatRequest) Bind

func (r *HeartbeatRequest) Bind(c *gin.Context)

func (HeartbeatRequest) String

func (r HeartbeatRequest) String() string

type HeartbeatTarget

type HeartbeatTarget struct {
	ID   int32  `gorm:"column:apl_tg_id" json:"id"`
	Host string `gorm:"column:tg_host" json:"host"`

	IspID   int16  `gorm:"column:isp_id" json:"isp_id"`
	IspName string `gorm:"column:isp_name" json:"isp_name"`

	ProvinceID   int16  `gorm:"column:pv_id" json:"province_id"`
	ProvinceName string `gorm:"column:pv_name" json:"province_name"`

	CityID   int16  `gorm:"column:ct_id" json:"ct_id"`
	CityName string `gorm:"column:ct_name" json:"ct_name"`

	NameTagID int16  `gorm:"column:nt_id" json:"nt_id"`
	NameTag   string `gorm:"column:nt_value" json:"nt_value"`

	GroupTags   string  `gorm:"column:gts" json:"-"`
	GroupTagIDs []int32 `json:"gt_ids"`
}

HeartbeatTarget is for the target list in the response of heartbeat requests

func (*HeartbeatTarget) AfterLoad

func (t *HeartbeatTarget) AfterLoad()

func (*HeartbeatTarget) String

func (t *HeartbeatTarget) String() string

func (HeartbeatTarget) TableName

func (HeartbeatTarget) TableName() string

type ISP

type ISP struct {
	ID   int16  `json:"id"`
	Name string `json:"name"`
}

type Int32sGetter

type Int32sGetter interface {
	GetInt32s() []int32
}

type NameTag

type NameTag struct {
	ID    int16  `json:"id"`
	Value string `json:"value"`
}

type NqmAgent

type NqmAgent struct {
	Id        int
	IpAddress net.IP
	// contains filtered or unexported fields
}

Represents the model of NQM agent, which is only used in HBS

func NewNqmAgent

func NewNqmAgent(rpcNqmAgentReq *model.NqmTaskRequest) *NqmAgent

Constructs a new instance of NQM agent

func (*NqmAgent) ConnectionId

func (agent *NqmAgent) ConnectionId() string

Gets the value of connection id

func (*NqmAgent) Hostname

func (agent *NqmAgent) Hostname() string

Gets the value of hostname

type PingListLog

type PingListLog struct {
	NumberOfTargets int32     `db:"apll_number_of_targets"`
	AccessTime      time.Time `db:"apll_time_access"`
	RefreshTime     time.Time `db:"apll_time_refresh"`
}

func (*PingListLog) GetDurationOfLastAccess

func (l *PingListLog) GetDurationOfLastAccess(checkedTime time.Time) int64

type PingtaskFilter

type PingtaskFilter struct {
	IspFilters      []*commonOwlModel.IspOfPingtaskView      `json:"isps"`
	ProvinceFilters []*commonOwlModel.ProvinceOfPingtaskView `json:"provinces"`
	CityFilters     []*commonOwlModel.CityOfPingtaskView     `json:"cities"`
	NameTagFilters  []*commonOwlModel.NameTagOfPingtaskView  `json:"name_tags"`
	GroupTagFilters []*commonOwlModel.GroupTagOfPingtaskView `json:"group_tags"`
}

type PingtaskModify

type PingtaskModify struct {
	Period  int16                 `json:"period"`
	Name    *string               `json:"name" conform:"trimToNil"`
	Enable  bool                  `json:"enable"`
	Comment *string               `json:"comment" conform:"trimToNil"`
	Filter  *PingtaskModifyFilter `json:"filter"`
}

func (*PingtaskModify) Bind

func (p *PingtaskModify) Bind(c *gin.Context)

type PingtaskModifyFilter

type PingtaskModifyFilter struct {
	IspIds      []int16 `json:"ids_of_isp"`
	ProvinceIds []int16 `json:"ids_of_province"`
	CityIds     []int16 `json:"ids_of_city"`
	NameTagIds  []int16 `json:"ids_of_name_tag"`
	GroupTagIds []int32 `json:"ids_of_group_tag"`
}

type PingtaskQuery

type PingtaskQuery struct {
	Period             string `mvc:"query[period]"`
	Name               string `mvc:"query[name]"`
	Enable             string `mvc:"query[enable]"`
	Comment            string `mvc:"query[comment]"`
	NumOfEnabledAgents string `mvc:"query[num_of_enabled_agents]"`
}

The query parameters filtering pingtasks

type PingtaskView

type PingtaskView struct {
	ID                 int32   `gorm:"primary_key:true;column:pt_id" json:"id"`
	Period             int16   `gorm:"column:pt_period" json:"period"`
	Name               *string `gorm:"column:pt_name" json:"name"`
	Enable             bool    `gorm:"column:pt_enable" json:"enable"`
	Comment            *string `gorm:"column:pt_comment" json:"comment"`
	NumOfEnabledAgents int32   `gorm:"column:pt_num_of_enabled_agents" json:"num_of_enabled_agents"`

	IdsOfIspFilters  string `gorm:"column:pt_isp_filter_ids" json:"-"`
	NamesOfIspFilter string `gorm:"column:pt_isp_filter_names" json:"-"`

	IdsOfProvinceFilters  string `gorm:"column:pt_province_filter_ids" json:"-"`
	NamesOfProvinceFilter string `gorm:"column:pt_province_filter_names" json:"-"`

	IdsOfCityFilters  string `gorm:"column:pt_city_filter_ids" json:"-"`
	NamesOfCityFilter string `gorm:"column:pt_city_filter_names" json:"-"`

	IdsOfNameTagFilters  string `gorm:"column:pt_name_tag_filter_ids" json:"-"`
	NamesOfNameTagFilter string `gorm:"column:pt_name_tag_filter_values" json:"-"`

	IdsOfGroupTagFilters  string `gorm:"column:pt_group_tag_filter_ids" json:"-"`
	NamesOfGroupTagFilter string `gorm:"column:pt_group_tag_filter_names" json:"-"`

	Filter PingtaskFilter `json:"filter"`
}

func (*PingtaskView) AfterLoad

func (p *PingtaskView) AfterLoad()

func (PingtaskView) TableName

func (PingtaskView) TableName() string

type Province

type Province struct {
	ID   int16  `json:"id"`
	Name string `json:"name"`
}

type SimpleAgent1

type SimpleAgent1 struct {
	Id        int32   `json:"id" db:"ag_id"`
	Name      *string `json:"name" db:"ag_name"`
	Hostname  string  `json:"hostname" db:"ag_hostname"`
	IpAddress net.IP  `json:"ip_address" db:"ag_ip_address"`

	IspId      int16 `json:"isp_id" db:"ag_isp_id"`
	ProvinceId int16 `json:"province_id" db:"ag_pv_id"`
	CityId     int16 `json:"city_id" db:"ag_ct_id"`
	NameTagId  int16 `json:"name_tag_id" db:"ag_nt_id"`
}

type SimpleAgent1InCity

type SimpleAgent1InCity struct {
	City   *owlModel.City2 `json:"city"`
	Agents []*SimpleAgent1 `json:"agents"`
}

type SimpleAgent1s

type SimpleAgent1s []*SimpleAgent1

func (SimpleAgent1s) GetInt32s

func (as SimpleAgent1s) GetInt32s() []int32

type SimpleTarget1

type SimpleTarget1 struct {
	Id   int32  `json:"id" db:"tg_id"`
	Name string `json:"name" db:"tg_name"`
	Host string `json:"host" db:"tg_host"`

	IspId      int16 `json:"isp_id" db:"tg_isp_id"`
	ProvinceId int16 `json:"province_id" db:"tg_pv_id"`
	CityId     int16 `json:"city_id" db:"tg_ct_id"`
	NameTagId  int16 `json:"name_tag_id" db:"tg_nt_id"`
}

type SimpleTarget1s

type SimpleTarget1s []*SimpleTarget1

func (SimpleTarget1s) GetInt32s

func (as SimpleTarget1s) GetInt32s() []int32

type Target

type Target struct {
	Id           int32      `gorm:"primary_key:true;column:tg_id"`
	Name         string     `gorm:"column:tg_name"`
	Host         string     `gorm:"column:tg_host"`
	ProbedByAll  bool       `gorm:"column:tg_probed_by_all"`
	Status       bool       `gorm:"column:tg_status"`
	Available    bool       `gorm:"column:tg_available"`
	Comment      *string    `gorm:"column:tg_comment"`
	CreationTime *time.Time `gorm:"column:tg_created_ts"`

	IspId   int16  `gorm:"column:isp_id"`
	IspName string `gorm:"column:isp_name"`

	ProvinceId   int16  `gorm:"column:pv_id"`
	ProvinceName string `gorm:"column:pv_name"`

	CityId   int16  `gorm:"column:ct_id"`
	CityName string `gorm:"column:ct_name"`

	NameTagId    int16  `gorm:"column:nt_id"`
	NameTagValue string `gorm:"column:nt_value"`

	IdsOfGroupTags   string `gorm:"column:gt_ids"`
	NamesOfGroupTags string `gorm:"column:gt_names"`
	GroupTags        []*owlModel.GroupTag
}

func (*Target) AfterLoad

func (target *Target) AfterLoad()

func (*Target) MarshalJSON

func (target *Target) MarshalJSON() ([]byte, error)

func (*Target) String

func (target *Target) String() string

func (Target) TableName

func (Target) TableName() string

func (*Target) ToTargetForAdding

func (target *Target) ToTargetForAdding() *TargetForAdding

type TargetFilter

type TargetFilter struct {
	Name        []string `json:"name" digest:"1"`
	Host        []string `json:"host" digest:"2"`
	IspIds      []int16  `json:"isp_ids" digest:"21"`
	ProvinceIds []int16  `json:"province_ids" digest:"22"`
	CityIds     []int16  `json:"city_ids" digest:"23"`
	NameTagIds  []int16  `json:"name_tag_ids" digest:"24"`
	GroupTagIds []int32  `json:"group_tag_ids" digest:"25"`
}

func (*TargetFilter) HasTargetDescriptive

func (f *TargetFilter) HasTargetDescriptive() bool

type TargetForAdding

type TargetForAdding struct {
	Id          int32   `json:"-"`
	Name        string  `json:"name" conform:"trim" validate:"min=1"`
	Host        string  `json:"host" conform:"trim" validate:"min=1"`
	ProbedByAll bool    `json:"probed_by_all"`
	Status      bool    `json:"status"`
	Comment     *string `json:"comment" conform:"trimToNil"`

	IspId      int16 `json:"isp_id" validate:"nonZeroId"`
	ProvinceId int16 `json:"province_id" validate:"nonZeroId"`
	CityId     int16 `json:"city_id" validate:"nonZeroId"`

	NameTagId    int16    `json:"-"`
	NameTagValue *string  `json:"name_tag" conform:"trim"`
	GroupTags    []string `json:"group_tags" conform:"trim"`
}

func NewTargetForAdding

func NewTargetForAdding() *TargetForAdding

func (*TargetForAdding) AreGroupTagsSame

func (target *TargetForAdding) AreGroupTagsSame(anotherTarget *TargetForAdding) bool

func (*TargetForAdding) UniqueGroupTags

func (target *TargetForAdding) UniqueGroupTags()

type TargetQuery

type TargetQuery struct {
	Name string `mvc:"query[name]"`
	Host string `mvc:"query[host]"`

	IspId         int16 `mvc:"query[isp_id]"`
	HasIspIdParam bool  `mvc:"query[?isp_id]"`

	Status         bool `mvc:"query[status]"`
	HasStatusParam bool `mvc:"query[?status]"`
}

The query conditions of target

type TargetsOfAgent

type TargetsOfAgent struct {
	CacheRefreshTime owlJson.JsonTime       `json:"cache_refresh_time"`
	CacheLifeTime    int                    `json:"cache_lifetime"`
	Targets          []*AgentPingListTarget `json:"targets"`
}

type TargetsOfAgentQuery

type TargetsOfAgentQuery struct {
	AgentID     int32 `mvc:"param[agent_id]"`
	TargetQuery *TargetQuery
}

Jump to

Keyboard shortcuts

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