Documentation
¶
Overview ¶
It is based on `InVisionApp/go-health`
Copyright 2019 Cisco Systems, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type ACIClient
- type ACIClientConfig
- type ACIConfig
- type ACIFaultRaw
- type ACIFaultRawParser
- type ACIFaultSeverityID
- type ACIFaultSeverityIDParser
- type ACIFaultSeverityRaw
- type ACIFaultSeverityRawParser
- type APIVersion
- type APIVersionValidator
- type Agent
- type Alert
- type AlertPublisher
- type AnnotationMap
- type AnnotationMapCopier
- type AnnotationMapEqualer
- type AnnotationMapMerger
- type AnnotationMapStringer
- type AnnotationMapValidator
- type AppStatus
- type AppStatusLinks
- type Cacher
- type CaseConverter
- type CaseString
- type Client
- type Counter
- type Decoder
- type Document
- type Ecs
- type Encoder
- type Error
- type Filebeat
- type Fingerprinter
- type Graceful
- type HTTPConfig
- type Handler
- type HealthChecker
- type Host
- type Hostname
- type HostnameFinder
- type IP
- type IPv4Finder
- type IPv4Validator
- type IPv6Finder
- type IPv6Validator
- type InfoCollector
- type InfoService
- type LabelMap
- type LabelMapCopier
- type LabelMapEqualer
- type LabelMapMerger
- type LabelMapStringer
- type LabelMapValidator
- type LabelName
- type LabelNameValidator
- type LabelValue
- type LabelValueValidator
- type Log
- type LogFile
- type Logger
- type Logstash
- type MIB
- type MIBRegistry
- type Map
- type MapDecoder
- type PostAlertsParams
- type PostableEvent
- type PostableEventInput
- type Receipts
- type Request
- type ResponseWriter
- type SNMPConfig
- type SchemaLoader
- type SchemaValidator
- type Serve
- type Server
- type Snmptrapd
- type TrapSource
- type TrapVar
Constants ¶
const ( ErrCounterCreateFailed = Error("Failed to create counter.") ErrCounterDestroyFailed = Error("Failed to remove counter.") )
Counter errors.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACIClient ¶
type ACIClient interface { Login() error Faults() ([]Map, error) NodeList() (map[string]map[string]interface{}, error) Logout() error }
ACIClient is an interface implemented by an ACI API client.
type ACIClientConfig ¶
ACIClientConfig is used to specify options for ACIClient.
ACIClientConfig is based on: "github.com/udhos/acigo"
type ACIConfig ¶
type ACIConfig struct { Application string ListenAddress string CycleInterval int ACITimeout time.Duration AmURL string ACIHosts []string AlertsCFGFile string SecretsCFGFile string Version string User string Pass string StaticLabels LabelMap Throttle bool PostTime int SleepTime int SendTime int ConsulEnabled bool ConsulACIGroupHost string Debug bool // contains filtered or unexported fields }
Represents ACI settings.
type ACIFaultRaw ¶
type ACIFaultRaw struct { Ack string `json:"ack,omitempty"` Cause string `json:"cause,omitempty"` ChangeSet string `json:"changeSet,omitempty"` ChildAction string `json:"childAction,omitempty"` Code string `json:"code,omitempty"` Created string `json:"created,omitempty"` DN string `json:"dn,omitempty"` Delegated string `json:"delegated,omitempty"` Descr string `json:"descr,omitempty"` Domain string `json:"domain,omitempty"` HighestSeverity string `json:"highestSeverity,omitempty"` LC string `json:"lc,omitempty"` LastTransition string `json:"lastTransition,omitempty"` Occur string `json:"occur,omitempty"` OrigSeverity string `json:"origSeverity,omitempty"` PrevSeverity string `json:"prevSeverity,omitempty"` Rule string `json:"rule,omitempty"` Severity string `json:"severity,omitempty"` Status string `json:"status,omitempty"` Subject string `json:"subject,omitempty"` Type string `json:"type,omitempty"` }
ACIFaultRaw represents an ACI fault as scraped from the ACI API. It is designed to be used in the receiver of ACIFaultRawParser.
type ACIFaultRawParser ¶
type ACIFaultRawParser interface { // Created returns the ACI API's created time for the fault in UTC timezone // and as RFC3339 time format. Created() (time.Time, error) // LastTransition returns the ACI API's last transition time for the fault // in UTC timezone and as RFC3339 time format. LastTransition() (time.Time, error) // ServerityID returns a numerical severity for the fault based on // the return value from ACIFaultRawSeverityIDParser. SeverityID() (ACIFaultSeverityID, error) // SubID returns the fault's `sub_id`. The return value is result of // pruning pattern `/fault-.*` from the fault's Distinguished Name (or DN). SubID() (string, error) }
ACIFaultRawParser represents the ability to parse an ACI fault as scraped from the ACI API.
type ACIFaultSeverityID ¶
type ACIFaultSeverityID int
ACIFaultSeverityID represents a ACI fault's severity level ID as mapped inside the Observability Framework.
type ACIFaultSeverityIDParser ¶
type ACIFaultSeverityIDParser interface { fmt.Stringer Raw() ACIFaultSeverityRaw }
ACIFaultSeverityIDParser represents the ability, given a ACIFaultSeverityID, to parse it into different formats (e.g. ACIFaultSeverityRaw).
type ACIFaultSeverityRaw ¶
type ACIFaultSeverityRaw string
ACIFaultSeverityRaw represents a ACI fault's raw severity level as returned by the ACI API.
type ACIFaultSeverityRawParser ¶
type ACIFaultSeverityRawParser interface { fmt.Stringer ID() ACIFaultSeverityID }
ACIFaultSeverityRawParser represents the ability, given a ACIFaultSeverityRaw, to parse it into different formats (e.g. ACIFaultSeverityID).
type APIVersion ¶
type APIVersion string
APIVersion represents a named version of an API (e.g. "v1", "v1").
type APIVersionValidator ¶
type APIVersionValidator interface { // Validate returns a non-nil error if a given APIVersion is found to be // invalid. Validate() error }
APIVersionValidator is an interface that represents the ability to return a non-nil error if a given APIVersion is invalid.
type Alert ¶
type Alert struct { Labels LabelMap `json:"labels"` Annotations map[string]string `json:"annotations"` StartsAt time.Time `json:"startsAt"` EndsAt time.Time `json:"endsAt"` GeneratorURL string `json:"generatorURL"` }
Represents Alertmanager alert.
type AlertPublisher ¶
Interface to publish snmpd traps to Alertmanager.
type AnnotationMap ¶
type AnnotationMap LabelMap
AnnotationMap is a Domain Type that represents a LabelMap used to annotate rather than label a resource.
type AnnotationMapCopier ¶
type AnnotationMapCopier interface { // Copy returns a copy of an existing AnnotationMap. Copy() AnnotationMap }
AnnotationMapCopier is an interface that represents the ability to return a copy of an existing AnnotationMap.
type AnnotationMapEqualer ¶
type AnnotationMapEqualer interface { // Equal returns true when two AnnotationMap structs hold the same data. Equal(other AnnotationMap) bool }
AnnotationMapEqualer is an interface that represents the ability to return true only if two AnnotationMap structs hold the same data.
type AnnotationMapMerger ¶
type AnnotationMapMerger interface { // Merge returns a new merged AnnotationMap, given two AnnotationMap structs. Merge(other AnnotationMap) AnnotationMap }
AnnotationMapMerger is an interface that represents the ability to return a new merged AnnotationMap, given two given AnnotationMap structs.
type AnnotationMapStringer ¶
type AnnotationMapStringer interface { // String implements the `fmt.Stringer` interface. String() string }
AnnotationMapStringer is an interface that embeds the `fmt.Stringer` interface.
type AnnotationMapValidator ¶
type AnnotationMapValidator interface { // Validate returns a non-nil error if a given AnnotationMap is found to be // invalid. Validate() error }
AnnotationMapValidator is an interface that represents the ability to return a non-nil error if a given AnnotationMap is invalid.
type AppStatus ¶
type AppStatus struct { ApiVersion string `json:"apiVersion"` Description string `json:"description"` Links AppStatusLinks `json:"links"` Status string `json:"status"` }
type AppStatusLinks ¶
type AppStatusLinks struct {
About string `json:"about"`
}
type CaseConverter ¶
type CaseConverter interface {
ToSnake() string
}
CaseConverter is an interface that represents the ability to return a case-converted string. For example, "this-case" -> "ThatCase".
CaseConverter is based on the functions implemented in `github.com/iancoleman/strcase`.
type CaseString ¶
type CaseString string
CaseString represents a string that will be commonly used in the receiver of the CaseConverter interface.
type Counter ¶
Counter is a Domain Type that represents the options for creating a counter. It is based on `prometheus/Counter`
type Filebeat ¶
type Filebeat struct { Agent Agent `json:"agent,omitempty"` Ecs Ecs `json:"ecs,omitempty"` Input PostableEventInput `json:"input,omitempty"` Host Host `json:"host,omitempty"` Log Log `json:"log,omitempty"` Message string `json:"message,omitempty"` Version string `json:"@version,omitempty"` Timestamp string `json:"@timestamp,omitempty"` }
type Fingerprinter ¶
type Fingerprinter interface {
Fingerprint() string
}
Interface for fingerprinting alerts.
type HTTPConfig ¶
type Handler ¶
type Handler interface {
ServeHTTP(ResponseWriter, Request)
}
Represents HTTP handler
type HealthChecker ¶
type HostnameFinder ¶
HostnameFinder is an interface that represents the ability to determine the hostnames associated with an IPv4 or IPv6 address or similar entity.
type IPv4Finder ¶
IPv4Finder is an interface that represents the ability to determine the IPv4 addresses asssociated with a Hostname or similar entity.
type IPv4Validator ¶
type IPv4Validator interface {
IsIPv4() bool
}
IPv4Validator is an interface that represents the ability to validate that a given IP is an IPv4 address.
type IPv6Finder ¶
IPv6Finder is an interface that represents the ability to determine the IPv6 addresses asssociated with a Hostname or similar entity.
type IPv6Validator ¶
type IPv6Validator interface {
IsIPv6() bool
}
IPv6Validator is an interface that represents the ability to validate that a given IP is an IPv6 address.
type InfoCollector ¶
type InfoCollector interface { // Register registers a collector with Prometheus that exports metrics about InfoService. Register() error // Unregister unregisters the collector with Prometheus. Normally, this would be called in a defer statement. Unregister() bool }
InformerCollector is an optional extension to InfoService that represents the ability to expose metadata, build and version information as a Prometheus metrics collector.
type InfoService ¶
type InfoService interface { // BuildInfo returns build information as a string. BuildInfo() string // Metadata returns metadata as a string. Metadata() string // String returns metadata, build and version information as a string. String() string // VersionInfo returns version information as a string. VersionInfo() string }
InfoService is a domain interface that represents a service for exposing build and version information.
type LabelMap ¶
type LabelMap map[LabelName]LabelValue
LabelMap is a Domain Type that represents a map of labels used to label a resource. It is based on `prometheus/common.LabelSet`
type LabelMapCopier ¶
type LabelMapCopier interface { // Copy returns a copy of an existing LabelMap. Copy() LabelMap }
LabelMapCopier is an interface that represents the ability to return a copy of an existing LabelMap.
type LabelMapEqualer ¶
type LabelMapEqualer interface { // Equal returns true when two LabelMap structs hold the same data. Equal(other LabelMap) bool }
LabelMapEqualer is an interface that represents the ability to return true only if two LabelMap structs hold the same data.
type LabelMapMerger ¶
type LabelMapMerger interface { // Merge returns a new merged LabelMap, given two LabelMap structs. Merge(other LabelMap) LabelMap }
LabelMapMerger is an interface that represents the ability to return a new merged LabelMap, given two given LabelMap structs.
type LabelMapStringer ¶
type LabelMapStringer interface { // String implements the `fmt.Stringer` interface. String() string }
LabelMapStringer is an interface that embeds the `fmt.Stringer` interface.
type LabelMapValidator ¶
type LabelMapValidator interface { // Validate returns a non-nil error if a given LabelMap is found to be // invalid. Validate() error }
LabelMapValidator is an interface that represents the ability to return a non-nil error if a given LabelMap is invalid.
type LabelName ¶
type LabelName string
LabelName represents a key in a LabelMap.
LabelName is based on LabelName in `github.com/prometheus/common/model`.
type LabelNameValidator ¶
type LabelNameValidator interface {
Validate() error
}
LabelNameValidator is an interface that represents the ability to return a non-nil error if a given LabelName is invalid.
type LabelValue ¶
type LabelValue string
LabelValue represents a value in a LabelMap.
LabelValue is based on LabelValue in `github.com/prometheus/common/model`.
type LabelValueValidator ¶
type LabelValueValidator interface {
Validate() error
}
LabelValueValidator is an interface that represents the ability to return a non-nil error if a given LabelValue is invalid.
type Logger ¶
type Logger interface { Fatalf(message string, args ...interface{}) Panicf(message string, args ...interface{}) Debugf(message string, args ...interface{}) Errorf(message string, args ...interface{}) Infof(message string, args ...interface{}) LogLevel() string SetLevel(string) Tracef(message string, args ...interface{}) Warningf(message string, args ...interface{}) WithError(error) Logger WithField(string, interface{}) Logger WithFields(map[string]interface{}) Logger SetOutput(io.Writer) }
Methods required for a logger.
type MIBRegistry ¶
type MIBRegistry interface { // Return MIB for given OID. MIB(string) *MIB // Return MIB for given OID. // Translate each node in OID to its corresponding name, if MIB has its definition, else use the number. // Ex : 1.3.6.1.2.1.11.19 -> iso.org.dod.internet.mgmt.MIB-2.snmp.snmpInTraps. // 1.3.6.1.2.1.11.19.54334 -> iso.org.dod.internet.mgmt.MIB-2.snmp.snmpInTraps.54334. String(string) string // Translate the last node to its name. Ex: 1.3.6.1.2.1.11.19 -> snmpInTraps. ShortString(string) string // Load given map[oid]MIB into registry. Load(map[string]MIB) error }
type Map ¶
type Map map[string]interface{}
Map represents an arbitrary map[string]interface{} data that will be decoded into a native Go structure.
type MapDecoder ¶
type MapDecoder interface {
DecodeMap(output interface{}) error
}
MapDecoder is implemented by an object that can decode arbitrary map[string]interface{} data into a native Go structure and return the result.
MapDecoder is based on: "github.com/mitchellh/mapstructure"
type PostAlertsParams ¶
type PostAlertsParams struct { Alerts []Alert Context context.Context HTTPClient *http.Client // contains filtered or unexported fields }
Represents Alertmanager postAlerts params.
type PostableEvent ¶
type PostableEvent struct { Agent Agent `json:"agent,omitempty"` ApiVersion string `json:"apiVersion,omitempty"` Document Document `json:"document,omitempty"` Ecs Ecs `json:"ecs,omitempty"` Input PostableEventInput `json:"input,omitempty"` Host Host `json:"host,omitempty"` Log Log `json:"log,omitempty"` Message string `json:"message,omitempty"` Version string `json:"@version,omitempty"` Tags []string `json:"tags,omitempty"` Timestamp string `json:"@timestamp,omitempty"` }
type PostableEventInput ¶
type PostableEventInput struct {
Type string `json:"type,omitempty"`
}
type ResponseWriter ¶
type ResponseWriter http.ResponseWriter
type SNMPConfig ¶
type SNMPConfig struct { AMAddress string AMTimeout time.Duration SNMPMibsDir string CacheFile string ListenAddress string ConfigDir string }
Represents SNMP settings.
type SchemaValidator ¶
Defines schema Validator
type Serve ¶
type Serve interface { ListenAndServe() error Shutdown() error Handle(string, Handler) HandleFunc(string, func(ResponseWriter, Request)) }
Represents HTTP server components
type Snmptrapd ¶
type Snmptrapd struct { Timestamp string `json:"timestamp,omitempty"` Source TrapSource `json:"source,omitempty"` Vars []TrapVar `json:"vars,omitempty"` PduSecurity string `json:"pduSecurity,omitempty"` }
type TrapSource ¶
Source Files
¶
- aci.go
- aci_client.go
- aci_client_config.go
- aci_fault_raw.go
- aci_fault_severity_id.go
- aci_fault_severity_raw.go
- alertmanager.go
- annotation_map.go
- api_version.go
- cache.go
- case_string.go
- config.go
- counter.go
- doc.go
- error.go
- graceful.go
- health.go
- hostname.go
- http.go
- info.go
- ip.go
- label_map.go
- label_name.go
- label_value.go
- log.go
- map.go
- mib_registry.go
- model.go
- schema.go
- snmp.go