aboutsummaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-19 19:41:22 -0800
committerFuwn <[email protected]>2026-01-19 19:41:22 -0800
commit5cb6f53da0f5927edad01e854432eb0b70371b89 (patch)
tree133824d444dc38134996eadb30a34ed63b44cfd1 /internal/config/config.go
parentfeat: Add disable_ping_tooltips option to hide ping hover details (diff)
downloadkaze-5cb6f53da0f5927edad01e854432eb0b70371b89.tar.xz
kaze-5cb6f53da0f5927edad01e854432eb0b70371b89.zip
feat: Add ICMP, DNS, and GraphQL monitor types
Add three new monitor types with full support: - ICMP: Ping monitoring with configurable packet count, tracks packet loss and average RTT. Marks degraded on partial packet loss. - DNS: DNS resolution monitoring supporting A, AAAA, CNAME, MX, and TXT records. Optional custom DNS server and validation of expected IPs/CNAME. - GraphQL: GraphQL endpoint monitoring with query execution, variable support, error detection, and content validation. All new monitors include retry support, response time tracking, and integrate with existing display options (round_response_time, etc). GraphQL monitors also support SSL certificate tracking.
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 7ed28dd..71a9b99 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -93,6 +93,16 @@ type MonitorConfig struct {
UserAgent string `yaml:"user_agent,omitempty"` // Custom User-Agent header (default: "Kaze-Monitor/1.0")
Headers map[string]string `yaml:"headers,omitempty"`
Body string `yaml:"body,omitempty"`
+ // ICMP specific fields
+ PingCount int `yaml:"ping_count,omitempty"` // Number of ICMP packets to send (default: 4)
+ // DNS specific fields
+ DNSServer string `yaml:"dns_server,omitempty"` // DNS server to query (default: system resolver)
+ ExpectedIPs []string `yaml:"expected_ips,omitempty"` // Expected IP addresses for DNS resolution
+ ExpectedCNAME string `yaml:"expected_cname,omitempty"` // Expected CNAME record
+ RecordType string `yaml:"record_type,omitempty"` // DNS record type (A, AAAA, CNAME, MX, TXT, etc.)
+ // GraphQL specific fields
+ GraphQLQuery string `yaml:"graphql_query,omitempty"` // GraphQL query to execute
+ GraphQLVariables map[string]string `yaml:"graphql_variables,omitempty"` // GraphQL query variables
}
// IncidentConfig represents an incident or maintenance
@@ -300,10 +310,15 @@ func (c *Config) validate() error {
}
switch monitor.Type {
- case "http", "https", "tcp", "gemini":
+ case "http", "https", "tcp", "gemini", "icmp", "dns", "graphql":
// Valid types
default:
- return fmt.Errorf("monitor %q has invalid type %q (must be http, https, tcp, or gemini)", monitor.Name, monitor.Type)
+ return fmt.Errorf("monitor %q has invalid type %q (must be http, https, tcp, gemini, icmp, dns, or graphql)", monitor.Name, monitor.Type)
+ }
+
+ // Type-specific validation
+ if monitor.Type == "graphql" && monitor.GraphQLQuery == "" {
+ return fmt.Errorf("monitor %q is type 'graphql' but missing required 'graphql_query' field", monitor.Name)
}
}
}