hostdare

package
v1.0.1-0...-65d85cd Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(username, password string) (prometheus.Collector, error)

Types

type HostDare

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

func NewHostDare

func NewHostDare(username, password string) (*HostDare, error)

func (*HostDare) ListServers

func (hd *HostDare) ListServers() (*ListServersResponse, error)

不支持分页。

type HostDareExporter

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

func NewHostDareExporter

func NewHostDareExporter(hd *HostDare) *HostDareExporter

func (*HostDareExporter) Collect

func (hde *HostDareExporter) Collect(w chan<- prometheus.Metric)

func (*HostDareExporter) Describe

func (hde *HostDareExporter) Describe(w chan<- *prometheus.Desc)

type IntAsString

type IntAsString int64

buggy: bits not standard compliant, but most time works well.

func (IntAsString) MarshalJSON

func (i IntAsString) MarshalJSON() ([]byte, error)

func (*IntAsString) UnmarshalJSON

func (i *IntAsString) UnmarshalJSON(b []byte) error

type ListServersResponse

type ListServersResponse struct {
	Counts struct {
		VPS IntAsString `json:"vps"`
	} `json:"counts"`
	Status  map[int]Status `json:"status"`
	Servers map[int]struct {
		ID       IntAsString `json:"vpsid"`
		HostName string      `json:"hostname"`
	} `json:"vs"`
}

type LoginResponse

type LoginResponse struct {
	Redirect string `json:"redirect"`
}

type StatsServerResponse

type StatsServerResponse struct {
	Info struct {
		ID        IntAsString `json:"vpsid"`
		Bandwidth struct {
			Limit float64 `json:"limit"`
			Used  float64 `json:"used"`
			// Free  float64         `json:"free"`
			Usage map[int]float64 `json:"usage"`
			In    map[int]float64 `json:"in"`
			Out   map[int]float64 `json:"out"`
		} `json:"bandwidth"`
	} `json:"info"`
}

type Status

type Status int
const (
	StatusUp Status = 1
)

Jump to

Keyboard shortcuts

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