script

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

func NewCollector

func NewCollector(log *logrus.Logger, cfg []Config, ns string) (*Collector, error)

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context) error

func (*Collector) Register

func (c *Collector) Register(ctx context.Context, r *prometheus.Registry) error

type Config

type Config struct {
	Name   string `json:"name,omitempty" yaml:"name,omitempty"`
	Help   string `json:"help,omitempty" yaml:"help,omitempty"`
	Script string `json:"script,omitempty" yaml:"script"`
	Envs   []Env  `json:"env,omitempty" yaml:"envs,omitempty"`
}

func (*Config) FormatEnvs

func (c *Config) FormatEnvs() []string

func (*Config) Validate

func (c *Config) Validate() error

type Data

type Data struct {
	Value  float64
	Labels map[string]string
}

func ParseStdout

func ParseStdout(r []string) ([]Data, error)

func Run

func Run(ctx context.Context, cfg Config) ([]Data, error)

func (Data) LabelNames

func (d Data) LabelNames() []string

type Env

type Env struct {
	Name  string `json:"name,omitempty" yaml:"name"`
	Value string `json:"value,omitempty" yaml:"value"`
}

func (*Env) Validate

func (e *Env) Validate() error

type Parser

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

func NewParser

func NewParser() Parser

func (Parser) ParseMetric

func (p Parser) ParseMetric(l string) (Data, error)

Jump to

Keyboard shortcuts

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