metrics

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeMTU

func NodeMTU(conn PromConnect) (int, error)

NodeMTU return mtu

Types

type Details

type Details struct {
	Metric struct {
		Kernel  string `json:"kernel_version"`
		Kubelet string `json:"kubelet_version"`
	}
}

Details stores the node details

func NodeDetails

func NodeDetails(conn PromConnect) Details

NodeDetails returns the Details of the nodes. Only returning a single node info.

type NodeCPU

type NodeCPU struct {
	Idle    float64 `json:"idleCPU"`
	User    float64 `json:"userCPU"`
	Steal   float64 `json:"stealCPU"`
	System  float64 `json:"systemCPU"`
	Nice    float64 `json:"niceCPU"`
	Irq     float64 `json:"irqCPU"`
	Softirq float64 `json:"softCPU"`
	Iowait  float64 `json:"ioCPU"`
}

NodeCPU stores CPU information for a specific Node

func QueryNodeCPU

func QueryNodeCPU(node NodeInfo, conn PromConnect, start time.Time, end time.Time) (NodeCPU, bool)

QueryNodeCPU will return all the CPU usage information for a given node

type NodeInfo

type NodeInfo struct {
	IP       string
	Hostname string
	NodeName string
}

NodeInfo stores the node metadata like IP and Hostname

type PodCPU

type PodCPU struct {
	Name  string  `json:"podName"`
	Value float64 `json:"cpuUsage"`
}

PodCPU stores pod CPU

type PodValues

type PodValues struct {
	Results []PodCPU
}

PodValues is a collection of PodCPU

func TopPodCPU

func TopPodCPU(node NodeInfo, conn PromConnect, start time.Time, end time.Time) (PodValues, bool)

TopPodCPU will return the top 5 CPU consumers for a specific node

type PromConnect

type PromConnect struct {
	URL       string
	Token     string
	Client    *prometheus.Prometheus
	Verify    bool
	OpenShift bool
}

PromConnect stores the prom information

func Discover

func Discover() (PromConnect, bool)

Discover is to find Prometheus and generate an auth token if necessary.

Jump to

Keyboard shortcuts

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