Documentation ¶
Index ¶
- Constants
- func DiagnosticsFromMap(m map[string]interface{}) *diagnostics.Diagnostics
- type Config
- type Monitor
- func (m *Monitor) Close() error
- func (m *Monitor) DeregisterDiagnosticsClient(name string)
- func (m *Monitor) Diagnostics() (map[string]*diagnostics.Diagnostics, error)
- func (m *Monitor) Open() error
- func (m *Monitor) RegisterDiagnosticsClient(name string, client diagnostics.Client)
- func (m *Monitor) SetGlobalTag(key string, value interface{})
- func (m *Monitor) SetLogOutput(w io.Writer)
- func (m *Monitor) SetPointsWriter(pw PointsWriter) error
- func (m *Monitor) Statistics(tags map[string]string) ([]*Statistic, error)
- type PointsWriter
- type RemoteWriterConfig
- type Reporter
- type Statistic
- type Statistics
Constants ¶
const ( // DefaultStoreEnabled is whether the system writes gathered information in // an InfluxDB system for historical analysis. DefaultStoreEnabled = true // DefaultStoreDatabase is the name of the database where gathered information is written DefaultStoreDatabase = "_internal" // DefaultStoreInterval is the period between storing gathered information. DefaultStoreInterval = 10 * time.Second )
const ( MonitorRetentionPolicy = "monitor" MonitorRetentionPolicyDuration = 7 * 24 * time.Hour )
Policy constants.
Variables ¶
This section is empty.
Functions ¶
func DiagnosticsFromMap ¶ added in v0.11.0
func DiagnosticsFromMap(m map[string]interface{}) *diagnostics.Diagnostics
DiagnosticsFromMap returns a Diagnostics from a map.
Types ¶
type Config ¶
type Config struct { StoreEnabled bool `toml:"store-enabled"` StoreDatabase string `toml:"store-database"` StoreInterval toml.Duration `toml:"store-interval"` }
Config represents the configuration for the monitor service.
type Monitor ¶
type Monitor struct { // Build information for diagnostics. Version string Commit string Branch string BuildTime string MetaClient interface { CreateDatabaseWithRetentionPolicy(name string, rpi *meta.RetentionPolicyInfo) (*meta.DatabaseInfo, error) Database(name string) *meta.DatabaseInfo } // Writer for pushing stats back into the database. PointsWriter PointsWriter Logger *log.Logger // contains filtered or unexported fields }
Monitor represents an instance of the monitor system.
func (*Monitor) DeregisterDiagnosticsClient ¶
DeregisterDiagnosticsClient deregisters a diagnostics client by name.
func (*Monitor) Diagnostics ¶
func (m *Monitor) Diagnostics() (map[string]*diagnostics.Diagnostics, error)
Diagnostics fetches diagnostic information for each registered diagnostic client. It skips any clients that return an error when retrieving their diagnostics.
func (*Monitor) Open ¶
Open opens the monitoring system, using the given clusterID, node ID, and hostname for identification purpose.
func (*Monitor) RegisterDiagnosticsClient ¶
func (m *Monitor) RegisterDiagnosticsClient(name string, client diagnostics.Client)
RegisterDiagnosticsClient registers a diagnostics client with the given name and tags.
func (*Monitor) SetGlobalTag ¶ added in v1.0.0
SetGlobalTag can be used to set tags that will appear on all points written by the Monitor.
func (*Monitor) SetLogOutput ¶ added in v1.0.0
SetLogOutput sets the writer to which all logs are written. It must not be called after Open is called.
func (*Monitor) SetPointsWriter ¶ added in v1.0.0
func (m *Monitor) SetPointsWriter(pw PointsWriter) error
SetPointsWriter can be used to set a writer for the monitoring points.
type PointsWriter ¶ added in v1.0.0
type PointsWriter interface {
WritePoints(database, retentionPolicy string, points models.Points) error
}
PointsWriter is a simplified interface for writing the points the monitor gathers
type RemoteWriterConfig ¶ added in v1.0.0
type RemoteWriterConfig struct { RemoteAddr string NodeID string Username string Password string ClusterID uint64 }
RemoteWriterConfig represents the configuration of a remote writer
type Statistic ¶
Statistic represents the information returned by a single monitor client.
func (*Statistic) ValueNames ¶ added in v0.11.0
valueNames returns a sorted list of the value names, if any.
type Statistics ¶ added in v1.0.0
type Statistics []*Statistic
func (Statistics) Len ¶ added in v1.0.0
func (a Statistics) Len() int
func (Statistics) Less ¶ added in v1.0.0
func (a Statistics) Less(i, j int) bool
func (Statistics) Swap ¶ added in v1.0.0
func (a Statistics) Swap(i, j int)