logics

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const INVALIDID uint64 = 0

INVALIDID invalid id used as return value

View Source
const Netdevicebeat = "netdevicebeat"

Netdevicebeat netdevicebeat collector name

Variables

This section is empty.

Functions

This section is empty.

Types

type Custom

type Custom struct {
	DeviceModel string `yaml:"device_model,omitempty"`
	ObjectID    string `yaml:"bk_obj_id,omitempty"`
	BkVendor    string `yaml:"bk_vendor,omitempty"`
	PropertyID  string `json:"bk_property_id" bson:"bk_property_id,omitempty"`

	Method string `yaml:"method,omitempty"`
	Period string `yaml:"period,omitempty"`
	OID    string `yaml:"oid,omitempty"`
}

type Logics

type Logics struct {
	*backbone.Engine

	ESB esbserver.EsbClientInterface
	// contains filtered or unexported fields
}

Logics framwork need

func NewLogics

func NewLogics(ctx context.Context, engine *backbone.Engine, mgoCli dal.RDB, esb esbserver.EsbClientInterface) *Logics

func (*Logics) AddDevice

func (lgc *Logics) AddDevice(header http.Header, deviceInfo meta.NetcollectDevice) (meta.AddDeviceResult, error)

AddDevice create new net device

func (*Logics) AddProperty

func (lgc *Logics) AddProperty(
	pHeader http.Header, propertyInfo meta.NetcollectProperty) (meta.AddNetPropertyResult, error)

AddProperty create new net property

func (*Logics) BatchCreateDevice

func (lgc *Logics) BatchCreateDevice(pHeader http.Header, deviceInfoList []meta.NetcollectDevice) ([]meta.BatchAddDeviceResult, bool)

BatchCreateDevice batch create or update net devices

func (*Logics) BatchCreateProperty

func (lgc *Logics) BatchCreateProperty(
	pHeader http.Header, propertyInfoList []meta.NetcollectProperty) ([]meta.BatchAddNetPropertyResult, bool)

BatchCreateProperty bacth create or update net propertys

func (*Logics) ConfirmReport

func (lgc *Logics) ConfirmReport(header http.Header, reports []metadata.NetcollectReport) *metadata.RspNetcollectConfirm

func (*Logics) ConvertStringToID

func (lgc *Logics) ConvertStringToID(stringID string) (int64, error)

ConvertStringToID check param ID is a num string and convert to num

func (*Logics) DeleteDevice

func (lgc *Logics) DeleteDevice(pHeader http.Header, netDeviceID uint64) error

func (*Logics) DeleteProperty

func (lgc *Logics) DeleteProperty(pHeader http.Header, netPropertyID uint64) error

func (*Logics) DiscoverNetDevice

func (lgc *Logics) DiscoverNetDevice(header http.Header, configs []metadata.Netcollector) error

func (*Logics) SearchCollector

func (lgc *Logics) SearchCollector(header http.Header, cond metadata.ParamNetcollectorSearch) (int64, []metadata.Netcollector, error)

func (*Logics) SearchDevice

func (lgc *Logics) SearchDevice(pHeader http.Header, params *meta.NetCollSearchParams) (meta.SearchNetDevice, error)

SearchDevice get net devices by conditions

func (*Logics) SearchHistory

func (*Logics) SearchProperty

func (lgc *Logics) SearchProperty(pHeader http.Header, params *meta.NetCollSearchParams) (*meta.SearchNetProperty, error)

SearchProperty get net devices by conditions

func (*Logics) SearchReport

func (*Logics) SearchReportSummary

func (lgc *Logics) SearchReportSummary(header http.Header, param metadata.ParamSearchNetcollectReport) ([]*metadata.NetcollectReportSummary, error)

func (*Logics) UpdateCollector

func (lgc *Logics) UpdateCollector(header http.Header, config metadata.Netcollector) error

func (*Logics) UpdateDevice

func (lgc *Logics) UpdateDevice(pHeader http.Header, netDeviceID uint64, deviceInfo meta.NetcollectDevice) error

func (*Logics) UpdateProperty

func (lgc *Logics) UpdateProperty(pHeader http.Header, netPropertyID uint64, netPropertyInfo meta.NetcollectProperty) error

type NetDeviceConfig

type NetDeviceConfig struct {
	DataID      int64      `yaml:"dataid,omitempty"`
	CloudID     int64      `yaml:"bk_cloud_id,omitempty"`
	OwnerID     string     `yaml:"bk_supplier_account"`
	ScanRange   []string   `yaml:"scan_range,omitempty"`
	Snmp        SnmpConfig `yaml:"snmp,omitempty"`
	PingTimeout int        `yaml:"ping_timeout,omitempty"`
	PingRetry   int        `yaml:"ping_retry,omitempty"`
	Worker      int        `yaml:"worker,omitempty"`
	Period      string     `yaml:"period,omitempty"`
	Customs     []Custom   `yaml:"customs,omitempty"`
	Report      Report     `yaml:"report,omitempty"`
}

type Report

type Report struct {
	Debug bool `yaml:"debug,omitempty"`
}

type SnmpConfig

type SnmpConfig struct {
	// Target is an ipv4 address
	Target string `yaml:"target,omitempty"`
	// Port is a udp port
	Port int `yaml:"port,omitempty"`
	// Community is an SNMP Community string
	Community string `yaml:"community,omitempty"`
	// Version is an SNMP Version
	Version Version `yaml:"version,omitempty"`
	// Timeout is the timeout for the SNMP Query
	Timeout int `yaml:"timeout,omitempty"`
	// Set the number of retries to attempt within timeout.
	Retries int `yaml:"retries,omitempty"`
	// MaxOids is the maximum number of oids allowed in a Get()
	// (default: 10)
	MaxOids int `yaml:"max_oids,omitempty"`
}

SnmpConfig snmp config

type Version

type Version string
const (
	Version1  Version = "SNMPv1"
	Version2c Version = "SNMPv2c"
	Version3  Version = "SNMPv3"
)

SnmpVersion constant

Jump to

Keyboard shortcuts

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