Documentation ¶
Index ¶
- Constants
- type Config
- type Diagnostic
- type DiagsClient
- type DiagsClientFunc
- type Monitor
- func (m *Monitor) Close()
- func (m *Monitor) Diagnostics() (map[string]*Diagnostic, error)
- func (m *Monitor) Open() error
- func (m *Monitor) RegisterDiagnosticsClient(name string, client DiagsClient) error
- func (m *Monitor) SetLogger(l *log.Logger)
- func (m *Monitor) Statistics(tags map[string]string) ([]*statistic, error)
- type StatementExecutor
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" // DefaultStoreRetentionPolicy is the name of the retention policy for monitor data. DefaultStoreRetentionPolicy = "monitor" // DefaultRetentionPolicyDuration is the duration the data is retained. DefaultStoreRetentionPolicyDuration = 168 * time.Hour // DefaultStoreReplicationFactor is the default replication factor for the data. DefaultStoreReplicationFactor = 1 // DefaultStoreInterval is the period between storing gathered information. DefaultStoreInterval = 10 * time.Second )
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"` StoreRetentionPolicy string `toml:"store-retention-policy"` StoreRetentionDuration toml.Duration `toml:"store-retention-duration"` StoreReplicationFactor int `toml:"store-replication-factor"` 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 MetaStore interface { ClusterID() (uint64, error) NodeID() uint64 WaitForLeader(d time.Duration) error CreateDatabaseIfNotExists(name string) (*meta.DatabaseInfo, error) CreateRetentionPolicyIfNotExists(database string, rpi *meta.RetentionPolicyInfo) (*meta.RetentionPolicyInfo, 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) 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 purposem.
func (*Monitor) RegisterDiagnosticsClient ¶
func (m *Monitor) RegisterDiagnosticsClient(name string, client DiagsClient) error
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.