Documentation
¶
Index ¶
- Constants
- Variables
- func EventToJSON(event *Event) []byte
- func GenerateUUIDv4() string
- func JwtAuth(config ServerConfig) echojwt.Config
- func JwtLoginWithConfig(config ServerConfig) func(echo.Context) error
- func PackrHandler(config ServerConfig) echo.HandlerFunc
- func Ping(config *Config)
- func SendEvent(event *Event, config *Config)
- type API
- func (api *API) DeleteCheckHandler(c echo.Context) error
- func (api *API) GetCheckByNameInContextHandler(c echo.Context) error
- func (api *API) GetCheckHandler(c echo.Context) error
- func (api *API) GetChecksHandler(c echo.Context) error
- func (api *API) GetEventHandler(c echo.Context) error
- func (api *API) GetEventsHandler(c echo.Context) error
- func (api *API) PatchCheckHandler(c echo.Context) error
- func (api *API) PatchMailEventHandler(c echo.Context) error
- func (api *API) PatchResetCheckHandler(c echo.Context) error
- func (api *API) PostCheckHandler(c echo.Context) error
- func (api *API) PostEventHandler(c echo.Context) error
- func (api *API) PrepareDatabase()
- func (api *API) SetupCronJobs()
- type AuthPair
- type Check
- type CheckNotifierMail
- type Config
- type Event
- type EventNotifierMail
- type LoadTicker
- type MailCommandNotifier
- type Notifier
- type NotifierMail
- type NullNotifier
- type SMTPNotifier
- type SendGridNotifier
- type ServerConfig
Constants ¶
View Source
const DROP_DATABASE = false
Variables ¶
View Source
var NullWriter = null{}
Functions ¶
func EventToJSON ¶
func GenerateUUIDv4 ¶
func GenerateUUIDv4() string
func JwtAuth ¶
func JwtAuth(config ServerConfig) echojwt.Config
func JwtLoginWithConfig ¶
func JwtLoginWithConfig(config ServerConfig) func(echo.Context) error
func PackrHandler ¶
func PackrHandler(config ServerConfig) echo.HandlerFunc
Types ¶
type API ¶
type API struct { POSTGRES_URL string DB *gorm.DB NOTIFIER Notifier SERVER_CONFIG ServerConfig }
func (*API) DeleteCheckHandler ¶
func (*API) GetCheckByNameInContextHandler ¶
func (*API) GetCheckHandler ¶
func (*API) GetChecksHandler ¶
GetChecksHandler handles listing of checks
func (*API) GetEventHandler ¶
func (*API) GetEventsHandler ¶
GetEventsHandler handles listing of events
func (*API) PatchCheckHandler ¶
func (*API) PatchMailEventHandler ¶
func (*API) PatchResetCheckHandler ¶
func (*API) PostCheckHandler ¶
func (*API) PostEventHandler ¶
PostEventHandler handles the posting of new events
func (*API) PrepareDatabase ¶
func (api *API) PrepareDatabase()
func (*API) SetupCronJobs ¶
func (api *API) SetupCronJobs()
type Check ¶
type Check struct { Id *string `json:"id,omitempty" gorm:"type:uuid;primary_key;default:uuid_generate_v4()"` Context string `json:"context" gorm:"not null;index:,unique,composite:idx_context_name;default:'default'"` Name string `json:"name" validate:"required" gorm:"type:text;index:,unique,composite:idx_context_name;not null"` Period time.Duration `json:"period" gorm:"type:bigint;not null;default:3600000000000"` LastPingAt time.Time `json:"last_ping_at" gorm:"type:timestamptz;index;not null;default:now()::timestamptz"` LastEventId *string `json:"last_event_id,omitempty" gorm:"type:uuid;default:null"` Success bool `json:"success"` Healthy bool `json:"healthy" gorm:"type:boolean;not_null;default:true"` Disabled bool `json:"disabled" gorm:"type:boolean;not_null;default:false"` Failures int `json:"failures" gorm:"type:int;not null;default:0"` AllowedFailures int `json:"allowed_failures" gorm:"type:int;not null;default:0"` }
type CheckNotifierMail ¶
type CheckNotifierMail struct { Check Check EnvironmentVariable string DrilldownURL string Resolved bool }
func (CheckNotifierMail) Subject ¶
func (mail CheckNotifierMail) Subject() string
func (CheckNotifierMail) Text ¶
func (mail CheckNotifierMail) Text() string
type Config ¶
type Config struct { Name string `default:"SomeEvent"` Context string `default:"default" envconfig:"CONTEXT"` ReportURL string `envconfig:"HAPPENING_REPORT_URL"` SuccessCode string `default:"0"` PingURL string Hostname string User string `envconfig:"USER"` Retries uint `default:"3"` RetryDelay time.Duration `default:"1s"` CollectOutput bool SuppressOutput bool Chdir string StoreReport bool `default:"true"` Started string Duration time.Duration Output string }
type Event ¶
type Event struct { Id string `json:"id" validate:"required,uuid" gorm:"type:uuid;primary_key"` Context string `json:"context" gorm:"not null;index;default:'default'"` Name string `json:"name" validate:"required,printascii" gorm:"not null;text"` Command pq.StringArray `json:"command,omitempty" gorm:"type:text[]"` Output string `json:"output,omitempty" gorm:"type:text"` Started time.Time `json:"started" validate:"required" gorm:"type:timestamptz;index"` Duration time.Duration `json:"duration" gorm:"type:bigint"` Success bool `json:"success" gorm:"type:bool;not null"` ExitCode int `json:"exitCode" gorm:"type:smallint;not null"` Signal string `json:"signal,omitempty" gorm:"text"` Hostname string `json:"hostname" gorm:"type:text"` User string `json:"user", gorm:"type:text"` Pid int `json:"pid" gorm:"type:int"` Load float32 `json:"load" gorm:"type:real"` CpuUsage float64 `json:"cpuUsage" gorm:"type:real"` MemoryUsage float64 `json:"memoryUsage" gorm:"type:real"` Store bool `json:"store" gorm:"-"` }
func ExecuteCmd ¶
type EventNotifierMail ¶
func (EventNotifierMail) Subject ¶
func (mail EventNotifierMail) Subject() string
func (EventNotifierMail) Text ¶
func (mail EventNotifierMail) Text() string
type LoadTicker ¶
type LoadTicker struct {
// contains filtered or unexported fields
}
func (*LoadTicker) Compute ¶
func (lt *LoadTicker) Compute() float32
func (*LoadTicker) Start ¶
func (lt *LoadTicker) Start()
type MailCommandNotifier ¶
type MailCommandNotifier struct { EnvironmentVariable string DrilldownURL string MailCommand string ContactName string ContactEmail string }
func (*MailCommandNotifier) Alert ¶
func (notifier *MailCommandNotifier) Alert(check Check)
func (*MailCommandNotifier) Mail ¶
func (notifier *MailCommandNotifier) Mail(event Event)
func (*MailCommandNotifier) Resolve ¶
func (notifier *MailCommandNotifier) Resolve(check Check)
type Notifier ¶
func NewMailCommandNotifier ¶
func NewMailCommandNotifier(config ServerConfig) Notifier
func NewNotifier ¶
func NewNotifier(config ServerConfig) Notifier
func NewNullNotifier ¶
func NewNullNotifier() Notifier
func NewSMTPNotifier ¶
func NewSMTPNotifier(config ServerConfig) Notifier
func NewSendgridNotifier ¶
func NewSendgridNotifier(config ServerConfig) Notifier
type NotifierMail ¶
type NullNotifier ¶
type NullNotifier struct { }
func (*NullNotifier) Alert ¶
func (notifier *NullNotifier) Alert(check Check)
func (*NullNotifier) Mail ¶
func (notifier *NullNotifier) Mail(event Event)
func (*NullNotifier) Resolve ¶
func (notifier *NullNotifier) Resolve(check Check)
type SMTPNotifier ¶
type SMTPNotifier struct { EnvironmentVariable string DrilldownURL string SMTPServerURL string NoReplyName string NoReplyEmail string ContactName string ContactEmail string SkipSSLVerify bool }
func (*SMTPNotifier) Alert ¶
func (notifier *SMTPNotifier) Alert(check Check)
func (*SMTPNotifier) Mail ¶
func (notifier *SMTPNotifier) Mail(event Event)
func (*SMTPNotifier) Resolve ¶
func (notifier *SMTPNotifier) Resolve(check Check)
type SendGridNotifier ¶
type SendGridNotifier struct { EnvironmentVariable string DrilldownURL string SendgridApiKey string NoReplyName string NoReplyEmail string ContactName string ContactEmail string }
func (*SendGridNotifier) Alert ¶
func (notifier *SendGridNotifier) Alert(check Check)
func (*SendGridNotifier) Mail ¶
func (notifier *SendGridNotifier) Mail(event Event)
func (*SendGridNotifier) Resolve ¶
func (notifier *SendGridNotifier) Resolve(check Check)
type ServerConfig ¶
type ServerConfig struct { PORT string `default:"8080"` POSTGRES_URL string `default:"postgresql://flori@localhost:5432/happening?sslmode=disable"` HAPPENING_SERVER_URL string `default:"http://localhost:8080"` HTTP_AUTH string SIGNING_SECRET string WEBUI_DIR string `default:"/webui"` NOTIFIER_KIND string NOTIFIER_ENVIRONMENT_VARIABLE string `default:"RAILS_ENV"` NOTIFIER_NO_REPLY_NAME string `default:"Happening"` NOTIFIER_NO_REPLY_EMAIL string `default:"no-reply@localhost"` NOTIFIER_CONTACT_NAME string `default:"Root"` NOTIFIER_CONTACT_EMAIL string `default:"root@localhost"` NOTIFIER_SENDGRID_API_KEY string NOTIFIER_MAIL_COMMAND string `default:"mail"` NOTIFIER_SMTP_SERVER_URL string `default:"smtp://username:password@localhost:25?sslVerify=disable"` RETENTION_DAYS string `default:"180"` }
Source Files
¶
- api.go
- check.go
- check_notifier_mail.go
- checks.go
- config.go
- event.go
- event_notifier_mail.go
- events.go
- execute.go
- http.go
- jwt.go
- load.go
- mail_command_notifier.go
- notifier.go
- notifier_mail.go
- null_notifier.go
- null_writer.go
- packr_handler.go
- parameters.go
- ping.go
- postgres.go
- procinfo.go
- report.go
- send_grid_notifier.go
- server_config.go
- smtp_notifier.go
- utils.go
- uuid.go
Click to show internal directories.
Click to hide internal directories.