nextserver

package
v0.0.0-...-5f03dfb Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName           = "NextServer"
	AppDescription    = "NextServer for KubeMonitor Monitoring System"
	NextServerVersion = "1.0"
	ConfigFilename    = "nextserver.yaml"
)

Variables

This section is empty.

Functions

func AutoMigration

func AutoMigration(client *ent.Client, ctx context.Context)

func DebugMode

func DebugMode(err error, client *ent.Client, ctx context.Context)

func Hello

func Hello(client *ent.Client) echo.HandlerFunc

func NewClient

func NewClient() (*ent.Client, error)

Types

type Agent

type Agent struct {
	Online     bool
	Version    string `gorm:"size:32"`
	Ipv4       string `gorm:"size:16"`
	Ipv6       string `gorm:"size:40"`
	PublicIpv4 string `gorm:"size:16"`
	PublicIpv6 string `gorm:"size:40"`

	LastContact time.Time
	Disabled    bool
	Uuid        string `gorm:"size:36;unique_index"`
	MachineID   string `gorm:"size:70;unique_index"`
	Description string

	ClusterID uint `gorm:"index"`
	Node      Node
}

type BasicRuleConfig

type BasicRuleConfig struct {
	NodeCpuLoad    float64
	NodeMemoryFree float64
	NodeDiskFree   float64
}

BasicRuleConfig basic rule config

type Cluster

type Cluster struct {
	Name        string `gorm:"size:128"`
	Description string
	Disabled    bool

	Agents []Agent
	Nodes  []Node
}

type Config

type Config struct {
	Server    ServerConfig
	Database  DatabaseConfig
	TLS       TLSConfig
	BasicRule BasicRuleConfig
}

Config config

type Container

type Container struct {
	Type        string `gorm:"size:32"`
	ContainerID string `gorm:"size:128;index"`
	Name        string `gorm:"size:256"`
	Image       string `gorm:"size:128"`
	Info        postgres.Jsonb

	ClusterID uint `gorm:"index"`
	NodeID    uint `gorm:"index"`
	Processes []Process
}

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

type DatabaseCfg

type DatabaseCfg struct {
	User     string `json:"user"`
	Password string `json:"password"`
	DbName   string `json:"db_name"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	//DbPath   string      `json:"db_path"`
	Type string `json:"type"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"prot"`
	User     string `json:"user"`
	Password string `json:"password"`
	DbName   string `json:"db_name"`
	Type     string `json:"type"`
	SslMode  string `json:"ssl_mode"`
}

DatabaseConfig database config

type Event

type Event struct {
	Ts    time.Time
	Value string

	Acked   bool
	AckedTs time.Time

	EndpointID uint
	TypeID     uint
	NameID     uint
	LabelID    uint

	ClusterID   uint
	AgentID     uint
	NodeID      uint
	ProcessID   uint
	ContainerID uint
	PodID       uint
}

type Incident

type Incident struct {
	// contains filtered or unexported fields
}

type IncidentBasicRule

type IncidentBasicRule struct {
	Name        string
	Description string
	Query       string
}

type IncidentItem

type IncidentItem struct {
	ClusterId   uint
	NodeId      uint
	ProcessId   uint
	ContainerId uint
	PodId       uint
	TargetType  string
	Target      string
	Value       float64
	Condition   float64
	EventName   string
	ReportedTs  time.Time
	DetectedTs  time.Time
}

type K8sCluster

type K8sCluster struct {
	Name           string `gorm:"size:128:index"`
	AgentClusterID uint
}

type K8sConnector

type K8sConnector struct {
	Name        string `gorm:"size:128;index"`
	Status      string `gorm:"size:32"`
	Method      string `gorm:"size:32"`
	InCluster   bool
	BearerToken string
	KubeConfig  string
}

type K8sContainer

type K8sContainer struct {
	Name          string `gorm:"size:256"`
	Image         string `gorm:"size:256"`
	ContainerType string `gorm:"size64"`
	ContainerId   string `gorm:"size:256"`

	K8sClusterID   uint
	K8sNamespaceID uint
	K8sPodID       uint
}

type K8sDaemonSet

type K8sDaemonSet struct {
	Name string `gorm:"size:256"`

	K8sClusterID   uint
	K8sNamespaceID uint
	K8sObjectID    uint
}

type K8sDeployment

type K8sDeployment struct {
	Name string `gorm:"size:256"`

	K8sClusterID   uint
	K8sNamespaceID uint
	K8sObjectID    uint
}

type K8sEvent

type K8sEvent struct {
	Ts    time.Time
	Value string

	EndpointID uint
	TypeID     uint
	NameID     uint
	LabelID    uint

	ClusterID   uint
	NamespaceID uint
	NodeID      uint
	PodID       uint
	ContainerID uint
}

type K8sLabel

type K8sLabel struct {
	Label string `gorm:"size:256;index"`

	K8sObjectID uint
}

type K8sMetric

type K8sMetric struct {
	Ts    time.Time
	Value float64

	EndpointID uint
	TypeID     uint
	NameID     uint
	LabelID    uint

	K8sClusterID   uint
	K8sNodeID      uint
	K8sNamespaceID uint
	K8sPodID       uint
	K8sContainerID uint
}

type K8sNamespace

type K8sNamespace struct {
	Name string `gorm:"size:128"`

	K8sClusterID uint
	K8sObjectID  uint
}

type K8sNode

type K8sNode struct {
	Name string `gorm:"size:128"`

	K8sClusterID uint
	K8sObjectID  uint
}

type K8sObject

type K8sObject struct {
	K8sClusterID uint

	ApiVersion string `gorm:"size:128"`
	Kind       string `gorm:"size:128"`
	Name       string `gorm:"size:256"`

	Metadata postgres.Jsonb
	Spec     postgres.Jsonb
	Status   postgres.Jsonb
}

type K8sObjectTag

type K8sObjectTag struct {
	K8sObjectID uint
	K8sLabelID  uint
}

type K8sPod

type K8sPod struct {
	Name string `gorm:"size:256"`
	Qos  string `gorm:"size:32"`

	K8sClusterID   uint
	K8sNamespaceID uint
	K8sObjectID    uint
}

type K8sReplicaSet

type K8sReplicaSet struct {
	Name string `gorm:"size:256"`

	K8sClusterID    uint
	K8sNamespaceID  uint
	K8sDeploymentID uint
	K8sObjectID     uint
}

type K8sStatefulSet

type K8sStatefulSet struct {
	Name string `gorm:"size:256"`

	K8sClusterID   uint
	K8sNamespaceID uint
	K8sObjectID    uint
}

type Metric

type Metric struct {
	Ts    time.Time `gorm:"index"`
	Value float64

	EndpointID uint `gorm:"index"`
	TypeID     uint `gorm:"index"`
	NameID     uint `gorm:"index"`
	LabelID    uint `gorm:"index"`

	ClusterID   uint `gorm:"index"`
	NodeID      uint `gorm:"index"`
	ProcessID   uint `gorm:"index"`
	ContainerID uint `gorm:"index"`
}

type MetricEndpoint

type MetricEndpoint struct {
	Path string `gorm:"size:256;unique_index"`

	Metrics []Metric
	Events  []Event
}

type MetricLabel

type MetricLabel struct {
	Label string `gorm:"size:256;unique_index"`

	Metrics []Metric
	Events  []Event
}

type MetricName

type MetricName struct {
	Name string `gorm:"size:256;unique_index"`
	Help string

	TypeID uint `gorm:"index"`

	Metrics []Metric
	Events  []Event
}

type MetricType

type MetricType struct {
	Name string `gorm:"size:32;unique_index"`

	MetricNames []MetricName
}

type NextServer

type NextServer struct {
	// contains filtered or unexported fields
}

func (*NextServer) CheckNodeBasicIncident

func (s *NextServer) CheckNodeBasicIncident(nodeMetricChan chan ent.Metric)

func (*NextServer) FindCluster

func (s *NextServer) FindCluster() echo.HandlerFunc

FindCluster Find Cluster

func (*NextServer) FindContainer

func (s *NextServer) FindContainer() echo.HandlerFunc

FindContainer find Container

func (*NextServer) FindMetricEndpoint

func (s *NextServer) FindMetricEndpoint() echo.HandlerFunc

FindMetricEndpoint findMetricEndpoint

func (*NextServer) FindMetricLabel

func (s *NextServer) FindMetricLabel() echo.HandlerFunc

FindMetricLabel findMetricLabel

func (*NextServer) FindMetricName

func (s *NextServer) FindMetricName() echo.HandlerFunc

FindMetricName findMetricName

func (*NextServer) FindMetricType

func (s *NextServer) FindMetricType() echo.HandlerFunc

FindMetricType Find Metric Type

func (*NextServer) FindNode

func (s *NextServer) FindNode() echo.HandlerFunc

FindNode findNode

func (*NextServer) FindNodeByAgent

func (s *NextServer) FindNodeByAgent() echo.HandlerFunc

FindNodeByAgent find node agent

func (*NextServer) FindNodeById

func (s *NextServer) FindNodeById() echo.HandlerFunc

FindNodeById FindNodeById

func (*NextServer) FindProcess

func (s *NextServer) FindProcess() echo.HandlerFunc

FindProcess find Process

func (*NextServer) FindRemoteAgent

func (s *NextServer) FindRemoteAgent() echo.HandlerFunc

FindRemoteAgent find remote agent

type Node

type Node struct {
	Host            string `gorm:"size:128"`
	Ipv4            string `gorm:"size:16"`
	Ipv6            string `gorm:"size:40"`
	PublicIpv4      string `gorm:"size:16"`
	PublicIpv6      string `gorm:"size:40"`
	Os              string `gorm:"size:64"`
	Platform        string `gorm:"size:64"`
	PlatformFamily  string `gorm:"size:64"`
	PlatformVersion string `gorm:"size:64"`
	Info            postgres.Jsonb
	Uuid            string `gorm:"size:36;unique_index"`
	Description     string
	Disabled        bool

	AgentID   uint `gorm:"index"`
	ClusterID uint `gorm:"index"`

	Containers []Container
	Processes  []Process
}

type Process

type Process struct {
	Name string `gorm:"size:256"`
	PID  int32  `gorm:"index"`
	Cmd  string
	Info postgres.Jsonb

	ClusterID   uint `gorm:"index"`
	NodeID      uint `gorm:"index"`
	ContainerID uint `gorm:"index"`
}

type ServerConfig

type ServerConfig struct {
	BindAddress     string `json:"bind_address"`
	AgentListenPort int    `json:"agent_listen_port"`
	ApiPort         int    `json:"api_port"`
}

ServerConfig server config

type Setting

type Setting struct {
	Name  string `gorm:"size:128;index"`
	Value string
}

type TLSConfig

type TLSConfig struct {
	Use      bool   `json:"use"`
	CertFile string `json:"cert_file"`
	KeyFile  string `json:"key_file"`
}

TLSConfig tls config

Jump to

Keyboard shortcuts

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