monitor

package
v0.0.0-...-9e37d8c Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServiceHub = ServiceInfo{
		ID:          "Elkeid-Service-01",
		Name:        "HUB",
		Description: "Elkeid High Performance Data Processing Engine",
	}
	ServiceLeader = ServiceInfo{
		ID:          "Elkeid-Service-02",
		Name:        "Leader",
		Description: "Elkeid Hub Control Pane",
	}
	ServiceManager = ServiceInfo{
		ID:          "Elkeid-Service-03",
		Name:        "Manager",
		Description: "Elkeid Manager for agent and service",
	}
	ServiceAC = ServiceInfo{
		ID:          "Elkeid-Service-04",
		Name:        "Access",
		Description: "this is access",
	}
	ServiceSD = ServiceInfo{
		ID:          "Elkeid-Service-05",
		Name:        "ServiceDiscovery",
		Description: "this is service discovery",
	}
	ServiceMongodb = ServiceInfo{
		ID:          "Elkeid-Service-11",
		Name:        "MongoDB",
		Description: "this is mongodb",
	}
	ServiceKafka = ServiceInfo{
		ID:          "Elkeid-Service-12",
		Name:        "Kafka",
		Description: "this is kafka",
	}
	ServiceRedis = ServiceInfo{
		ID:          "Elkeid-Service-13",
		Name:        "Redis",
		Description: "this is redis",
	}
	ServiceES = ServiceInfo{
		ID:          "Elkeid-Service-14",
		Name:        "ElasticSearch",
		Description: "this is elastic search",
	}
)

Functions

func GetAllHubAddress

func GetAllHubAddress() []string

func GetAllLeaderAddress

func GetAllLeaderAddress() []string

func GetAllManagerAddress

func GetAllManagerAddress() []string

func GetFirstHubAddress

func GetFirstHubAddress() string

func GetFirstLeaderAddress

func GetFirstLeaderAddress() string

func GetServiceAllAddress

func GetServiceAllAddress(service string) []string

func InitByConfigFile

func InitByConfigFile(filePath string)

func InitConfig

func InitConfig()

func InitReport

func InitReport()

Types

type BasicMessage

type BasicMessage struct {
	Uid             string    `json:"uid"`
	Email           string    `json:"email"`
	ElkeidupVersion string    `json:"elkeidup_version"`
	DeployAt        time.Time `json:"deploy_at"`
}

type BuildVersion

type BuildVersion struct {
	Address string `json:"address"`
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Build   string `json:"build"`
	CI      string `json:"ci"`
}

type Component

type Component struct {
	Instances []string `yaml:"instances"`
}

type DailyReportMessage

type DailyReportMessage struct {
	BasicMessage

	ComponentVersions map[string][]BuildVersion `json:"component_versions"`

	Metrics map[string]interface{} `json:"metrics"`
}

type HeartbeatMessage

type HeartbeatMessage struct {
	BasicMessage
	Metrics map[string]interface{} `json:"metrics"`
}

type HostInfo

type HostInfo struct {
	ID       string
	IP       string
	Services []string
}

func GetAllHosts

func GetAllHosts() []HostInfo

func GetHostsByService

func GetHostsByService(name string) []*HostInfo

type MetricsData

type MetricsData struct {
	StartTime         int64         `json:"StartTime"`
	EndTime           int64         `json:"EndTime"`
	Period            int           `json:"Period"`
	MetricDataResults []MetricsItem `json:"MetricDataResults"`
}

type MetricsItem

type MetricsItem struct {
	Name       string         `json:"Name"`
	DataPoints []MetricsPoint `json:"DataPoints"`
}

type MetricsPoint

type MetricsPoint struct {
	Timestamp int64   `json:"Timestamp"`
	Value     float64 `json:"Value"`
}

type PromClient

type PromClient struct {
	Address  string `yaml:"address"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}
var PromCli PromClient

func (PromClient) HttpGet

func (cli PromClient) HttpGet(ctx context.Context, queryUrl string, ret interface{}) error

func (PromClient) Query

func (cli PromClient) Query(ctx context.Context, query string) (result PromQueryRet, err error)

func (PromClient) QueryRange

func (cli PromClient) QueryRange(ctx context.Context, query string, start, end int64, step int) (result PromQueryRangeRet, err error)

func (PromClient) QueryWithJsonPath

func (cli PromClient) QueryWithJsonPath(ctx context.Context, query string, path string) (ret interface{}, err error)

func (PromClient) SearchMetrics

func (cli PromClient) SearchMetrics(ctx context.Context, items []PromQueryItem, start, end int64, period int) (MetricsData, error)

type PromMatrix

type PromMatrix struct {
	Metric map[string]string `json:"metric"`
	Values []PromPoint       `json:"values"`
}

type PromPoint

type PromPoint []json.Number

type PromQueryItem

type PromQueryItem struct {
	Name    string
	Metrics string
}

type PromQueryRangeRet

type PromQueryRangeRet struct {
	Status    string                `json:"status"`
	Data      PromQueryRangeRetData `json:"data"`
	ErrorType string                `json:"errorType"`
	Error     string                `json:"error"`
}

type PromQueryRangeRetData

type PromQueryRangeRetData struct {
	ResultType string       `json:"resultType"`
	Result     []PromMatrix `json:"result"`
}

type PromQueryRet

type PromQueryRet struct {
	Status    string           `json:"status"`
	Data      PromQueryRetData `json:"data"`
	ErrorType string           `json:"errorType"`
	Error     string           `json:"error"`
}

type PromQueryRetData

type PromQueryRetData struct {
	ResultType string       `json:"resultType"`
	Result     []PromVector `json:"result"`
}

type PromVector

type PromVector struct {
	Metric map[string]string `json:"metric"`
	Value  PromPoint         `json:"value"`
}

type ServiceInfo

type ServiceInfo struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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