hetzner

package
v1.101.0 Latest Latest
Warning

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

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

Documentation

Overview

SDConfig represents service discovery config for hetzner cloud and hetzner robot.

Index

Constants

This section is empty.

Variables

View Source
var SDCheckInterval = flag.Duration("promscrape.hetznerSDCheckInterval", time.Minute, "Interval for checking for changes in Hetzner API. "+
	"This works only if hetzner_sd_configs is configured in '-promscrape.config' file. "+
	"See https://docs.victoriametrics.com/sd_configs/#hetzner_sd_configs for details")

SDCheckInterval defines interval for targets refresh.

Functions

This section is empty.

Types

type HCloudDatacenter

type HCloudDatacenter struct {
	Name     string                   `json:"name"`
	Location HCloudDatacenterLocation `json:"location"`
}

HCloudDatacenter represents the Hetzner datacenter.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudDatacenterLocation

type HCloudDatacenterLocation struct {
	Name        string `json:"name"`
	NetworkZone string `json:"network_zone"`
}

HCloudDatacenterLocation represents the datacenter information.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudIPv4

type HCloudIPv4 struct {
	IP string `json:"ip"`
}

HCloudIPv4 represents the IPv4 information.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudIPv6

type HCloudIPv6 struct {
	IP string `json:"ip"`
}

HCloudIPv6 represents the IPv6 information.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudImage

type HCloudImage struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	OsFlavor    string `json:"os_flavor"`
	OsVersion   string `json:"os_version"`
}

HCloudImage represents the image information.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudMeta

type HCloudMeta struct {
	Pagination HCloudPagination `json:"pagination"`
}

HCloudMeta represents hetzner cloud meta-information.

See https://docs.hetzner.cloud/#pagination

type HCloudNetwork

type HCloudNetwork struct {
	Name string `json:"name"`
	ID   int    `json:"id"`
}

HCloudNetwork represents the hetzner cloud network information.

See https://docs.hetzner.cloud/#networks-get-all-networks

type HCloudNetworksList

type HCloudNetworksList struct {
	Meta     HCloudMeta      `json:"meta"`
	Networks []HCloudNetwork `json:"networks"`
}

HCloudNetworksList represents the hetzner cloud networks list.

See https://docs.hetzner.cloud/#networks-get-all-networks

type HCloudPagination

type HCloudPagination struct {
	NextPage int `json:"next_page"`
}

HCloudPagination represents hetzner cloud pagination information.

See https://docs.hetzner.cloud/#pagination

type HCloudPrivateNet

type HCloudPrivateNet struct {
	ID int    `json:"network"`
	IP string `json:"ip"`
}

HCloudPrivateNet represents the private network information.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudPublicNet

type HCloudPublicNet struct {
	IPv4 HCloudIPv4 `json:"ipv4"`
	IPv6 HCloudIPv6 `json:"ipv6"`
}

HCloudPublicNet represents the public network information.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudServer

type HCloudServer struct {
	ID         int                `json:"id"`
	Name       string             `json:"name"`
	Status     string             `json:"status"`
	PublicNet  HCloudPublicNet    `json:"public_net"`
	PrivateNet []HCloudPrivateNet `json:"private_net"`
	ServerType HCloudServerType   `json:"server_type"`
	Datacenter HCloudDatacenter   `json:"datacenter"`
	Image      *HCloudImage       `json:"image"`
	Labels     map[string]string  `json:"labels"`
}

HCloudServer represents the structure of server data.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudServerList

type HCloudServerList struct {
	Meta    HCloudMeta     `json:"meta"`
	Servers []HCloudServer `json:"servers"`
}

HCloudServerList represents a list of servers from Hetzner Cloud API.

See https://docs.hetzner.cloud/#servers-get-all-servers

type HCloudServerType

type HCloudServerType struct {
	Name    string  `json:"name"`
	Cores   int     `json:"cores"`
	CPUType string  `json:"cpu_type"`
	Memory  float32 `json:"memory"`
	Disk    int     `json:"disk"`
}

HCloudServerType represents the server type information.

See https://docs.hetzner.cloud/#servers-get-all-servers

type RobotServer

type RobotServer struct {
	ServerIP     string        `json:"server_ip"`
	ServerIPV6   string        `json:"server_ipv6_net"`
	ServerNumber int           `json:"server_number"`
	ServerName   string        `json:"server_name"`
	DC           string        `json:"dc"`
	Status       string        `json:"status"`
	Product      string        `json:"product"`
	Canceled     bool          `json:"cancelled"`
	Subnet       []RobotSubnet `json:"subnet"`
}

RobotServer represents the structure of hetzner robot server data.

See https://robot.hetzner.com/doc/webservice/en.html#server

type RobotServerEntry

type RobotServerEntry struct {
	Server RobotServer `json:"server"`
}

RobotServerEntry represents a single server entry in hetzner robot server response.

See https://robot.hetzner.com/doc/webservice/en.html#server

type RobotSubnet

type RobotSubnet struct {
	IP   string `json:"ip"`
	Mask string `json:"mask"`
}

RobotSubnet represents the structure of hetzner robot subnet data.

See https://robot.hetzner.com/doc/webservice/en.html#server

type SDConfig

type SDConfig struct {
	Role              string                     `yaml:"role"`
	Port              *int                       `yaml:"port,omitempty"`
	HTTPClientConfig  promauth.HTTPClientConfig  `yaml:",inline"`
	ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"`
	ProxyURL          *proxy.URL                 `yaml:"proxy_url,omitempty"`
}

SDConfig represents service discovery config for Hetzner.

See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#hetzner_sd_config

func (*SDConfig) GetLabels

func (sdc *SDConfig) GetLabels(baseDir string) ([]*promutils.Labels, error)

GetLabels returns Hetzner target labels according to sdc.

func (*SDConfig) MustStop

func (sdc *SDConfig) MustStop()

MustStop stops further usage for sdc.

Jump to

Keyboard shortcuts

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