Documentation ¶
Index ¶
- Constants
- type MonitorUpdate
- type Option
- type RemoteDiagnostic
- type Synchronizer
- func (s *Synchronizer) ApplyMonitorUpdate() error
- func (s *Synchronizer) ClearDisable(reasonToClear bleemeoTypes.DisableReason, delay time.Duration)
- func (s *Synchronizer) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error
- func (s *Synchronizer) DiagnosticPage() string
- func (s *Synchronizer) Disable(until time.Time, reason bleemeoTypes.DisableReason)
- func (s *Synchronizer) FindSNMPAgent(ctx context.Context, target *snmp.Target, snmpType string, ...) (types.Agent, error)
- func (s *Synchronizer) FindVSphereAgent(ctx context.Context, device types.VSphereDevice, agentTypeID string, ...) (types.Agent, error)
- func (s *Synchronizer) GetToken(ctx context.Context) (string, error)
- func (s *Synchronizer) GetVSphereAgentType(kind vsphere.ResourceKind) (agentTypeID string, found bool)
- func (s *Synchronizer) GetVSphereAgentTypes() (map[vsphere.ResourceKind]string, bool)
- func (s *Synchronizer) HealthCheck() bool
- func (s *Synchronizer) IsMaintenance() bool
- func (s *Synchronizer) IsTimeDriftTooLarge() bool
- func (s *Synchronizer) LastMetricActivation() time.Time
- func (s *Synchronizer) NotifyConfigUpdate(immediate bool)
- func (s *Synchronizer) Run(ctx context.Context) error
- func (s *Synchronizer) ScheduleDiagnosticUpload(filename, requestToken string, contents []byte)
- func (s *Synchronizer) SetMQTTConnected(isConnected bool)
- func (s *Synchronizer) SetMaintenance(maintenance bool)
- func (s *Synchronizer) UpdateContainers()
- func (s *Synchronizer) UpdateInfo()
- func (s *Synchronizer) UpdateMaintenance()
- func (s *Synchronizer) UpdateMetrics(metricUUID ...string)
- func (s *Synchronizer) UpdateMonitor(op string, uuid string)
- func (s *Synchronizer) UpdateMonitors()
- func (s *Synchronizer) UpdateUnitsAndThresholds(ctx context.Context, firstUpdate bool)
- func (s *Synchronizer) VSphereRegisterAndUpdate(localDevices []types.VSphereDevice) error
Constants ¶
const ( // Change allows to add or update a monitor. Change monitorOperation = iota // Delete specifies the monitor should be deleted. Delete )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MonitorUpdate ¶
type MonitorUpdate struct {
// contains filtered or unexported fields
}
MonitorUpdate represents an operation to execute on a monitor.
type Option ¶
type Option struct { bleemeoTypes.GlobalOption Cache *cache.Cache PushAppender *model.BufferAppender // DisableCallback is a function called when Synchronizer request Bleemeo connector to be disabled // reason state why it's disabled and until set for how long it should be disabled. DisableCallback func(reason bleemeoTypes.DisableReason, until time.Time) // UpdateConfigCallback is a function called when Synchronizer detected a AccountConfiguration change UpdateConfigCallback func(ctx context.Context, nameChanged bool) // SetInitialized tells the bleemeo connector that the MQTT module can be started SetInitialized func() // IsMqttConnected returns whether the MQTT connector is operating nominally, and specifically // that it can receive mqtt notifications. It is useful for the fallback on http polling // described above Synchronizer.lastMaintenanceSync definition. // Note: returns false when the mqtt connector is not enabled. IsMqttConnected func() bool // SetBleemeoInMaintenanceMode makes the bleemeo connector wait a day before checking again for maintenance. SetBleemeoInMaintenanceMode func(maintenance bool) // SetBleemeoInSuspendedMode sets the suspended mode. While Bleemeo is suspended the agent doesn't // create or update objects on the API and stops sending points on MQTT. The suspended mode differs // from the maintenance mode because we stop buffering points to send on MQTT and just drop them. SetBleemeoInSuspendedMode func(suspended bool) }
Option are parameters for the synchronizer.
type RemoteDiagnostic ¶
type RemoteDiagnostic struct {
Name string `json:"name"`
}
type Synchronizer ¶
type Synchronizer struct {
// contains filtered or unexported fields
}
Synchronizer synchronize object with Bleemeo.
func (*Synchronizer) ApplyMonitorUpdate ¶
func (s *Synchronizer) ApplyMonitorUpdate() error
ApplyMonitorUpdate preprocesses monitors and updates blackbox target list. `forceAccountConfigsReload` determine whether account configurations should be updated via the API.
func (*Synchronizer) ClearDisable ¶
func (s *Synchronizer) ClearDisable(reasonToClear bleemeoTypes.DisableReason, delay time.Duration)
ClearDisable remove disabling if reason match reasonToClear. It remove the disabling only after delay.
func (*Synchronizer) DiagnosticArchive ¶
func (s *Synchronizer) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error
func (*Synchronizer) DiagnosticPage ¶
func (s *Synchronizer) DiagnosticPage() string
DiagnosticPage return useful information to troubleshoot issue.
func (*Synchronizer) Disable ¶
func (s *Synchronizer) Disable(until time.Time, reason bleemeoTypes.DisableReason)
Disable will disable (or re-enable) the Synchronized until given time. To re-enable, use ClearDisable().
func (*Synchronizer) FindSNMPAgent ¶
func (*Synchronizer) FindVSphereAgent ¶
func (*Synchronizer) GetToken ¶
func (s *Synchronizer) GetToken(ctx context.Context) (string, error)
GetToken to talk to the Bleemeo API.
func (*Synchronizer) GetVSphereAgentType ¶
func (s *Synchronizer) GetVSphereAgentType(kind vsphere.ResourceKind) (agentTypeID string, found bool)
func (*Synchronizer) GetVSphereAgentTypes ¶
func (s *Synchronizer) GetVSphereAgentTypes() (map[vsphere.ResourceKind]string, bool)
GetVSphereAgentTypes returns a map[vSphereKind]=>AgentTypeID of all vSphere resource kinds.
func (*Synchronizer) HealthCheck ¶
func (s *Synchronizer) HealthCheck() bool
HealthCheck perform some health check and log any issue found. This method could panic when health condition are bad for too long in order to cause a Glouton restart.
func (*Synchronizer) IsMaintenance ¶
func (s *Synchronizer) IsMaintenance() bool
IsMaintenance returns whether the synchronizer is currently in maintenance mode (not making any request except info/agent).
func (*Synchronizer) IsTimeDriftTooLarge ¶
func (s *Synchronizer) IsTimeDriftTooLarge() bool
IsTimeDriftTooLarge returns whether the local time it too wrong and Bleemeo connection should be disabled.
func (*Synchronizer) LastMetricActivation ¶
func (s *Synchronizer) LastMetricActivation() time.Time
LastMetricActivation return the date at which last metric was activated/registrered.
func (*Synchronizer) NotifyConfigUpdate ¶
func (s *Synchronizer) NotifyConfigUpdate(immediate bool)
NotifyConfigUpdate notify that an Agent configuration change occurred. If immediate is true, the configuration change already happened, else it will happen.
func (*Synchronizer) Run ¶
func (s *Synchronizer) Run(ctx context.Context) error
Run runs the Synchronizer.
func (*Synchronizer) ScheduleDiagnosticUpload ¶
func (s *Synchronizer) ScheduleDiagnosticUpload(filename, requestToken string, contents []byte)
ScheduleDiagnosticUpload stores the given diagnostic until the next synchronization, where it will be uploaded to the API. If another call to this method is made before the next synchronization, only the latest diagnostic will be uploaded.
func (*Synchronizer) SetMQTTConnected ¶
func (s *Synchronizer) SetMQTTConnected(isConnected bool)
func (*Synchronizer) SetMaintenance ¶
func (s *Synchronizer) SetMaintenance(maintenance bool)
SetMaintenance allows to trigger the maintenance mode for the synchronize. When running in maintenance mode, only the general infos, the agent and its configuration are synced.
func (*Synchronizer) UpdateContainers ¶
func (s *Synchronizer) UpdateContainers()
UpdateContainers request to update a containers.
func (*Synchronizer) UpdateInfo ¶
func (s *Synchronizer) UpdateInfo()
UpdateInfo request to update a info, which include the time_drift.
func (*Synchronizer) UpdateMaintenance ¶
func (s *Synchronizer) UpdateMaintenance()
UpdateMaintenance requests to check for the maintenance mode again.
func (*Synchronizer) UpdateMetrics ¶
func (s *Synchronizer) UpdateMetrics(metricUUID ...string)
UpdateMetrics request to update a specific metrics.
func (*Synchronizer) UpdateMonitor ¶
func (s *Synchronizer) UpdateMonitor(op string, uuid string)
UpdateMonitor requests to update a monitor, identified by its UUID. It allows for adding, updating and removing a monitor.
func (*Synchronizer) UpdateMonitors ¶
func (s *Synchronizer) UpdateMonitors()
UpdateMonitors requests to update all the monitors.
func (*Synchronizer) UpdateUnitsAndThresholds ¶
func (s *Synchronizer) UpdateUnitsAndThresholds(ctx context.Context, firstUpdate bool)
UpdateUnitsAndThresholds update metrics units & threshold (from cache).
func (*Synchronizer) VSphereRegisterAndUpdate ¶
func (s *Synchronizer) VSphereRegisterAndUpdate(localDevices []types.VSphereDevice) error