Documentation ¶
Index ¶
- Constants
- type AddMetric
- type Command
- type CommandBase
- type CommandExtension
- type CommandExtensions
- type Config
- type ConfigD
- type Credentials
- type Extension
- type Label
- type LabelExtension
- type Labels
- type Metric
- func (metric *Metric) AddValue(log zerolog.Logger, registerer prometheus.Registerer, value float64, ...)
- func (metric *Metric) TryGetValue(log zerolog.Logger, response map[string]string, variables map[string]string) (float64, bool)
- func (x *Metric) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (metric *Metric) Validate() error
- type MetricArray
- type MetricExtension
- type Metrics
- type Module
- type ModuleExtension
- type Param
- type SafeConfig
- type Target
Constants ¶
View Source
const ( EXTENSION_ACTION_ADD = "add" EXTENSION_ACTION_OVERWRITE = "overwrite" EXTENSION_ACTION_REMOVE = "remove" )
View Source
const ( METRIC_TYPE_COUNTER = "counter" METRIC_TYPE_GAUGE = "gauge" )
View Source
const ( PARAM_TYPE_STRING = "string" PARAM_TYPE_INT = "int" PARAM_TYPE_BOOL = "bool" PARAM_TYPE_TIMESPAN = "timespan" PARAM_TYPE_DATETIME = "datetime" PARAM_DATETYPE_TO_NOW = "tonow" PARAM_DATETYPE_FROM_NOW = "fromnow" PARAM_DATETYPE_TIMESTAMP = "timestamp" )
View Source
const ( DATETIME_FORMAT_V6 = "Jan/02/2006 15:04:05" DATETIME_FORMAT_V7 = "2006-01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { CommandBase CommandBase `yaml:",inline"` Metrics Metrics `yaml:"metrics"` Labels Labels `yaml:"labels,omitempty"` Variables Labels `yaml:"variables,omitempty"` SubCommands []Command `yaml:"sub_commands,omitempty"` }
func DefaultCommand ¶
func DefaultCommand() Command
func (*Command) UnmarshalYAML ¶
type CommandBase ¶
type CommandBase struct { Command string `yaml:"command"` Timeout int `yaml:"timeout"` Prefix string `yaml:"prefix,omitempty"` // contains filtered or unexported fields }
func DefaultCommandBase ¶
func DefaultCommandBase() CommandBase
func (*CommandBase) UnmarshalYAML ¶
func (x *CommandBase) UnmarshalYAML(unmarshal func(interface{}) error) error
func (*CommandBase) Validate ¶
func (x *CommandBase) Validate() error
type CommandExtension ¶
type CommandExtension struct { Command string `yaml:"command"` Metrics []MetricExtension `yaml:"metrics"` Labels []LabelExtension `yaml:"labels"` Variables []LabelExtension `yaml:"variables"` SubCommands CommandExtensions `yaml:"sub_commands"` }
func (*CommandExtension) ExtendCommand ¶
func (x *CommandExtension) ExtendCommand(log zerolog.Logger, command Command)
type CommandExtensions ¶ added in v0.5.2
type CommandExtensions []CommandExtension
func (CommandExtensions) Extend ¶ added in v0.5.2
func (x CommandExtensions) Extend(log zerolog.Logger, commands []Command)
func (CommandExtensions) GetByCommand ¶ added in v0.5.2
func (x CommandExtensions) GetByCommand(commandStr string) []CommandExtension
type Config ¶
type Config struct { ConfigD ConfigD `yaml:",inline"` Listen string `yaml:"listen"` MetricsPath string `yaml:"metrics_path"` ProbePath string `yaml:"probe_path"` ReloadPath string `yaml:"reload_path"` DumpConfigPath string `yaml:"dump_config_path"` Namespace string `yaml:"namespace"` Credentials Credentials `yaml:",inline"` ConfigFiles []string `yaml:"config_files"` ConnectionCleanupInterval int `yaml:"connection_cleanup_interval"` ConnectionCleanupIntervalDuration time.Duration `yaml:"-"` ConnectionUseTimeout int `yaml:"connection_use_timeout"` ConnectionUseTimeoutDuration time.Duration `yaml:"-"` TargetMap map[string]*Target `yaml:"-"` // contains filtered or unexported fields }
func DefaultConfig ¶
func DefaultConfig() Config
func (*Config) UnmarshalYAML ¶
type ConfigD ¶
type ConfigD struct { Targets []*Target `yaml:"targets,omitempty"` Modules []*Module `yaml:"modules,omitempty"` ModuleExtensions []*ModuleExtension `yaml:"module_extensions,omitempty"` }
func DefaultConfigD ¶
func DefaultConfigD() ConfigD
func (*ConfigD) UnmarshalYAML ¶
type Credentials ¶
func (Credentials) MarshalYAML ¶ added in v0.5.0
func (c Credentials) MarshalYAML() (interface{}, error)
type Extension ¶
type Extension struct {
ExtensionAction string `yaml:"extension_action"`
}
func DefaultExtension ¶
func DefaultExtension() Extension
func (*Extension) UnmarshalYAML ¶
type Label ¶
func DefaultLabel ¶
func DefaultLabel() Label
func (*Label) UnmarshalYAML ¶
type LabelExtension ¶
type Labels ¶
type Labels []Label
func (Labels) LabelNames ¶ added in v0.5.0
func (Labels) LabelValues ¶ added in v0.5.0
func (*Labels) RemoveByIndex ¶ added in v0.5.0
type Metric ¶
type Metric struct { Param Param `yaml:",inline"` MetricName string `yaml:"metric_name"` MetricType string `yaml:"metric_type"` Help string `yaml:"help,omitempty"` Labels Labels `yaml:"labels,omitempty"` }
func DefaultMetric ¶
func DefaultMetric() Metric
func (*Metric) TryGetValue ¶
func (*Metric) UnmarshalYAML ¶
type MetricArray ¶
type MetricArray []Metric
func (*MetricArray) Add ¶
func (x *MetricArray) Add(item Metric)
func (*MetricArray) RemoveByIndex ¶
func (x *MetricArray) RemoveByIndex(i int)
type MetricExtension ¶
type Metrics ¶
type Metrics = *MetricArray
type Module ¶
func DefaultModule ¶
func DefaultModule() Module
func (*Module) Run ¶
func (module *Module) Run(ctx context.Context, log zerolog.Logger, client *routeros.Client, registerer prometheus.Registerer, variables map[string]string) error
func (*Module) UnmarshalYAML ¶
type ModuleExtension ¶
type ModuleExtension struct { Name string `yaml:"name"` Commands CommandExtensions `yaml:"commands"` }
func (*ModuleExtension) ExtendModule ¶
func (x *ModuleExtension) ExtendModule(log zerolog.Logger, module Module)
type Param ¶
type Param struct { ParamName string `yaml:"param_name"` ParamType string `yaml:"param_type"` Default string `yaml:"default,omitempty"` Value string `yaml:"value,omitempty"` RemapValues map[string]*string `yaml:"remap_values,omitempty"` RemapValuesRe []remapRe `yaml:"remap_values_re,omitempty"` Negate bool `yaml:"negate,omitempty"` DateTimeType string `yaml:"datetime_type,omitempty"` }
func DefaultParam ¶
func DefaultParam() Param
func (*Param) PreprocessValue ¶
func (*Param) UnmarshalYAML ¶
type SafeConfig ¶
func New ¶
func New(configFile string) (*SafeConfig, error)
func (*SafeConfig) EnableReloadByHTTP ¶
func (sc *SafeConfig) EnableReloadByHTTP()
func (*SafeConfig) EnableReloadBySIGHUP ¶
func (sc *SafeConfig) EnableReloadBySIGHUP()
func (*SafeConfig) Get ¶
func (sc *SafeConfig) Get() *Config
func (*SafeConfig) LoadConfig ¶
func (sc *SafeConfig) LoadConfig() (err error)
type Target ¶
type Target struct { Name string `yaml:"name"` Address string `yaml:"address"` Timeout int `yaml:"timeout"` TimeoutDuration time.Duration `yaml:"-"` Queue int `yaml:"queue"` Credentials Credentials `yaml:",inline"` Variables map[string]string `yaml:"variables"` Modules []string `yaml:"modules"` }
func DefaultTarget ¶
func DefaultTarget() Target
func (*Target) UnmarshalYAML ¶
Source Files ¶
- command.go
- command_extension.go
- command_logic.go
- config.go
- configd.go
- extension.go
- label.go
- label_array.go
- label_extension.go
- label_logic.go
- loader.go
- metric.go
- metric_array.go
- metric_extension.go
- metric_logic.go
- module.go
- module_extension.go
- module_logic.go
- param.go
- param_logic.go
- target.go
- target_logic.go
Click to show internal directories.
Click to hide internal directories.