Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // LogPath is the directory on disk where repmon logs will be stored. Defaults to /var/log/repmon. LogPath string `yaml:"log_path"` // LogLevel sets the level of logging. Valid levels are: panic, fatal, trace, debug, warn, info, and error. Defaults to error LogLevel string `yaml:"log_level"` // Frequency describes how often the replication status will be checked Frequency string `yaml:"frequency"` // SlaveSQLRunningField is the field checked in the database determine if slave sql is running. Defaults to Slave_SQL_Running and likely never // needs to be changed. SlaveSQLRunningField string `yaml:"slave_sql_running_field"` // SlaveIORunningField is the field checked in the database to determine if slave io is running. Defaults to Slave_IO_Running and likely never // needs to be changed. SlaveIORunningField string `yaml:"slave_io_running_field"` // SecondsBehindMasterField is the field checked in the database to determine if the seconds replica is behind master. // Defaults to Seconds_Behind_Master and likely never needs to be changed. SecondsBehindMasterField string `yaml:"seconds_behind_master_field"` // SecondsBehindMasterThreshold is the seconds behind master where we will send a notification email. It must be greather // than 0 and defaults to 36000 (10 hours). SecondsBehindMasterThreshold int `yaml:"seconds_behind_master_threshold"` HTTP *HTTP `yaml:"http"` MySQL *MySQL `yaml:"mysql"` Email *Email `yaml:"email"` // contains filtered or unexported fields }
func OpenConfig ¶
OpenConfig returns a new Config option by reading the YAML file at path. If the file doesn't exist, can't be read, is invalid YAML, or doesn't match the repmon spec then an error is returned.
type Email ¶
type Email struct { // Host is the hostname or IP of the SMTP server. Host string `yaml:"host"` // Port is the port of the SMTP server. Port int `yaml:"port"` // User is the username used to authenticate. User string `yaml:"user"` // Pass is the password used to authenticate. Pass string `yaml:"pass"` // StartTLS enables TLS security. If both StartTLS and SSL are true then StartTLS will be used. StartTLS bool `yaml:"starttls"` // Skip verifying the server's certificate chain and host name. InsecureSkipVerify bool `yaml:"insecure_skip_verify"` // SSL enables SSL security. If both StartTLS and SSL are true then StartTLS will be used. SSL bool `yaml:"ssl"` // Optional subject field for notification emails Subject string `yaml:"subject"` // From is the email address the email will be sent from. From string `yaml:"from"` // To is an array of email addresses for which emails will be sent. To []string `yaml:"to"` }
type EmailNotifier ¶
type EmailNotifier struct {
// contains filtered or unexported fields
}
EmailNotifier sends emails based on repliaction failure
func NewEmailNotifier ¶
func NewEmailNotifier(config *Config) *EmailNotifier
NewEmailNotifier creates a EmailNotifier using the config
func (*EmailNotifier) Notify ¶
func (n *EmailNotifier) Notify(err error) error
Notify sends a failure notification
type HTTP ¶
type HTTP struct { // The address the http server will listen on. Addr string `yaml:"addr"` // The port the http server will listen on. Port int `yaml:"port"` }
HTTP defines the configuration for http health checks.
type MySQL ¶
type MySQL struct { // Host is the hostname or IP of the MySQL server. Host string `yaml:"host"` // Port is the port of the MySQL server. Ignored if SocketPath is not the empty string Port int `yaml:"port"` // User is the username used to authenticate. User string `yaml:"user"` // Pass is the password used to authenticate. Pass string `yaml:"pass"` // SocketPath is the path to the unix socket. If set to the empty string then a TCP connection is used instead. SocketPath string `yaml:"socket_path"` }
type MySQLReplicationChecker ¶
type MySQLReplicationChecker struct {
// contains filtered or unexported fields
}
MySQLReplicationChecker checks if replication is running on a given MySQL 5.5 database.
func NewMySQLReplicationChecker ¶
func NewMySQLReplicationChecker(db *sql.DB, config *Config) *MySQLReplicationChecker
MySQLReplicationChecker returns a new MySQL replication checker.
func (*MySQLReplicationChecker) Replicating ¶
func (d *MySQLReplicationChecker) Replicating() error
Replicating checks if replication is running. It returns an error if replication isn't running or the replica is behind by more than the configured seconds threshold.
type RepMon ¶
type RepMon struct {
// contains filtered or unexported fields
}
RepMon monitors a database to ensure that replication is running.
type ReplicationChecker ¶
type ReplicationChecker interface {
Replicating() error
}
ReplicationChecker defines a replication check for a database