|
@@ -46,7 +46,7 @@ var exampleTarget = Target{
|
|
|
Protocol: "https",
|
|
|
}
|
|
|
|
|
|
-//Create a new uptime monitor
|
|
|
+// Create a new uptime monitor
|
|
|
func NewUptimeMonitor(config *Config) (*Monitor, error) {
|
|
|
//Create new monitor object
|
|
|
thisMonitor := Monitor{
|
|
@@ -140,8 +140,8 @@ func (m *Monitor) RemoveTargetFromMonitor(targetId string) {
|
|
|
delete(m.OnlineStatusLog, targetId)
|
|
|
}
|
|
|
|
|
|
-//Scan the config target. If a target exists in m.OnlineStatusLog no longer
|
|
|
-//exists in m.Monitor.Config.Targets, it remove it from the log as well.
|
|
|
+// Scan the config target. If a target exists in m.OnlineStatusLog no longer
|
|
|
+// exists in m.Monitor.Config.Targets, it remove it from the log as well.
|
|
|
func (m *Monitor) CleanRecords() {
|
|
|
// Create a set of IDs for all targets in the config
|
|
|
targetIDs := make(map[string]bool)
|
|
@@ -223,5 +223,6 @@ func getWebsiteStatus(url string) (int, error) {
|
|
|
return 0, err
|
|
|
}
|
|
|
status_code := resp.StatusCode
|
|
|
+ resp.Body.Close()
|
|
|
return status_code, nil
|
|
|
}
|