Documentation
¶
Overview ¶
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. additional authors: Holger Obermaier (NHR@KIT)
Index ¶
- Constants
- Variables
- func EncoderAdd(encoder *influx.Encoder, msg lp.CCMessage) error
- func GangliaMetricName(point lp.CCMessage) string
- func GangliaMetricRename(name string) string
- func GangliaSlopeType(point lp.CCMessage) uint
- type GangliaMetric
- type GangliaMetricConfig
- type GangliaMetricGroup
- type GangliaSink
- type GangliaSinkConfig
- type HttpSink
- type HttpSinkConfig
- type InfluxAsyncSink
- type InfluxAsyncSinkConfig
- type InfluxSink
- type LibgangliaSink
- type LibgangliaSinkConfig
- type NatsSink
- type NatsSinkConfig
- type PrometheusSink
- type PrometheusSinkConfig
- type QuestDBSink
- type QuestDBSinkConfig
- type SampleSink
- type SampleSinkConfig
- type Sink
- func NewGangliaSink(name string, config json.RawMessage) (Sink, error)
- func NewHttpSink(name string, config json.RawMessage) (Sink, error)
- func NewInfluxAsyncSink(name string, config json.RawMessage) (Sink, error)
- func NewInfluxSink(name string, config json.RawMessage) (Sink, error)
- func NewLibgangliaSink(name string, config json.RawMessage) (Sink, error)
- func NewNatsSink(name string, config json.RawMessage) (Sink, error)
- func NewPrometheusSink(name string, config json.RawMessage) (Sink, error)
- func NewQuestDBSink(name string, config json.RawMessage) (Sink, error)
- func NewSampleSink(name string, config json.RawMessage) (Sink, error)
- func NewStdoutSink(name string, config json.RawMessage) (Sink, error)
- type SinkManager
- type StdoutSink
Constants ¶
const ( DEFAULT_GANGLIA_METRIC_TMAX = 300 DEFAULT_GANGLIA_METRIC_SLOPE = "both" )
const ( GMETRIC_EXEC = `gmetric` GMETRIC_CONFIG = `/etc/ganglia/gmond.conf` )
const ( GANGLIA_LIB_NAME = "libganglia.so" GANGLIA_LIB_DL_FLAGS = dl.RTLD_LAZY | dl.RTLD_GLOBAL GMOND_CONFIG_FILE = `/etc/ganglia/gmond.conf` )
const SINK_MAX_FORWARD = 50
Variables ¶
var AvailableSinks = map[string]func(name string, config json.RawMessage) (Sink, error){ "ganglia": NewGangliaSink, "stdout": NewStdoutSink, "nats": NewNatsSink, "influxdb": NewInfluxSink, "influxasync": NewInfluxAsyncSink, "http": NewHttpSink, "prometheus": NewPrometheusSink, "questdb": NewQuestDBSink, }
Map of all available sinks
var CommonGangliaMetrics = []GangliaMetricGroup{ { Name: "memory", Metrics: []GangliaMetric{ {"mem_total", "float", "zero", 1200, "KB"}, {"swap_total", "float", "zero", 1200, "KB"}, {"mem_free", "float", "both", 180, "KB"}, {"mem_shared", "float", "both", 180, "KB"}, {"mem_buffers", "float", "both", 180, "KB"}, {"mem_cached", "float", "both", 180, "KB"}, {"swap_free", "float", "both", 180, "KB"}, {"mem_sreclaimable", "float", "both", 180, "KB"}, {"mem_slab", "float", "both", 180, "KB"}, }, }, { Name: "cpu", Metrics: []GangliaMetric{ {"cpu_num", "uint32", "zero", 1200, "CPUs"}, {"cpu_speed", "uint32", "zero", 1200, "MHz"}, {"cpu_user", "float", "both", 90, "%"}, {"cpu_nice", "float", "both", 90, "%"}, {"cpu_system", "float", "both", 90, "%"}, {"cpu_idle", "float", "both", 3800, "%"}, {"cpu_aidle", "float", "both", 90, "%"}, {"cpu_wio", "float", "both", 90, "%"}, {"cpu_intr", "float", "both", 90, "%"}, {"cpu_sintr", "float", "both", 90, "%"}, {"cpu_steal", "float", "both", 90, "%"}, {"cpu_guest", "float", "both", 90, "%"}, {"cpu_gnice", "float", "both", 90, "%"}, }, }, { Name: "load", Metrics: []GangliaMetric{ {"load_one", "float", "both", 70, ""}, {"load_five", "float", "both", 325, ""}, {"load_fifteen", "float", "both", 950, ""}, }, }, { Name: "disk", Metrics: []GangliaMetric{ {"disk_total", "double", "both", 1200, "GB"}, {"disk_free", "double", "both", 180, "GB"}, {"part_max_used", "float", "both", 180, "%"}, }, }, { Name: "network", Metrics: []GangliaMetric{ {"bytes_out", "float", "both", 300, "bytes/sec"}, {"bytes_in", "float", "both", 300, "bytes/sec"}, {"pkts_in", "float", "both", 300, "packets/sec"}, {"pkts_out", "float", "both", 300, "packets/sec"}, }, }, { Name: "process", Metrics: []GangliaMetric{ {"proc_run", "uint32", "both", 950, ""}, {"proc_total", "uint32", "both", 950, ""}, }, }, { Name: "system", Metrics: []GangliaMetric{ {"boottime", "uint32", "zero", 1200, "s"}, {"sys_clock", "uint32", "zero", 1200, "s"}, {"machine_type", "string", "zero", 1200, ""}, {"os_name", "string", "zero", 1200, ""}, {"os_release", "string", "zero", 1200, ""}, {"mtu", "uint32", "both", 1200, ""}, }, }, }
Functions ¶
func GangliaMetricName ¶
func GangliaMetricRename ¶
func GangliaSlopeType ¶
Types ¶
type GangliaMetric ¶
type GangliaMetricConfig ¶
type GangliaMetricConfig struct {
Type string
Slope string
Tmax int
Unit string
Group string
Value string
Name string
}
func GetCommonGangliaConfig ¶
func GetCommonGangliaConfig(point lp.CCMessage) GangliaMetricConfig
func GetGangliaConfig ¶
func GetGangliaConfig(point lp.CCMessage) GangliaMetricConfig
type GangliaMetricGroup ¶
type GangliaMetricGroup struct {
Name string
Metrics []GangliaMetric
}
type GangliaSink ¶
type GangliaSink struct {
// contains filtered or unexported fields
}
func (*GangliaSink) Close ¶
func (s *GangliaSink) Close()
func (*GangliaSink) Flush ¶
func (s *GangliaSink) Flush() error
type GangliaSinkConfig ¶
type GangliaSinkConfig struct {
GmetricPath string `json:"gmetric_path,omitempty"`
GmetricConfig string `json:"gmetric_config,omitempty"`
AddGangliaGroup bool `json:"add_ganglia_group,omitempty"`
AddTagsAsDesc bool `json:"add_tags_as_desc,omitempty"`
ClusterName string `json:"cluster_name,omitempty"`
AddTypeToName bool `json:"add_type_to_name,omitempty"`
AddUnits bool `json:"add_units,omitempty"`
// contains filtered or unexported fields
}
type HttpSink ¶
type HttpSink struct {
// contains filtered or unexported fields
}
type HttpSinkConfig ¶
type HttpSinkConfig struct {
// The full URL of the endpoint
URL string `json:"url"`
// JSON web tokens for authentication (Using the *Bearer* scheme)
JWT string `json:"jwt,omitempty"`
// Basic authentication
Username string `json:"username"`
Password string `json:"password"`
// time limit for requests made by the http client
Timeout string `json:"timeout,omitempty"`
// Maximum amount of time an idle (keep-alive) connection will remain idle before closing itself
// should be larger than the measurement interval to keep the connection open
IdleConnTimeout string `json:"idle_connection_timeout,omitempty"`
// Batch all writes arriving in during this duration
// (default '5s', batching can be disabled by setting it to 0)
FlushDelay string `json:"flush_delay,omitempty"`
// Maximum number of retries to connect to the http server (default: 3)
MaxRetries int `json:"max_retries,omitempty"`
// Timestamp precision
Precision string `json:"precision,omitempty"`
// contains filtered or unexported fields
}
type InfluxAsyncSink ¶
type InfluxAsyncSink struct {
// contains filtered or unexported fields
}
func (*InfluxAsyncSink) Close ¶
func (s *InfluxAsyncSink) Close()
func (*InfluxAsyncSink) Flush ¶
func (s *InfluxAsyncSink) Flush() error
type InfluxAsyncSinkConfig ¶
type InfluxAsyncSinkConfig struct {
Host string `json:"host,omitempty"`
Port string `json:"port,omitempty"`
Database string `json:"database,omitempty"`
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
Organization string `json:"organization,omitempty"`
SSL bool `json:"ssl,omitempty"`
// Maximum number of points sent to server in single request. Default 5000
BatchSize uint `json:"batch_size,omitempty"`
// Interval, in ms, in which is buffer flushed if it has not been already written (by reaching batch size) . Default 1000ms
FlushInterval uint `json:"flush_interval,omitempty"`
InfluxRetryInterval string `json:"retry_interval,omitempty"`
InfluxExponentialBase uint `json:"retry_exponential_base,omitempty"`
InfluxMaxRetries uint `json:"max_retries,omitempty"`
InfluxMaxRetryTime string `json:"max_retry_time,omitempty"`
CustomFlushInterval string `json:"custom_flush_interval,omitempty"`
MaxRetryAttempts uint `json:"max_retry_attempts,omitempty"`
// Timestamp precision
Precision string `json:"precision,omitempty"`
// contains filtered or unexported fields
}
type InfluxSink ¶
type InfluxSink struct {
// contains filtered or unexported fields
}
func (*InfluxSink) Close ¶
func (s *InfluxSink) Close()
func (*InfluxSink) Flush ¶
func (s *InfluxSink) Flush() error
Flush sends all metrics stored in encoder to InfluxDB server
type LibgangliaSink ¶
type LibgangliaSink struct {
// contains filtered or unexported fields
}
func (*LibgangliaSink) Close ¶
func (s *LibgangliaSink) Close()
func (*LibgangliaSink) Flush ¶
func (s *LibgangliaSink) Flush() error
type LibgangliaSinkConfig ¶
type LibgangliaSinkConfig struct {
GangliaLib string `json:"libganglia_path,omitempty"`
GmondConfig string `json:"gmond_config,omitempty"`
AddGangliaGroup bool `json:"add_ganglia_group,omitempty"`
AddTypeToName bool `json:"add_type_to_name,omitempty"`
AddUnits bool `json:"add_units,omitempty"`
ClusterName string `json:"cluster_name,omitempty"`
// contains filtered or unexported fields
}
type NatsSinkConfig ¶
type NatsSinkConfig struct {
Host string `json:"host,omitempty"`
Port string `json:"port,omitempty"`
Subject string `json:"subject,omitempty"`
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
FlushDelay string `json:"flush_delay,omitempty"`
NkeyFile string `json:"nkey_file,omitempty"`
// Timestamp precision
Precision string `json:"precision,omitempty"`
// contains filtered or unexported fields
}
type PrometheusSink ¶
type PrometheusSink struct {
// contains filtered or unexported fields
}
func (*PrometheusSink) Close ¶
func (s *PrometheusSink) Close()
func (*PrometheusSink) Flush ¶
func (s *PrometheusSink) Flush() error
type PrometheusSinkConfig ¶
type QuestDBSink ¶ added in v2.12.0
type QuestDBSink struct {
// contains filtered or unexported fields
}
func (*QuestDBSink) Close ¶ added in v2.12.0
func (s *QuestDBSink) Close()
Close sink: close network connection, close files, close libraries, ...
func (*QuestDBSink) Flush ¶ added in v2.12.0
func (s *QuestDBSink) Flush() error
If the sink uses batched sends internally, you can tell to flush its buffers
type QuestDBSinkConfig ¶ added in v2.12.0
type QuestDBSinkConfig struct {
// Address to connect to. Should be in the "host:port" format
Address string `json:"address,omitempty"`
// Authentication options for QuestDB:
// Basic authentication with username and password
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
// Authentication with bearer token in HTTP header
BearerToken string `json:"bearer_token,omitempty"`
// Auto flush configuration
// Interval at which the sender automatically flushes its buffer
AutoFlushInterval string `json:"auto_flush_interval,omitempty"`
// Number of rows after which the sender automatically flushes its buffer
AutoFlushRows int `json:"auto_flush_rows,omitempty"`
// Enable TLS for secure connections
UseTLS bool `json:"use_tls,omitempty"`
// contains filtered or unexported fields
}
type SampleSink ¶
type SampleSink struct {
// contains filtered or unexported fields
}
func (*SampleSink) Close ¶
func (s *SampleSink) Close()
Close sink: close network connection, close files, close libraries, ...
func (*SampleSink) Flush ¶
func (s *SampleSink) Flush() error
If the sink uses batched sends internally, you can tell to flush its buffers
type SampleSinkConfig ¶
type SampleSinkConfig struct {
// contains filtered or unexported fields
}
type Sink ¶
type Sink interface {
Write(point lp.CCMessage) error // Write metric to the sink
Flush() error // Flush buffered metrics
Close() // Close / finish metric sink
Name() string // Name of the metric sink
}
func NewGangliaSink ¶
func NewGangliaSink(name string, config json.RawMessage) (Sink, error)
func NewHttpSink ¶
func NewHttpSink(name string, config json.RawMessage) (Sink, error)
NewHttpSink creates a new http sink
func NewInfluxAsyncSink ¶
func NewInfluxAsyncSink(name string, config json.RawMessage) (Sink, error)
func NewInfluxSink ¶
func NewInfluxSink(name string, config json.RawMessage) (Sink, error)
NewInfluxSink create a new InfluxDB sink
func NewLibgangliaSink ¶
func NewLibgangliaSink(name string, config json.RawMessage) (Sink, error)
func NewNatsSink ¶
func NewNatsSink(name string, config json.RawMessage) (Sink, error)
func NewPrometheusSink ¶
func NewPrometheusSink(name string, config json.RawMessage) (Sink, error)
func NewQuestDBSink ¶ added in v2.12.0
func NewQuestDBSink(name string, config json.RawMessage) (Sink, error)
NewQuestDBSink initializes the QuestDB sink with the given name and configuration. It returns an error if the configuration is invalid or if the connection to the QuestDB server cannot be established.
func NewSampleSink ¶
func NewSampleSink(name string, config json.RawMessage) (Sink, error)
New function to create a new instance of the sink Initialize the sink by giving it a name and reading in the config JSON
func NewStdoutSink ¶
func NewStdoutSink(name string, config json.RawMessage) (Sink, error)
type SinkManager ¶
type SinkManager interface {
Init(wg *sync.WaitGroup, sinkConfig json.RawMessage) error
AddInput(input chan lp.CCMessage)
AddOutput(name string, config json.RawMessage) error
Start()
Close()
}
Sink manager access functions
func New ¶
func New(wg *sync.WaitGroup, sinkConfig json.RawMessage) (SinkManager, error)
New creates a new initialized sink manager
type StdoutSink ¶
type StdoutSink struct {
// contains filtered or unexported fields
}
func (*StdoutSink) Close ¶
func (s *StdoutSink) Close()
func (*StdoutSink) Flush ¶
func (s *StdoutSink) Flush() error