Documentation
¶
Index ¶
- Constants
- Variables
- func MailCreateBody(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
- func MailCreateSubject(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
- func NotifierManagerAddPlugin(plugin INotifierPlugin)
- func NotifierManagerClearPlugins()
- func NotifierManagerProcess(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) error
- func PushCreateMessage(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
- func PushCreateTitle(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
- func SlackCreateAttachment(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) *slack.Attachment
- func SlackCreateMessage(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
- type Configuration
- type ConfigurationServer
- type Healthcheck
- func (This *Healthcheck) GetCurrentTimeInMS() int64
- func (This *Healthcheck) InErrorRange(value float64) bool
- func (This *Healthcheck) InSuccessRange(value float64) bool
- func (This *Healthcheck) InWarningRange(value float64) bool
- func (This *Healthcheck) NotifyErrorStatus()
- func (This *Healthcheck) NotifyTimeoutStatus()
- func (This *Healthcheck) NotifyWarningStatus()
- func (This *Healthcheck) Run()
- func (This *Healthcheck) SetLastUpdateAtCurrentTime()
- func (This *Healthcheck) SetStatusError()
- func (This *Healthcheck) SetStatusSuccess()
- func (This *Healthcheck) SetStatusTimeout()
- func (This *Healthcheck) SetStatusWarning()
- func (This *Healthcheck) UpdateLastPingData()
- func (This *Healthcheck) UpdateLastRangeData(newRange float64)
- func (This *Healthcheck) UpdatePing()
- func (This *Healthcheck) UpdateTimeoutData()
- type HealthcheckNotifier
- type INotifierPlugin
- type Notifier
- type NotifierPluginCLI
- type NotifierPluginHttpGet
- type NotifierPluginPushBullet
- func (This *NotifierPluginPushBullet) GetId() string
- func (This *NotifierPluginPushBullet) GetName() string
- func (This *NotifierPluginPushBullet) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
- func (This *NotifierPluginPushBullet) SendPush(pbAccessToken string, pbDeviceIden string, pbEmail string, pbChannelTag string, ...) error
- type NotifierPluginSendGrid
- func (This *NotifierPluginSendGrid) GetId() string
- func (This *NotifierPluginSendGrid) GetName() string
- func (This *NotifierPluginSendGrid) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
- func (This *NotifierPluginSendGrid) SendEmail(mailSubject string, mailBody string, mailFromEmail string, mailFromName string, ...) error
- type NotifierPluginSlackWebHook
- func (This *NotifierPluginSlackWebHook) GetId() string
- func (This *NotifierPluginSlackWebHook) GetName() string
- func (This *NotifierPluginSlackWebHook) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
- func (This *NotifierPluginSlackWebHook) SendSlack(webHookURL string, channel string, messageBody string, ...) error
Constants ¶
View Source
const ( HEALTHCHECK_STATUS_SUCCESS = "success" HEALTHCHECK_STATUS_WARNING = "warning" HEALTHCHECK_STATUS_ERROR = "error" HEALTHCHECK_STATUS_TIMEOUT = "timeout" HEALTHCHECK_TYPE_PING = "ping" HEALTHCHECK_TYPE_RANGE = "range" HEALTHCHECK_TYPE_MANUAL = "manual" )
View Source
const (
NOTIFIER_PLUGIN_CLI_NAME = "cli"
)
View Source
const (
NOTIFIER_PLUGIN_HTTP_GET_NAME = "httpget"
)
View Source
const (
NOTIFIER_PLUGIN_PUSHBULLET_NAME = "pushbullet"
)
View Source
const (
NOTIFIER_PLUGIN_SENDGRID_NAME = "sendgrid"
)
View Source
const (
NOTIFIER_PLUGIN_SLACK_WEBHOOK_NAME = "slackwebhook"
)
Variables ¶
View Source
var (
Plugins []INotifierPlugin
)
Functions ¶
func MailCreateBody ¶
func MailCreateBody(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
func MailCreateSubject ¶
func MailCreateSubject(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
func NotifierManagerAddPlugin ¶
func NotifierManagerAddPlugin(plugin INotifierPlugin)
func NotifierManagerClearPlugins ¶
func NotifierManagerClearPlugins()
func NotifierManagerProcess ¶
func NotifierManagerProcess(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) error
func PushCreateMessage ¶
func PushCreateMessage(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
func PushCreateTitle ¶
func PushCreateTitle(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
func SlackCreateAttachment ¶
func SlackCreateAttachment(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) *slack.Attachment
func SlackCreateMessage ¶
func SlackCreateMessage(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) string
Types ¶
type Configuration ¶
type Configuration struct { Server *ConfigurationServer `json:"server"` Healthchecks []*Healthcheck `json:"healthchecks"` Notifiers []*Notifier `json:"notifiers"` }
func NewConfigurationFromFile ¶
func NewConfigurationFromFile(file string) (*Configuration, error)
type ConfigurationServer ¶
type Healthcheck ¶
type Healthcheck struct { Token string `json:"token"` Description string `json:"description"` LastUpdateAt int64 `json:"lastUpdateAt"` Ping int64 `json:"ping"` Range float64 `json:"range"` Ranges []float64 `json:"ranges"` Status string `json:"status"` Type string `json:"type"` Timeout int64 `json:"timeout"` WarningNotifiers []*HealthcheckNotifier `json:"warningNotifiers"` ErrorNotifiers []*HealthcheckNotifier `json:"errorNotifiers"` TimeoutNotifiers []*HealthcheckNotifier `json:"timeoutNotifiers"` }
func (*Healthcheck) GetCurrentTimeInMS ¶
func (This *Healthcheck) GetCurrentTimeInMS() int64
func (*Healthcheck) InErrorRange ¶
func (This *Healthcheck) InErrorRange(value float64) bool
func (*Healthcheck) InSuccessRange ¶
func (This *Healthcheck) InSuccessRange(value float64) bool
func (*Healthcheck) InWarningRange ¶
func (This *Healthcheck) InWarningRange(value float64) bool
func (*Healthcheck) NotifyErrorStatus ¶
func (This *Healthcheck) NotifyErrorStatus()
func (*Healthcheck) NotifyTimeoutStatus ¶
func (This *Healthcheck) NotifyTimeoutStatus()
func (*Healthcheck) NotifyWarningStatus ¶
func (This *Healthcheck) NotifyWarningStatus()
func (*Healthcheck) Run ¶
func (This *Healthcheck) Run()
func (*Healthcheck) SetLastUpdateAtCurrentTime ¶
func (This *Healthcheck) SetLastUpdateAtCurrentTime()
func (*Healthcheck) SetStatusError ¶
func (This *Healthcheck) SetStatusError()
func (*Healthcheck) SetStatusSuccess ¶
func (This *Healthcheck) SetStatusSuccess()
func (*Healthcheck) SetStatusTimeout ¶
func (This *Healthcheck) SetStatusTimeout()
func (*Healthcheck) SetStatusWarning ¶
func (This *Healthcheck) SetStatusWarning()
func (*Healthcheck) UpdateLastPingData ¶
func (This *Healthcheck) UpdateLastPingData()
func (*Healthcheck) UpdateLastRangeData ¶
func (This *Healthcheck) UpdateLastRangeData(newRange float64)
func (*Healthcheck) UpdatePing ¶
func (This *Healthcheck) UpdatePing()
func (*Healthcheck) UpdateTimeoutData ¶
func (This *Healthcheck) UpdateTimeoutData()
type HealthcheckNotifier ¶
type HealthcheckNotifier struct { ID string `json:"id"` Interval int64 `json:"interval" default:"86400"` LastNotificationAt int64 `json:"lastNotificationAt"` Params map[string]interface{} `json:"params"` }
func (*HealthcheckNotifier) CanSendNotification ¶
func (This *HealthcheckNotifier) CanSendNotification() bool
func (*HealthcheckNotifier) GetCurrentTimeInMS ¶
func (This *HealthcheckNotifier) GetCurrentTimeInMS() int64
type INotifierPlugin ¶
type INotifierPlugin interface { Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier) GetId() string GetName() string }
type NotifierPluginCLI ¶
func (*NotifierPluginCLI) GetId ¶
func (This *NotifierPluginCLI) GetId() string
func (*NotifierPluginCLI) GetName ¶
func (This *NotifierPluginCLI) GetName() string
func (*NotifierPluginCLI) Notify ¶
func (This *NotifierPluginCLI) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
type NotifierPluginHttpGet ¶
func (*NotifierPluginHttpGet) ExecuteHttpGet ¶
func (This *NotifierPluginHttpGet) ExecuteHttpGet(url string) (string, error)
func (*NotifierPluginHttpGet) GetId ¶
func (This *NotifierPluginHttpGet) GetId() string
func (*NotifierPluginHttpGet) GetName ¶
func (This *NotifierPluginHttpGet) GetName() string
func (*NotifierPluginHttpGet) Notify ¶
func (This *NotifierPluginHttpGet) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
type NotifierPluginPushBullet ¶
func (*NotifierPluginPushBullet) GetId ¶
func (This *NotifierPluginPushBullet) GetId() string
func (*NotifierPluginPushBullet) GetName ¶
func (This *NotifierPluginPushBullet) GetName() string
func (*NotifierPluginPushBullet) Notify ¶
func (This *NotifierPluginPushBullet) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
type NotifierPluginSendGrid ¶
func (*NotifierPluginSendGrid) GetId ¶
func (This *NotifierPluginSendGrid) GetId() string
func (*NotifierPluginSendGrid) GetName ¶
func (This *NotifierPluginSendGrid) GetName() string
func (*NotifierPluginSendGrid) Notify ¶
func (This *NotifierPluginSendGrid) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
type NotifierPluginSlackWebHook ¶
func (*NotifierPluginSlackWebHook) GetId ¶
func (This *NotifierPluginSlackWebHook) GetId() string
func (*NotifierPluginSlackWebHook) GetName ¶
func (This *NotifierPluginSlackWebHook) GetName() string
func (*NotifierPluginSlackWebHook) Notify ¶
func (This *NotifierPluginSlackWebHook) Notify(healthcheck Healthcheck, healthcheckNotifier HealthcheckNotifier)
func (*NotifierPluginSlackWebHook) SendSlack ¶
func (This *NotifierPluginSlackWebHook) SendSlack(webHookURL string, channel string, messageBody string, messageAttachement *slack.Attachment) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.