Documentation ¶
Index ¶
- func CloseOutPreviousOutages(dbConn *storage.Connection) error
- func GetDeletedSites(dbConn *storage.Connection) map[int]Website
- func GetSites(dbConn *storage.Connection) map[int]Website
- type CertificateInfo
- type Outage
- type Website
- func (s *Website) CalcUptime(days int, dbConn *storage.Connection) float64
- func (s *Website) Destroy(c *chan string, dbConn *storage.Connection, logger *logrus.Logger)
- func (s *Website) GetAddressWithoutProtocol() string
- func (s *Website) GetCertificateInfo() (CertificateInfo, error)
- func (s *Website) GetDomain() string
- func (s *Website) GetDomainInfo() (WhoisInfo, error)
- func (s *Website) GetSiteID(dbConn *storage.Connection) int
- func (s *Website) Monitor(shutdownChan *chan string)
- func (s *Website) Outages(dbConn *storage.Connection) []Outage
- func (s *Website) Purge(dbConn *storage.Connection, logger *logrus.Logger)
- func (s *Website) Restore(dbConn *storage.Connection, logger *logrus.Logger)
- type WhoisInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseOutPreviousOutages ¶
func CloseOutPreviousOutages(dbConn *storage.Connection) error
CloseOutPreviousOutages - run this to set any lingering outages to be closed
func GetDeletedSites ¶
func GetDeletedSites(dbConn *storage.Connection) map[int]Website
GetDeletedSites - get all the sites out of the storage connection
Types ¶
type CertificateInfo ¶
type Outage ¶
type Outage struct { Start time.Time `json:"start"` End time.Time `json:"end"` Duration float64 `json:"duration"` }
Outage - a specific instance of a site going down
type Website ¶
type Website struct { IsUp bool DB *storage.Connection Logger *logrus.Logger ID int URL string // contains filtered or unexported fields }
Website - a site that we will be checking
func Create ¶
func Create(address string, dbConn *storage.Connection, logger *logrus.Logger, client *http.Client, timeout int) Website
Create - Make a new instance of a Website
func FindWebsiteByID ¶
FindWebsiteByID - Find a site in the DB by it's ID
func FindWebsiteByURL ¶
func FindWebsiteByURL(url string, dbConn *storage.Connection, logger *logrus.Logger) (Website, error)
FindWebsiteByURL - Find a site in the DB by it's URL
func (*Website) CalcUptime ¶
func (s *Website) CalcUptime(days int, dbConn *storage.Connection) float64
CalcUptime - Calculate the percentage of uptime over the last X days
func (*Website) GetAddressWithoutProtocol ¶
func (*Website) GetCertificateInfo ¶
func (s *Website) GetCertificateInfo() (CertificateInfo, error)
func (*Website) GetDomainInfo ¶
func (*Website) GetSiteID ¶
func (s *Website) GetSiteID(dbConn *storage.Connection) int
GetSiteID - the the ID of the current website by it's URL
func (*Website) Monitor ¶
Monitor - periodically make an HTTP GET request to the site's URL, and optionally log it in the database
func (*Website) Outages ¶
func (s *Website) Outages(dbConn *storage.Connection) []Outage
Outages - return all the outages for a given site