exporter

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIRequest

func APIRequest(config APIConfiguration) ([]byte, error)

APIRequest performs a request to the DirectAdmin API.

func ConvertResponse

func ConvertResponse(response map[string]interface{}) map[string]float64

ConvertResponse converts the parsed API response into a map of string-float64.

func GetMetrics

func GetMetrics(config APIConfiguration) (map[string]float64, error)

GetMetrics retrieves the metrics from the DirectAdmin API based on the provided configuration.

func ParseResponse

func ParseResponse(response []byte) (map[string]interface{}, error)

ParseResponse parses the DirectAdmin API response into a map of string-interface{}.

func RecordMetrics

func RecordMetrics(config APIConfiguration) map[string]prometheus.Gauge

RecordMetrics retrieves and records the metrics from the DirectAdmin API based on the provided configuration.

func ValidateAPIConfiguration

func ValidateAPIConfiguration(config APIConfiguration) error

ValidateAPIConfiguration validates the APIConfiguration data.

Types

type APIConfiguration

type APIConfiguration struct {
	Hostname string `validate:"required,hostname|ip"`
	Protocol string `validate:"required,oneof=http https"`
	Port     string `validate:"required,number"`
	Username string `validate:"required"`
	Token    string `validate:"required"`
}

APIConfiguration represents the configuration data for the API.

func NewAPIConfiguration

func NewAPIConfiguration(filenames ...string) APIConfiguration

NewAPIConfiguration returns a new APIConfiguration struct filled with data from the environment variables.

Jump to

Keyboard shortcuts

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