mqttExporter

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "unreleased"
	Quiet   = false
	Verbose = false
	Config  ConfigType
)

Functions

func ConnectInfluxDB added in v0.2.0

func ConnectInfluxDB(config *InfluxDBConfig) (influxdb2.Client, error)

func RunServer

func RunServer()

func WriteEntry added in v0.2.0

func WriteEntry(client influxdb2.Client, config InfluxDBConfig, measurement string, tag map[string]string, field map[string]interface{}) error

Types

type ConfigType

type ConfigType struct {
	HealthCheckListener *string         `yaml:"health_check,omitempty"`
	Verbose             *bool           `yaml:"verbose,omitempty"`
	MQTT                *MQTTConfig     `yaml:"mqtt"`
	InfluxDB            *InfluxDBConfig `yaml:"influxdb,omitempty"`
	Metrics             []MetricsType   `yaml:"metrics"`
}

type InfluxDBConfig added in v0.2.0

type InfluxDBConfig struct {
	Server       string `yaml:"server"`
	Port         string `yaml:"port"`
	Tls          bool   `yaml:"tls"`
	Database     string `yaml:"database"`
	Organization string `yaml:"organization"`
	Token        string `yaml:"token,omitempty"`
}

type MQTTConfig

type MQTTConfig struct {
	Broker                string   `yaml:"broker"`
	Port                  string   `yaml:"port"`
	Protocol              string   `yaml:"protocol"`
	TopicPaths            []string `yaml:"topic_paths"`
	DeviceIDPattern       string   `yaml:"device_id_regex"`
	User                  string   `yaml:"user"`
	Password              string   `yaml:"password"`
	ClientID              string   `yaml:"client_id"`
	QoS                   byte     `yaml:"qos"`
	MetricPerTopicPattern string   `yaml:"metric_per_topic_regex"`
}

type MetricsType added in v0.2.0

type MetricsType struct {
	MqttName           string                    `yaml:"mqtt_name"`
	Name               string                    `yaml:"name,omitempty"`
	Unit               string                    `yaml:"unit,omitempty"`
	Type               string                    `yaml:"type,omitempty"`
	ConstantTags       map[string]string         `yaml:"const_tags"`
	StringValueMapping *StringValueMappingConfig `yaml:"string_value_mapping,omitempty"`
}

type StringValueMappingConfig

type StringValueMappingConfig struct {
	// ErrorValue is used when no mapping is found in Map
	ErrorValue int            `yaml:"error_value"`
	Map        map[string]int `yaml:"map"`
}

Jump to

Keyboard shortcuts

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