Documentation ¶
Index ¶
- Constants
- type AccountConfig
- type Agent
- type AgentConfig
- type AgentFact
- type AgentID
- type AgentType
- type Application
- type BleemeoReloadState
- type ConfigItemSource
- type ConfigItemType
- type Container
- type DenyReason
- type DisableReason
- type DockerProvider
- type FactProvider
- type FailureKind
- type GlobalInfo
- type GlobalOption
- type GloutonAccountConfig
- type GloutonAgentConfig
- type GloutonConfigItem
- type MQTTClient
- type MQTTReloadState
- type Metric
- type MetricRegistration
- type Monitor
- type MonitorHTTPOptions
- type MonitorManager
- type NullTime
- type ProcessProvider
- type Service
- type State
- type Store
- type Tag
- type TagType
- type Threshold
- type VSphereDevice
Constants ¶
const ( AgentTypeSNMP = "snmp" AgentTypeAgent = "agent" AgentTypeMonitor = "connection_check" AgentTypeKubernetes = "kubernetes" AgentTypeVSphereCluster = "vsphere_cluster" AgentTypeVSphereHost = "vsphere_host" AgentTypeVSphereVM = "vsphere_vm" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountConfig ¶
type AccountConfig struct { ID string `json:"id"` Name string `json:"name"` MaxCustomMetrics int `json:"number_of_custom_metrics"` LiveProcessResolution int `json:"live_process_resolution"` LiveProcess bool `json:"live_process"` DockerIntegration bool `json:"docker_integration"` SNMPIntegration bool `json:"snmp_integration"` VSphereIntegration bool `json:"vsphere_integration"` Suspended bool `json:"suspended"` }
AccountConfig is a configuration of account.
type Agent ¶
type Agent struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` AccountID string `json:"account"` NextConfigAt time.Time `json:"next_config_at"` CurrentConfigID string `json:"current_config"` Tags []Tag `json:"tags"` AgentType string `json:"agent_type"` FQDN string `json:"fqdn"` DisplayName string `json:"display_name"` // If the agent is running in Kubernetes, is he the current cluster leader? // Only the cluster leader gather global metrics for the cluster. IsClusterLeader bool `json:"is_cluster_leader"` }
Agent is an Agent object on Bleemeo API.
type AgentConfig ¶
type AgentConfig struct { ID string `json:"id"` MetricsAllowlist string `json:"metrics_allowlist"` MetricResolution int `json:"metrics_resolution"` AccountConfig string `json:"account_config"` AgentType string `json:"agent_type"` }
AgentConfig is a configuration for one kind of agent.
type AgentFact ¶
type AgentFact struct { ID string `json:"id"` AgentID string `json:"agent"` Key string `json:"key"` Value string `json:"value"` }
AgentFact is an agent facts.
type AgentID ¶
type AgentID string
AgentID is an agent UUID. This type exists for the sole purpose of making type definitions clearer.
type AgentType ¶
type AgentType struct { ID string `json:"id"` Name string `json:"name"` DisplayName string `json:"display_name"` }
AgentType is an AgentType object on Bleemeo API.
type Application ¶
type Application struct { ID string `json:"id,omitempty"` Name string `json:"name"` Tag string `json:"tag"` }
Application is a group of services.
type BleemeoReloadState ¶
type BleemeoReloadState interface { MQTTReloadState() MQTTReloadState SetMQTTReloadState(client MQTTReloadState) NextFullSync() time.Time SetNextFullSync(t time.Time) FullSyncCount() int SetFullSyncCount(count int) Token() *oauth2.Token SetToken(token *oauth2.Token) Close() }
BleemeoReloadState is used to keep some Bleemeo components alive during reloads.
type ConfigItemSource ¶
type ConfigItemSource int
ConfigItemSource enumeration on the Bleemeo API. This should always be the same as the enumeration on the API.
const ( SourceUnknown ConfigItemSource = 0 SourceDefault ConfigItemSource = 1 SourceFile ConfigItemSource = 2 SourceEnv ConfigItemSource = 3 SourceAPI ConfigItemSource = 4 )
func (ConfigItemSource) String ¶
func (c ConfigItemSource) String() string
type ConfigItemType ¶
type ConfigItemType int
ConfigItemType enumeration on the Bleemeo API. This should always be the same as the enumeration on the API.
const ( TypeAny ConfigItemType = 0 TypeInt ConfigItemType = 1 TypeFloat ConfigItemType = 2 TypeBool ConfigItemType = 3 TypeString ConfigItemType = 4 TypeListString ConfigItemType = 10 TypeListInt ConfigItemType = 11 TypeMapStrStr ConfigItemType = 20 TypeMapStrInt ConfigItemType = 21 TypeThresholds ConfigItemType = 30 TypeServices ConfigItemType = 31 TypeNameInstances ConfigItemType = 32 TypeBlackboxTargets ConfigItemType = 33 TypePrometheusTargets ConfigItemType = 34 TypeSNMPTargets ConfigItemType = 35 TypeLogInputs ConfigItemType = 36 )
type Container ¶
type Container struct { ID string `json:"id"` Name string `json:"name"` ContainerID string `json:"container_id"` ContainerInspect string `json:"container_inspect"` Status string `json:"container_status"` CreatedAt time.Time `json:"container_created_at"` DeletedAt NullTime `json:"deleted_at"` Runtime string `json:"container_runtime"` InspectHash string `json:",omitempty"` GloutonLastUpdatedAt time.Time `json:",omitempty"` }
Container is a Container object on Bleemeo API.
func (*Container) FillInspectHash ¶
func (c *Container) FillInspectHash()
FillInspectHash fill the DockerInspectHash.
type DenyReason ¶
type DenyReason int
DenyReason is the reason why a metric was denied.
const ( NotDenied DenyReason = iota DenyNotAvailableInCurrentPlan DenyErrorOccurred DenyNoDockerIntegration DenyItemTooLong DenyMissingContainerID )
func (DenyReason) String ¶
func (d DenyReason) String() string
type DisableReason ¶
type DisableReason int
DisableReason is a list of status why Bleemeo connector may be (temporary) disabled.
const ( NotDisabled DisableReason = iota DisableDuplicatedAgent DisableTooManyErrors DisableTooManyRequests DisableAgentTooOld DisableAuthenticationError DisableTimeDrift )
List of possible value for DisableReason.
func (DisableReason) String ¶
func (r DisableReason) String() string
type DockerProvider ¶
type DockerProvider interface { Containers(ctx context.Context, maxAge time.Duration, includeIgnored bool) (containers []facts.Container, err error) ContainerLastKill(containerID string) time.Time LastUpdate() time.Time }
DockerProvider is the interface used by Bleemeo to access Docker containers.
type FactProvider ¶
type FactProvider interface {
Facts(ctx context.Context, maxAge time.Duration) (facts map[string]string, err error)
}
FactProvider is the interface used by Bleemeo to access facts.
type FailureKind ¶
type FailureKind int
FailureKind is the kind of failure to register a metric. Used to know if we should (quickly) retry a failure.
const ( FailureUnknown FailureKind = iota FailureAllowList FailureTooManyCustomMetrics FailureTooManyStandardMetrics )
All possible value for FailureKind.
func (FailureKind) IsPermanentFailure ¶
func (kind FailureKind) IsPermanentFailure() bool
IsPermanentFailure tells whether the error is permanent and there is no need to quickly retry.
func (FailureKind) String ¶
func (kind FailureKind) String() string
type GlobalInfo ¶
type GlobalInfo struct { MaintenanceEnabled bool `json:"maintenance"` Agents globalInfoAgents `json:"agents"` CurrentTime float64 `json:"current_time"` MaxTimeDrift float64 `json:"max_time_drift"` FetchedAt time.Time `json:"-"` }
GlobalInfo represents the bleemeo agent global information.
func (GlobalInfo) BleemeoTime ¶
func (i GlobalInfo) BleemeoTime() time.Time
BleemeoTime return the time according to Bleemeo API.
func (GlobalInfo) IsTimeDriftTooLarge ¶
func (i GlobalInfo) IsTimeDriftTooLarge() bool
IsTimeDriftTooLarge returns whether the local time it too wrong.
func (GlobalInfo) TimeDrift ¶
func (i GlobalInfo) TimeDrift() time.Duration
TimeDrift return the time difference between local clock and Bleemeo API.
type GlobalOption ¶
type GlobalOption struct { Config config.Config ConfigItems []config.Item State State Facts FactProvider Process ProcessProvider Docker DockerProvider SNMP []*snmp.Target SNMPOnlineTarget func() int Store Store Discovery discovery.PersistentDiscoverer MonitorManager MonitorManager MetricFormat types.MetricFormat NotifyFirstRegistration func() NotifyLabelsUpdate func() BlackboxScraperName string ReloadState BleemeoReloadState WriteDiagnosticArchive func(ctx context.Context, archive types.ArchiveWriter) error VSphereDevices func(ctx context.Context, maxAge time.Duration) []VSphereDevice FindVSphereDevice func(ctx context.Context, vSphere, moid string) VSphereDevice LastVSphereChange func(ctx context.Context) time.Time VSphereEndpointsInError func() map[string]bool UpdateMetricResolution func(ctx context.Context, defaultResolution time.Duration, snmpResolution time.Duration) UpdateThresholds func(ctx context.Context, thresholds map[string]threshold.Threshold, firstUpdate bool) UpdateUnits func(units map[string]threshold.Unit) IsContainerEnabled func(facts.Container) (bool, bool) IsContainerNameRecentlyDeleted func(name string) bool PahoLastPingCheckAt func() time.Time LastMetricAnnotationChange func() time.Time // IsMetricAllowed returns whether a metric is allowed or not in the config files. IsMetricAllowed func(lbls map[string]string) bool }
GlobalOption are option user by most component of bleemeo.Connector.
type GloutonAccountConfig ¶
type GloutonAccountConfig struct { ID string Name string LiveProcessResolution time.Duration LiveProcess bool DockerIntegration bool SNMPIntegration bool VSphereIntegration bool Suspended bool AgentConfigByName map[string]GloutonAgentConfig AgentConfigByID map[string]GloutonAgentConfig MaxCustomMetrics int }
type GloutonAgentConfig ¶
type GloutonConfigItem ¶
type GloutonConfigItem struct { ID string `json:"id"` Agent string `json:"agent"` Key string `json:"key"` Value interface{} `json:"value"` Priority int `json:"priority"` Source ConfigItemSource `json:"source"` Path string `json:"path"` Type ConfigItemType `json:"type"` }
GloutonConfigItem object on the Bleemeo API.
type MQTTClient ¶
type MQTTClient interface { Publish(topic string, payload any, retry bool) error Run(ctx context.Context) IsConnectionOpen() bool DiagnosticArchive(ctx context.Context, archive types.ArchiveWriter) error LastReport() time.Time Disable(until time.Time) DisabledUntil() time.Time Disconnect(timeout time.Duration) }
type MQTTReloadState ¶
type MQTTReloadState interface { SetMQTT(mqtt MQTTClient) OnConnect(cli paho.Client) ConnectChannel() <-chan paho.Client OnNotification(cli paho.Client, msg paho.Message) NotificationChannel() <-chan paho.Message PopPendingPoints() []types.MetricPoint SetPendingPoints(points []types.MetricPoint) ClientState() types.MQTTReloadState Close() }
MQTTReloadState allows changing some event handlers at runtime.
type Metric ¶
type Metric struct { ID string `json:"id"` AgentID string `json:"agent,omitempty"` LabelsText string `json:"labels_text,omitempty"` Labels map[string]string `json:"-"` ServiceID string `json:"service,omitempty"` ContainerID string `json:"container,omitempty"` StatusOf string `json:"status_of,omitempty"` Threshold threshold.Unit DeactivatedAt time.Time `json:"deactivated_at,omitempty"` FirstSeenAt time.Time `json:"first_seen_at"` }
Metric is a Metric object on Bleemeo API.
type MetricRegistration ¶
type MetricRegistration struct { LabelsText string LastFailAt time.Time FailCounter int LastFailKind FailureKind }
MetricRegistration contains information about a metric registration failure.
func (MetricRegistration) RetryAfter ¶
func (mr MetricRegistration) RetryAfter() time.Time
RetryAfter return the time after which the retry of the registration may be retried.
type Monitor ¶
type Monitor struct { Service URL string `json:"monitor_url"` AgentID string `json:"agent"` MonitorHTTPOptions }
Monitor groups all the information required to write metrics to a monitor.
type MonitorHTTPOptions ¶
type MonitorHTTPOptions struct { ExpectedContent string `json:"monitor_expected_content,omitempty"` ExpectedResponseCode int `json:"monitor_expected_response_code,omitempty"` ForbiddenContent string `json:"monitor_unexpected_content,omitempty"` CAFile string `json:"monitor_ca_file,omitempty"` Headers map[string]string `json:"monitor_headers,omitempty"` }
MonitorHTTPOptions groups all the possible options when the probe is targeting an HTTP or HTTPS service.
type MonitorManager ¶
type MonitorManager interface { // UpdateDynamicTargets updates the list of dynamic monitors to watch. UpdateDynamicTargets(monitors []types.Monitor) error }
MonitorManager is the interface used by Bleemeo to update the dynamic monitors list.
type NullTime ¶
func (NullTime) MarshalJSON ¶
MarshalJSON marshall the time.Time as usual BUT zero time is sent as "null".
func (*NullTime) UnmarshalJSON ¶
UnmarshalJSON the time.Time as usual BUT zero time is read as "null".
type ProcessProvider ¶
type ProcessProvider interface { Processes(ctx context.Context, maxAge time.Duration) (processes map[int]facts.Process, err error) TopInfo(ctx context.Context, maxAge time.Duration) (topinfo facts.TopInfo, err error) }
ProcessProvider is the interface used by Bleemeo to access processes.
type Service ¶
type Service struct { ID string `json:"id"` AccountConfig string `json:"account_config"` Label string `json:"label"` Instance string `json:"instance"` ListenAddresses string `json:"listen_addresses"` ExePath string `json:"exe_path"` Tags []Tag `json:"tags"` Active bool `json:"active"` CreationDate string `json:"created_at"` }
Service is a Service object on Bleemeo API.
type State ¶
type State interface { Set(key string, object interface{}) error Get(key string, result interface{}) error GetByPrefix(keyPrefix string, resultType any) (map[string]any, error) Delete(key string) error BleemeoCredentials() (string, string) SetBleemeoCredentials(agentUUID string, password string) error }
State is the interface used by Bleemeo to access State.
type Store ¶
type Store interface { Metrics(filters map[string]string) (result []types.Metric, err error) MetricsCount() int DropMetrics(labelsList []map[string]string) AddNotifiee(cb func([]types.MetricPoint)) int RemoveNotifiee(id int) }
Store is the interface used by Bleemeo to access Metric Store.
type Tag ¶
type Tag struct { ID string `json:"id,omitempty"` Name string `json:"name"` IsAutomatic bool `json:"is_automatic,omitempty"` IsServiceTag bool `json:"is_service_tag,omitempty"` TagType TagType `json:"tag_type"` }
Tag is an Tag object on Bleemeo API.
type Threshold ¶
type Threshold struct { LowWarning *float64 `json:"threshold_low_warning"` LowCritical *float64 `json:"threshold_low_critical"` HighWarning *float64 `json:"threshold_high_warning"` HighCritical *float64 `json:"threshold_high_critical"` }
Threshold is the threshold of a metrics. We use pointer to float to support null value in JSON.
func (Threshold) ToInternalThreshold ¶
ToInternalThreshold convert to a threshold.Threshold (use NaN instead of null pointer for unset thresholds).
type VSphereDevice ¶
type VSphereDevice interface { // Kind returns the type of the VSphereDevice (VirtualMachine, HostSystem, ...). Kind() string FQDN() string // Source returns the host address of the vCenter/ESXI from which this VSphereDevice was described. Source() string // MOID returns the Managed Object ID of this VSphereDevice, // which is an internal VMware identifier generated by vSphere. MOID() string Name() string Facts() map[string]string IsPoweredOn() bool LatestError() error }