Documentation ¶
Index ¶
- type Config
- type Diagnostic
- type Event
- type Events
- type HandlerConfig
- type Service
- func (s *Service) Alert(url, alertID, message string, level alert.Level, data *alert.EventData, ...) error
- func (s *Service) Close() error
- func (s *Service) Global() bool
- func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) alert.Handler
- func (s *Service) Open() error
- func (s *Service) StateChangesOnly() bool
- func (s *Service) Test(options interface{}) error
- func (s *Service) TestOptions() interface{}
- func (s *Service) Update(newConfig []interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Whether ServiceNow integration is enabled. Enabled bool `toml:"enabled" override:"enabled"` // ServiceNow events API URL. URL string `toml:"url" override:"url"` // Event source. Source string `toml:"source" override:"source"` // ServiceNow authentication username. Username string `toml:"username" override:"username"` // ServiceNow authentication password. Password string `toml:"password" override:"password,redact"` // Whether all alerts should automatically post to ServiceNow. Global bool `toml:"global" override:"global"` // Whether all alerts should automatically use stateChangesOnly mode. // Only applies if global is also set. StateChangesOnly bool `toml:"state-changes-only" override:"state-changes-only"` }
type Diagnostic ¶
type Diagnostic interface { WithContext(ctx ...keyvalue.T) Diagnostic Error(msg string, err error) }
type Event ¶ added in v1.5.8
type Event struct { Source string `json:"source"` Node string `json:"node,omitempty"` Type string `json:"type,omitempty"` Resource string `json:"resource,omitempty"` MetricName string `json:"metric_name,omitempty"` MessageKey string `json:"message_key,omitempty"` Severity string `json:"severity,omitempty"` Description string `json:"description,omitempty"` AdditionalInfo string `json:"additional_info,omitempty"` }
Event is a structure representing ServiceNow event. It can also represent an alert.
type Events ¶ added in v1.5.8
type Events struct {
Records []Event `json:"records"`
}
ServiceNow provides web service API which is recommended for publishing events. Multiple events can be published in a single call. https://docs.servicenow.com/bundle/paris-it-operations-management/page/product/event-management/task/send-events-via-web-service.html
type HandlerConfig ¶
type HandlerConfig struct { // web service URL used to post messages. // If empty uses the service URL from the configuration. URL string `mapstructure:"url"` // Username for BASIC authentication. // If empty uses username from the configuration. Username string `mapstructure:"username"` // Password for BASIC authentication. // If empty uses password from the configuration. Password string `mapstructure:"password"` // Event source. // If empty uses source from the configuration. Source string `mapstructure:"source"` // Node name. Node string `json:"node"` // Metric type. Type string `json:"type"` // Node resource relevant to the event. Resource string `json:"resource"` // Metric name for which event has been created. MetricName string `json:"metric_name"` // Message key that identifies related event. MessageKey string `json:"message_key"` // Addition info is a map of key value pairs. AdditionalInfo map[string]interface{} `mapstructure:"additional_info"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(c Config, d Diagnostic) *Service
func (*Service) StateChangesOnly ¶
func (*Service) TestOptions ¶
func (s *Service) TestOptions() interface{}
Click to show internal directories.
Click to hide internal directories.