Documentation ¶
Index ¶
- type Alert
- type Config
- type Diagnostic
- type HandlerConfig
- type Service
- func (s *Service) Alert(url, alertID string, 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 Alert ¶
type Alert struct { Source string `json:"source"` Node string `json:"node"` Type string `json:"type"` Resource string `json:"resource"` MetricName string `json:"metric_name"` MessageKey string `json:"message_key"` Severity string `json:"severity"` Description string `json:"description"` }
Alert is a structure representing ServiceNow alert. It can also represent an Event. See: https://docs.servicenow.com/bundle/paris-it-operations-management/page/product/event-management/task/t_EMViewAlert.html https://docs.servicenow.com/bundle/paris-it-operations-management/page/product/event-management/task/t_EMManageEvent.html
type Config ¶
type Config struct { // Whether ServiceNow integration is enabled. Enabled bool `toml:"enabled" override:"enabled"` // ServiceNow alerts 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 HandlerConfig ¶
type HandlerConfig struct { // Alerts API URL used to post messages. // If empty uses the alerts API 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:"messageKey"` }
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.