Documentation ¶
Index ¶
- Constants
- Variables
- func AddAdmin(alertID, adminID int) error
- func AddNotifier(alertID, notifierID int) error
- func AddUserIfNotExists(name string) error
- func DeleteAdmin(alertID, adminID int) error
- func DeleteAlert(alertID int) error
- func DeleteGraphiteService(serviceID, alertID int) error
- func DeleteHTTPService(serviceID, alertID int) error
- func DeleteNotifier(alertID, notifierID int) error
- func DeleteTCPService(serviceID, alertID int) error
- func DeleteTemplate(templateID, alertID int) error
- func GetAdminsByAlertID(id int, admins *[]User) error
- func GetAlert(alert *Alert, id int) error
- func GetAllAlerts(alerts *[]Alert) error
- func GetAllGraphiteServicesByAlertID(alertID int, services *[]GraphiteService) error
- func GetAllHTTPServicesByAlertID(alertID int, services *[]HTTPService) error
- func GetAllTCPServicesByAlertID(alertID int, services *[]TCPService) error
- func GetAllTemplatesByAlertID(alertID int, templates *[]Template) error
- func GetAllUsers(users *[]User, namePattern string) error
- func GetAllUsersDetails(users *[]User, namePattern string) error
- func GetDetailedAlert(alert *Alert, id int) error
- func GetGraphiteService(serviceID int, service *GraphiteService) error
- func GetHTTPService(serviceID int, service *HTTPService) error
- func GetNotifiersByAlertID(id int, notifiers *[]User) error
- func GetTCPService(serviceID int, service *TCPService) error
- func GetTemplate(templateID int, template *Template) error
- func GetUser(userName string, user *User) error
- func IsSuperUser(userID int) (bool, error)
- func SaveAlert(alert *Alert) error
- func SaveGraphiteService(service *GraphiteService) error
- func SaveHTTPService(service *HTTPService) error
- func SaveTCPService(service *TCPService) error
- func SaveTemplate(template *Template) error
- func SynchronizeAlert(id int) error
- func TestHTTPService(service *HTTPService) (string, error)
- func UpdateUser(user *User) error
- type Alert
- type CheckHTTPCmdParams
- type GraphiteService
- type HTTPService
- type Health
- type Icinga2Apply
- type Icinga2GraphiteService
- func (gs Icinga2GraphiteService) GetServiceCheckAttempts() int
- func (gs Icinga2GraphiteService) GetServiceCheckCommand() string
- func (gs Icinga2GraphiteService) GetServiceID() string
- func (gs Icinga2GraphiteService) GetServiceName() string
- func (gs Icinga2GraphiteService) GetServiceNonStrVars() map[string]interface{}
- func (gs Icinga2GraphiteService) GetServiceResendTime() int
- func (gs Icinga2GraphiteService) GetServiceVars() map[string]interface{}
- type Icinga2HTTPService
- func (httpS Icinga2HTTPService) GetServiceCheckAttempts() int
- func (httpS Icinga2HTTPService) GetServiceCheckCommand() string
- func (httpS Icinga2HTTPService) GetServiceID() string
- func (httpS Icinga2HTTPService) GetServiceName() string
- func (httpS Icinga2HTTPService) GetServiceNonStrVars() map[string]interface{}
- func (httpS Icinga2HTTPService) GetServiceResendTime() int
- func (httpS Icinga2HTTPService) GetServiceVars() map[string]interface{}
- type Icinga2Service
- type Icinga2TCPService
- func (tcpS Icinga2TCPService) GetServiceCheckAttempts() int
- func (tcpS Icinga2TCPService) GetServiceCheckCommand() string
- func (tcpS Icinga2TCPService) GetServiceID() string
- func (tcpS Icinga2TCPService) GetServiceName() string
- func (tcpS Icinga2TCPService) GetServiceNonStrVars() map[string]interface{}
- func (tcpS Icinga2TCPService) GetServiceResendTime() int
- func (tcpS Icinga2TCPService) GetServiceVars() map[string]interface{}
- type Icinga2TemplatedService
- type TCPService
- type Template
- type User
Constants ¶
View Source
const ( Greater = ">" Less = "<" Equal = "==" NotEqual = "!=" GraphiteServiceCheckCommand = "check_graphite_metric" )
View Source
const ( HTTPServiceCheckCommand = "check_http" HTTPServiceTypeSimple = 0 HTTPServiceTypeAdvanced = 1 )
View Source
const TCPServiceCheckCommand = "check_tcp"
Variables ¶
View Source
var (
ErrorDuplicatedName = errors.New("The name is duplicated")
)
Functions ¶
func AddNotifier ¶
func AddUserIfNotExists ¶
func DeleteAdmin ¶
func DeleteAlert ¶
func DeleteGraphiteService ¶
func DeleteHTTPService ¶
func DeleteNotifier ¶
func DeleteTCPService ¶
func DeleteTemplate ¶
func GetAdminsByAlertID ¶
func GetAllAlerts ¶
func GetAllGraphiteServicesByAlertID ¶
func GetAllGraphiteServicesByAlertID(alertID int, services *[]GraphiteService) error
func GetAllHTTPServicesByAlertID ¶
func GetAllHTTPServicesByAlertID(alertID int, services *[]HTTPService) error
func GetAllTCPServicesByAlertID ¶
func GetAllTCPServicesByAlertID(alertID int, services *[]TCPService) error
func GetAllUsers ¶
func GetAllUsersDetails ¶
func GetDetailedAlert ¶
func GetGraphiteService ¶
func GetGraphiteService(serviceID int, service *GraphiteService) error
func GetHTTPService ¶
func GetHTTPService(serviceID int, service *HTTPService) error
func GetNotifiersByAlertID ¶
func GetTCPService ¶
func GetTCPService(serviceID int, service *TCPService) error
func GetTemplate ¶
func IsSuperUser ¶
func SaveGraphiteService ¶
func SaveGraphiteService(service *GraphiteService) error
func SaveHTTPService ¶
func SaveHTTPService(service *HTTPService) error
func SaveTCPService ¶
func SaveTCPService(service *TCPService) error
func SaveTemplate ¶
func SynchronizeAlert ¶
func TestHTTPService ¶
func TestHTTPService(service *HTTPService) (string, error)
func UpdateUser ¶
Types ¶
type Alert ¶
type Alert struct { ID int `gorm:"primary_key" form:"-"` Name string `gorm:"type:varchar(64);not null;unique" form:"name"` Enabled bool `gorm:"not null" form:"enabled"` GraphiteServices []GraphiteService `gorm:"ForeignKey:AlertID" form:"-"` TCPServices []TCPService `gorm:"ForeignKey:AlertID" form:"-"` HTTPServices []HTTPService `gorm:"ForeignKey:AlertID" form:"-"` Templates []Template `gorm:"ForeignKey:AlertID" form:"-"` Notifiers []User `gorm:"many2many:alert_to_user_notify" form:"-"` Admins []User `gorm:"many2many:alert_to_user_admin" form:"-"` CreatedAt time.Time `form:"-"` }
type CheckHTTPCmdParams ¶
type CheckHTTPCmdParams struct { HostName string `short:"H" long:"hostname"` IPAddress string `short:"I" long:"IP-Address"` Port string `short:"p" long:"port"` UseIPv4 bool `short:"4"` UseIPv6 bool `short:"6"` SSlVersion string `short:"S" long:"ssl"` SSlEnable bool `long:"sni"` Certificate string `short:"C" long:"certificate"` Expect string `short:"e" long:"expect"` HeaderExpect string `short:"d" long:"header-string"` ContentExpect string `short:"s" long:"string"` URI string `short:"u" long:"uri"` PostData string `short:"P" long:"post"` Method string `short:"j" long:"method"` IgnoreBody bool `short:"N" long:"no-body"` MaxAge string `short:"M" long:"max-age"` ContentType string `short:"T" long:"content-type"` LineSpan bool `short:"l" long:"linespan"` Regex string `short:"r" long:"regex" long:"ereg"` RegexCaseIns string `short:"R" long:"eregi"` InvertRegex bool `long:"invert-regex"` BasicAuth string `short:"a" long:"authorization"` ProxyAuth string `short:"b" long:"proxy-authorization"` UserAgent string `short:"A" long:"useragent"` Header []string `short:"k" long:"header"` WrapLink bool `short:"L" long:"link"` OnRedirect string `short:"f" long:"onredirect"` MinPageSize string `short:"m" long:"pagesize"` }
type GraphiteService ¶
type GraphiteService struct { ID int `gorm:"primary_key" form:"-"` AlertID int `gorm:"not null" form:"-"` Name string `gorm:"type:varchar(64);not null" form:"name"` Metric string `gorm:"type:varchar(1024);not null" form:"metric"` CheckAttempts int `gorm:"not null; default 3" form:"check_attempts"` Warning string `gorm:"type:varchar(32);not null" form:"warning"` Critical string `gorm:"type:varchar(32);not null" form:"critical"` Enabled bool `gorm:"not null" form:"enabled"` ResendTime int `gorm:"not null" form:"resend_time"` CheckType string `gorm:"type:varchar(16);not null" form:"check_type"` CreatedAt time.Time Alert Alert `gorm:"ForeignKey:AlertID"` }
func (*GraphiteService) GenerateServices ¶
func (gs *GraphiteService) GenerateServices(templates []Template) []Icinga2Service
type HTTPService ¶
type HTTPService struct { ID int `gorm:"primary_key" form:"-"` AlertID int `gorm:"not null" form:"-"` Name string `gorm:"type:varchar(64);not null" form:"name"` Type int `gorm:"not null;" form:"type"` Parameters string `gorm:"type:longtext;not null" form:"parameters"` CheckAttempts int `gorm:"not null; default 3" form:"check_attempts"` Enabled bool `gorm:"not null" form:"enabled"` ResendTime int `gorm:"not null" form:"resend_time"` CreatedAt time.Time Alert Alert `gorm:"ForeignKey:AlertID"` }
func (*HTTPService) GenerateServices ¶
func (httpS *HTTPService) GenerateServices(templates []Template) []Icinga2Service
type Health ¶
type Health struct {
Icinga2Alive bool
}
func GetHealthStatus ¶
func GetHealthStatus() *Health
type Icinga2Apply ¶
type Icinga2GraphiteService ¶
type Icinga2GraphiteService struct { ID string Name string Warning string Critical string CheckAttempts int ResendTime int MetricURL string MetricType string }
Implements Icinga2Service
func (Icinga2GraphiteService) GetServiceCheckAttempts ¶
func (gs Icinga2GraphiteService) GetServiceCheckAttempts() int
func (Icinga2GraphiteService) GetServiceCheckCommand ¶
func (gs Icinga2GraphiteService) GetServiceCheckCommand() string
func (Icinga2GraphiteService) GetServiceID ¶
func (gs Icinga2GraphiteService) GetServiceID() string
func (Icinga2GraphiteService) GetServiceName ¶
func (gs Icinga2GraphiteService) GetServiceName() string
func (Icinga2GraphiteService) GetServiceNonStrVars ¶
func (gs Icinga2GraphiteService) GetServiceNonStrVars() map[string]interface{}
func (Icinga2GraphiteService) GetServiceResendTime ¶
func (gs Icinga2GraphiteService) GetServiceResendTime() int
func (Icinga2GraphiteService) GetServiceVars ¶
func (gs Icinga2GraphiteService) GetServiceVars() map[string]interface{}
type Icinga2HTTPService ¶
type Icinga2HTTPService struct { ID string Name string Params CheckHTTPCmdParams CheckAttempts int ResendTime int }
Implements Icinga2Service
func (Icinga2HTTPService) GetServiceCheckAttempts ¶
func (httpS Icinga2HTTPService) GetServiceCheckAttempts() int
func (Icinga2HTTPService) GetServiceCheckCommand ¶
func (httpS Icinga2HTTPService) GetServiceCheckCommand() string
func (Icinga2HTTPService) GetServiceID ¶
func (httpS Icinga2HTTPService) GetServiceID() string
func (Icinga2HTTPService) GetServiceName ¶
func (httpS Icinga2HTTPService) GetServiceName() string
func (Icinga2HTTPService) GetServiceNonStrVars ¶
func (httpS Icinga2HTTPService) GetServiceNonStrVars() map[string]interface{}
func (Icinga2HTTPService) GetServiceResendTime ¶
func (httpS Icinga2HTTPService) GetServiceResendTime() int
func (Icinga2HTTPService) GetServiceVars ¶
func (httpS Icinga2HTTPService) GetServiceVars() map[string]interface{}
type Icinga2Service ¶
type Icinga2TCPService ¶
type Icinga2TCPService struct { ID string Name string Host string Port int CheckAttempts int ResendTime int }
Implements Icinga2Service
func (Icinga2TCPService) GetServiceCheckAttempts ¶
func (tcpS Icinga2TCPService) GetServiceCheckAttempts() int
func (Icinga2TCPService) GetServiceCheckCommand ¶
func (tcpS Icinga2TCPService) GetServiceCheckCommand() string
func (Icinga2TCPService) GetServiceID ¶
func (tcpS Icinga2TCPService) GetServiceID() string
func (Icinga2TCPService) GetServiceName ¶
func (tcpS Icinga2TCPService) GetServiceName() string
func (Icinga2TCPService) GetServiceNonStrVars ¶
func (tcpS Icinga2TCPService) GetServiceNonStrVars() map[string]interface{}
func (Icinga2TCPService) GetServiceResendTime ¶
func (tcpS Icinga2TCPService) GetServiceResendTime() int
func (Icinga2TCPService) GetServiceVars ¶
func (tcpS Icinga2TCPService) GetServiceVars() map[string]interface{}
type Icinga2TemplatedService ¶
type Icinga2TemplatedService interface {
GenerateServices(templates []Template) []Icinga2Service
}
type TCPService ¶
type TCPService struct { ID int `gorm:"primary_key" form:"-"` AlertID int `gorm:"not null" form:"-"` Name string `gorm:"type:varchar(64);not null" form:"name"` Host string `gorm:"type:varchar(64);not null" form:"host"` Port int `gorm:"not null;" form:"port"` CheckAttempts int `gorm:"not null; default 3" form:"check_attempts"` Enabled bool `gorm:"not null" form:"enabled"` ResendTime int `gorm:"not null" form:"resend_time"` CreatedAt time.Time Alert Alert `gorm:"ForeignKey:AlertID"` }
func (*TCPService) GenerateServices ¶
func (tcps *TCPService) GenerateServices(templates []Template) []Icinga2Service
type User ¶
type User struct { ID int `gorm:"primary_key:true" form:"-"` Name string `gorm:"type:varchar(64);not null;unique" form:"-"` EmailAddress string `gorm:"type:varchar(64);not null" form:"email_address"` PhoneNumber string `gorm:"type:varchar(64);not null" form:"phone_number"` BearychatTeam string `gorm:"type:varchar(64);not null" form:"bearychat_team"` BearychatToken string `gorm:"type:varchar(64);not null" form:"bearychat_token"` BearychatChannel string `gorm:"type:varchar(64);not null" form:"bearychat_channel"` PushbulletToken string `gorm:"type:varchar(64);not null" form:"pushbullet_token"` SlackTeam string `gorm:"type:varchar(64);not null" form:"slack_team"` SlackToken string `gorm:"type:varchar(64);not null" form:"slack_token"` SlackChannel string `gorm:"type:varchar(64);not null" form:"slack_channel"` CreatedAt time.Time AdminedAlerts []Alert `gorm:"many2many:alert_to_user_admin"` NotifiedAlerts []Alert `gorm:"many2many:alert_to_user_notify"` }
Click to show internal directories.
Click to hide internal directories.