models

package
v0.0.0-...-83f9451 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Online The service is online
	Online = "ONLINE"
	// Pending The service is potentially offline, and will be marked so after meeting the Config.FailedCheckThreshold
	Pending = "PENDING"
	// Offline The service is offline
	Offline = "OFFLINE"
)

Variables

View Source
var (
	// CurrentServices The currently monitored services
	CurrentServices []Service
)
View Source
var Database *sqlx.DB

Database The sqlite3 database

Functions

func Connect

func Connect()

Connect Connects to the sqlite3 database, and creates the database if it does not already exist

func LoadServices

func LoadServices()

LoadServices Loads all the services into CurrentServices and sets defaults

Types

type Config

type Config struct {
	Verbose                     bool     `json:"verbose"`
	WebUIHost                   string   `json:"web_ui_host"`
	WebUIPort                   int      `json:"web_ui_port"`
	CheckInterval               int      `json:"check_interval"`
	PendingOfflineCheckInterval int      `json:"pending_offline_check_interval"`
	MaxConcurrentChecks         int      `json:"max_concurrent_checks"`
	ConnectionTimeout           int      `json:"connection_timeout"`
	SuccessfulHTTPStatusCodes   []int    `json:"successful_http_status_codes"`
	IgnoreHTTPSCertErrors       bool     `json:"ignore_https_cert_errors"`
	FailedCheckThreshold        int      `json:"failed_check_threshold"`
	SendEmail                   bool     `json:"send_email"`
	EmailRecipients             []string `json:"email_recipients"`
	SMTPHost                    string   `json:"smtp_host"`
	SMTPPort                    int      `json:"smtp_port"`
	SMTPEmailAddress            string   `json:"smtp_email_address"`
	SMTPUsername                string   `json:"smtp_username"`
	SMTPPassword                string   `json:"smtp_password"`
	SendSMS                     bool     `json:"send_sms"`
	SMSRecipients               []string `json:"sms_recipients"`
	TwilioAccountSID            string   `json:"twilio_account_sid"`
	TwilioAuthToken             string   `json:"twilio_auth_token"`
	TwilioPhoneNumber           string   `json:"twilio_phone_number"`
}

Config The application configuration and settings

var (
	// CurrentConfig The current configuration
	CurrentConfig Config
)

func ParseConfigFile

func ParseConfigFile() Config

ParseConfigFile Parses the config.json file

type Service

type Service struct {
	ID           int           `db:"id" json:"id"`
	Name         string        `db:"name" json:"name"`
	Protocol     string        `db:"protocol" json:"protocol"`
	Host         string        `db:"host" json:"host"`
	Port         jsonNullInt64 `db:"port" json:"port"`
	UptimeStart  int64         `json:"uptime_start"`
	Status       string        `json:"status"`
	FailureCount int           `json:"failure_count"`
}

Service Represents a service that is being monitored

func (*Service) CheckService

func (service *Service) CheckService() bool

CheckService Checks whether a service is online or offline

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL