Documentation
¶
Index ¶
- Constants
- func DefaultTelegramNotificationTypes() []string
- func ParseSize(s string) uint64
- func Save(path string, cfg *Config) error
- type AIAutoActionConfig
- type AIConfig
- type AISchedulerConfig
- type AnomalyConfig
- type Config
- type ControllerConfig
- type HungProcessConfig
- type MemoryLeakConfig
- type MonitoringConfig
- type NetworkAnomalyConfig
- type NewProcessConfig
- type NotificationsConfig
- type OrphanConfig
- type PortConflictConfig
- type Rule
- type RunawayCPUConfig
- type ServerConfig
- type SpawnStormConfig
- type TelegramConfig
- type UIConfig
Constants ¶
const CurrentSchemaVersion = 2
CurrentSchemaVersion is bumped whenever we ship a breaking defaults change that should be forced onto existing user configs. Loader checks this after unmarshal and resets the relevant sections to the new defaults.
1 — original layout
2 — turn off hung/orphan/port/network detectors by default; only real
dangers (runaway CPU, memory leak, giant spawn storms) fire by default
Variables ¶
This section is empty.
Functions ¶
func DefaultTelegramNotificationTypes ¶ added in v0.2.0
func DefaultTelegramNotificationTypes() []string
Types ¶
type AIAutoActionConfig ¶
type AIConfig ¶
type AIConfig struct {
Enabled bool `yaml:"enabled"`
Provider string `yaml:"provider"`
APIKey string `yaml:"api_key"`
Model string `yaml:"model"`
Endpoint string `yaml:"endpoint"`
ExtraHeaders map[string]string `yaml:"extra_headers"`
AutoAnalyzeOnCritical bool `yaml:"auto_analyze_on_critical"`
MaxTokens int `yaml:"max_tokens"`
MaxRequestsPerMinute int `yaml:"max_requests_per_minute"`
Language string `yaml:"language"`
IncludeProcessTree bool `yaml:"include_process_tree"`
IncludePortMap bool `yaml:"include_port_map"`
HistoryContextDuration time.Duration `yaml:"history_context_duration"`
Scheduler AISchedulerConfig `yaml:"scheduler"`
AutoAction AIAutoActionConfig `yaml:"auto_action"`
}
type AISchedulerConfig ¶
type AISchedulerConfig struct {
Enabled bool `yaml:"enabled"`
MinInterval time.Duration `yaml:"min_interval"`
MaxCyclesPerHour int `yaml:"max_cycles_per_hour"`
MaxReservedTokensPerDay int `yaml:"max_reserved_tokens_per_day"`
CooldownAfterError time.Duration `yaml:"cooldown_after_error"`
HistoryLimit int `yaml:"history_limit"`
}
type AnomalyConfig ¶
type AnomalyConfig struct {
AnalysisInterval time.Duration `yaml:"analysis_interval"`
IgnoreProcesses []string `yaml:"ignore_processes"`
MaxActiveAlerts int `yaml:"max_active_alerts"`
SpawnStorm SpawnStormConfig `yaml:"spawn_storm"`
MemoryLeak MemoryLeakConfig `yaml:"memory_leak"`
HungProcess HungProcessConfig `yaml:"hung_process"`
Orphan OrphanConfig `yaml:"orphan"`
RunawayCPU RunawayCPUConfig `yaml:"runaway_cpu"`
PortConflict PortConflictConfig `yaml:"port_conflict"`
NetworkAnomaly NetworkAnomalyConfig `yaml:"network_anomaly"`
NewProcess NewProcessConfig `yaml:"new_process"`
}
type Config ¶
type Config struct {
SchemaVersion int `yaml:"schema_version"`
Server ServerConfig `yaml:"server"`
Monitoring MonitoringConfig `yaml:"monitoring"`
Controller ControllerConfig `yaml:"controller"`
Anomaly AnomalyConfig `yaml:"anomaly"`
Notifications NotificationsConfig `yaml:"notifications"`
WellKnownPorts map[uint16]string `yaml:"well_known_ports"`
AI AIConfig `yaml:"ai"`
Telegram TelegramConfig `yaml:"telegram"`
UI UIConfig `yaml:"ui"`
Rules []Rule `yaml:"rules"`
}
Config is the root configuration tree.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns sensible defaults for all settings.
type ControllerConfig ¶
type HungProcessConfig ¶
type MemoryLeakConfig ¶
type MonitoringConfig ¶
type MonitoringConfig struct {
Interval time.Duration `yaml:"interval"`
ProcessTreeInterval time.Duration `yaml:"process_tree_interval"`
PortScanInterval time.Duration `yaml:"port_scan_interval"`
GPUInterval time.Duration `yaml:"gpu_interval"`
HistoryDuration time.Duration `yaml:"history_duration"`
MaxProcesses int `yaml:"max_processes"`
}
type NetworkAnomalyConfig ¶
type NewProcessConfig ¶
type NotificationsConfig ¶
type OrphanConfig ¶
type PortConflictConfig ¶
type Rule ¶
type Rule struct {
Name string `yaml:"name" json:"name"`
Enabled bool `yaml:"enabled" json:"enabled"`
Match string `yaml:"match" json:"match"` // case-insensitive substring of process name
Metric string `yaml:"metric" json:"metric"` // "cpu_percent" | "memory_bytes" | "thread_count"
Op string `yaml:"op" json:"op"` // ">" | ">=" | "<" | "<=" (default ">=")
Threshold float64 `yaml:"threshold" json:"threshold"` // bytes for memory, percent for cpu, count for threads
For time.Duration `yaml:"for" json:"for"` // min duration condition must hold (0 = immediate)
Action string `yaml:"action" json:"action"` // "kill" | "suspend" | "alert"
Cooldown time.Duration `yaml:"cooldown" json:"cooldown"` // min gap between repeat actions on same pid (default 1m)
}
Rule is a single user-defined automation rule. It says "when a process matching `match` satisfies `when` for at least `for` seconds, do `action`". Rules are evaluated on every anomaly tick and hot-reload with the config.
type RunawayCPUConfig ¶
type RunawayCPUConfig struct {
Enabled bool `yaml:"enabled"`
CPUThreshold int `yaml:"cpu_threshold"`
DurationThreshold time.Duration `yaml:"duration_threshold"`
CriticalDuration time.Duration `yaml:"critical_duration"`
HighCPUWhitelist []string `yaml:"high_cpu_whitelist"`
Action string `yaml:"action"`
}
type ServerConfig ¶
type SpawnStormConfig ¶
type TelegramConfig ¶
type TelegramConfig struct {
Enabled bool `yaml:"enabled"`
BotToken string `yaml:"bot_token"`
AllowedChatIDs []int64 `yaml:"allowed_chat_ids"`
APIBaseURL string `yaml:"api_base_url"`
PollTimeout time.Duration `yaml:"poll_timeout"`
NotifyOnCritical bool `yaml:"notify_on_critical"`
NotificationMode string `yaml:"notification_mode"`
NotificationTypes []string `yaml:"notification_types"`
RequireConfirm bool `yaml:"require_confirm"`
ConfirmTTL time.Duration `yaml:"confirm_ttl"`
}