aboutsummaryrefslogtreecommitdiff
path: root/internal/monitor/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/monitor/http.go')
-rw-r--r--internal/monitor/http.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/monitor/http.go b/internal/monitor/http.go
index ddf8641..cdd7226 100644
--- a/internal/monitor/http.go
+++ b/internal/monitor/http.go
@@ -15,7 +15,9 @@ import (
// HTTPMonitor monitors HTTP and HTTPS endpoints
type HTTPMonitor struct {
+ id string // unique identifier (group/name)
name string
+ group string
monitorType string
target string
interval time.Duration
@@ -82,7 +84,9 @@ func NewHTTPMonitor(cfg config.MonitorConfig) (*HTTPMonitor, error) {
}
return &HTTPMonitor{
+ id: cfg.ID(),
name: cfg.Name,
+ group: cfg.Group,
monitorType: cfg.Type,
target: target,
interval: cfg.Interval.Duration,
@@ -102,11 +106,21 @@ func NewHTTPMonitor(cfg config.MonitorConfig) (*HTTPMonitor, error) {
}, nil
}
+// ID returns the unique identifier for this monitor
+func (m *HTTPMonitor) ID() string {
+ return m.id
+}
+
// Name returns the monitor's name
func (m *HTTPMonitor) Name() string {
return m.name
}
+// Group returns the group this monitor belongs to
+func (m *HTTPMonitor) Group() string {
+ return m.group
+}
+
// Type returns the monitor type
func (m *HTTPMonitor) Type() string {
return m.monitorType
@@ -145,7 +159,7 @@ func (m *HTTPMonitor) RoundUptime() bool {
// Check performs the HTTP/HTTPS check
func (m *HTTPMonitor) Check(ctx context.Context) *Result {
result := &Result{
- MonitorName: m.name,
+ MonitorName: m.id,
Timestamp: time.Now(),
}