Documentation ¶
Index ¶
- Constants
- type Config
- type Diagnostic
- type DiagsClient
- type DiagsClientFunc
- type Monitor
- func (m *Monitor) Close()
- func (m *Monitor) DeregisterDiagnosticsClient(name string)
- func (m *Monitor) Diagnostics() (map[string]*Diagnostic, error)
- func (m *Monitor) Open() error
- func (m *Monitor) RegisterDiagnosticsClient(name string, client DiagsClient)
- func (m *Monitor) SetLogger(l *log.Logger)
- func (m *Monitor) Statistics(tags map[string]string) ([]*Statistic, error)
- type StatementExecutor
- type Statistic
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 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 Diagnostic ¶
type Diagnostic struct { Columns []string Rows [][]interface{} }
Diagnostic represents a table of diagnostic information. The first value is the name of the columns, the second is a slice of interface slices containing the values for each column, by row. This information is never written to an InfluxDB system and is display-only. An example showing, say, connections follows:
source_ip source_port dest_ip dest_port 182.1.0.2 2890 127.0.0.1 38901 174.33.1.2 2924 127.0.0.1 38902
func DiagnosticFromMap ¶
func DiagnosticFromMap(m map[string]interface{}) *Diagnostic
DiagnosticFromMap returns a Diagnostic from a map.
func NewDiagnostic ¶
func NewDiagnostic(columns []string) *Diagnostic
func (*Diagnostic) AddRow ¶
func (d *Diagnostic) AddRow(r []interface{})
type DiagsClient ¶
type DiagsClient interface {
Diagnostics() (*Diagnostic, error)
}
DiagsClient is the interface modules implement if they register diags with monitor.
type DiagsClientFunc ¶
type DiagsClientFunc func() (*Diagnostic, error)
The DiagsClientFunc type is an adapter to allow the use of ordinary functions as Diagnostis clients.
func (DiagsClientFunc) Diagnostics ¶
func (f DiagsClientFunc) Diagnostics() (*Diagnostic, error)
Diagnostics calls f().
type Monitor ¶
type Monitor struct { // Build information for diagnostics. Version string Commit string Branch string BuildTime string MetaStore interface { ClusterID() (uint64, error) NodeID() uint64 WaitForLeader(d time.Duration) error IsLeader() bool CreateDatabaseIfNotExists(name string) (*meta.DatabaseInfo, error) CreateRetentionPolicyIfNotExists(database string, rpi *meta.RetentionPolicyInfo) (*meta.RetentionPolicyInfo, error) SetDefaultRetentionPolicy(database, name string) error DropRetentionPolicy(database, name string) error } PointsWriter interface { WritePoints(p *cluster.WritePointsRequest) error } 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]*Diagnostic, error)
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 DiagsClient)
RegisterDiagnosticsClient registers a diagnostics client with the given name and tags.
type StatementExecutor ¶
type StatementExecutor struct { Monitor interface { Statistics(map[string]string) ([]*Statistic, error) Diagnostics() (map[string]*Diagnostic, error) } }
StatementExecutor translates InfluxQL queries to Monitor methods.
func (*StatementExecutor) ExecuteStatement ¶
func (s *StatementExecutor) ExecuteStatement(stmt influxql.Statement) *influxql.Result
ExecuteStatement executes monitor-related query statements.