Documentation
¶
Overview ¶
Package agent is a generated GoMock package.
Package agent pkg/agent/push_loop.go
Package agent pkg/agent/server.go
Package agent pkg/agent/snmp_service.go
Package agent pkg/agent/sysmon_service.go
Package agent pkg/agent/types.go
Index ¶
- Constants
- Variables
- type Duration
- type ICMPChecker
- type ICMPResponse
- type IPSorter
- type KVStore
- type MapperResultPublisher
- func (p *MapperResultPublisher) Drain(max int) ([]map[string]interface{}, bool)
- func (p *MapperResultPublisher) DrainInterfaces(max int) ([]map[string]interface{}, bool)
- func (p *MapperResultPublisher) DrainTopology(max int) ([]map[string]interface{}, bool)
- func (p *MapperResultPublisher) PublishDevice(_ context.Context, device *mapper.DiscoveredDevice) error
- func (p *MapperResultPublisher) PublishInterface(_ context.Context, iface *mapper.DiscoveredInterface) error
- func (p *MapperResultPublisher) PublishTopologyLink(_ context.Context, link *mapper.TopologyLink) error
- type MapperService
- func (s *MapperService) ApplyMapperConfig(cfg *mapper.Config, hash string) error
- func (s *MapperService) DrainInterfaces(max int) ([]map[string]interface{}, bool)
- func (s *MapperService) DrainResults(max int) ([]map[string]interface{}, bool)
- func (s *MapperService) DrainTopology(max int) ([]map[string]interface{}, bool)
- func (s *MapperService) GetConfigHash() string
- func (*MapperService) Name() string
- func (s *MapperService) RunScheduledJob(ctx context.Context, jobName string) (string, error)
- func (s *MapperService) Start(ctx context.Context) error
- func (s *MapperService) Stop(ctx context.Context) error
- func (s *MapperService) UpdateConfig(cfg *models.Config) error
- type MockKVStore
- func (m *MockKVStore) Close() error
- func (m *MockKVStore) Create(arg0 context.Context, arg1 string, arg2 []byte, arg3 time.Duration) error
- func (m *MockKVStore) Delete(arg0 context.Context, arg1 string) error
- func (m *MockKVStore) EXPECT() *MockKVStoreMockRecorder
- func (m *MockKVStore) Get(arg0 context.Context, arg1 string) ([]byte, bool, error)
- func (m *MockKVStore) Put(arg0 context.Context, arg1 string, arg2 []byte, arg3 time.Duration) error
- func (m *MockKVStore) Watch(arg0 context.Context, arg1 string) (<-chan []byte, error)
- type MockKVStoreMockRecorder
- func (mr *MockKVStoreMockRecorder) Close() *gomock.Call
- func (mr *MockKVStoreMockRecorder) Create(arg0, arg1, arg2, arg3 any) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Delete(arg0, arg1 any) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Get(arg0, arg1 any) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Put(arg0, arg1, arg2, arg3 any) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Watch(arg0, arg1 any) *gomock.Call
- type MockObjectStore
- type MockObjectStoreMockRecorder
- type MockService
- type MockServiceMockRecorder
- type MockSweepStatusProvider
- type MockSweepStatusProviderMockRecorder
- type MultiSweepService
- func (s *MultiSweepService) GetConfigHash() string
- func (s *MultiSweepService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
- func (s *MultiSweepService) GetSweepResults(ctx context.Context, _ string) (*proto.ResultsResponse, error)
- func (*MultiSweepService) Name() string
- func (s *MultiSweepService) RunSweepGroup(ctx context.Context, groupID string) error
- func (s *MultiSweepService) Start(ctx context.Context) error
- func (s *MultiSweepService) Stop(_ context.Context) error
- func (s *MultiSweepService) UpdateConfig(config *models.Config) error
- func (s *MultiSweepService) UpdateSweepGroups(config *SweepGroupsConfig) error
- type ObjectStore
- type PluginEngineSnapshot
- type PluginManager
- type PluginManagerConfig
- type PluginResult
- type PushLoop
- type SNMPAgentService
- func (s *SNMPAgentService) ApplyProtoConfig(ctx context.Context, protoConfig *proto.SNMPConfig) error
- func (s *SNMPAgentService) DrainMetrics(ctx context.Context) (map[string][]snmp.DataPoint, error)
- func (s *SNMPAgentService) GetConfigHash() string
- func (s *SNMPAgentService) GetConfigSource() string
- func (s *SNMPAgentService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
- func (s *SNMPAgentService) GetTargetStatuses(ctx context.Context) (map[string]snmp.TargetStatus, error)
- func (s *SNMPAgentService) IsEnabled() bool
- func (s *SNMPAgentService) Name() string
- func (s *SNMPAgentService) Start(ctx context.Context) error
- func (s *SNMPAgentService) Stop(ctx context.Context) error
- type SNMPAgentServiceConfig
- type SNMPServiceFactory
- type ScanStats
- type Server
- func (s *Server) Close(ctx context.Context) error
- func (s *Server) GetSNMPStatus(ctx context.Context) (*proto.StatusResponse, error)
- func (s *Server) GetSysmonStatus(ctx context.Context) (*sysmon.MetricSample, error)
- func (s *Server) RestartServices(ctx context.Context)
- func (s *Server) SecurityConfig() *models.SecurityConfig
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(_ context.Context) error
- func (s *Server) UpdateConfig(newCfg *ServerConfig)
- type ServerConfig
- type Service
- type ServiceError
- type SweepConfig
- type SweepGroupConfig
- type SweepGroupConfigUpdater
- type SweepGroupsConfig
- type SweepResultsProvider
- type SweepService
- func (s *SweepService) Check(ctx context.Context, _ *proto.StatusRequest) (bool, json.RawMessage)
- func (s *SweepService) CheckICMP(ctx context.Context, host string) (*models.Result, error)
- func (s *SweepService) Close() error
- func (s *SweepService) GetConfigHash() string
- func (s *SweepService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
- func (s *SweepService) GetSweepResults(ctx context.Context, lastSequence string) (*proto.ResultsResponse, error)
- func (*SweepService) Name() string
- func (s *SweepService) RunOnce(ctx context.Context) error
- func (s *SweepService) SetExecutionContext(sweepGroupID, configHash string)
- func (s *SweepService) Start(ctx context.Context) error
- func (s *SweepService) Stop(_ context.Context) error
- func (s *SweepService) UpdateConfig(config *models.Config) error
- type SweepStatusProvider
- type SyncRuntime
- type SysmonService
- func (s *SysmonService) DrainMetrics() []*sysmon.MetricSample
- func (s *SysmonService) GetConfigHash() string
- func (s *SysmonService) GetConfigSource() string
- func (s *SysmonService) GetLatestSample() *sysmon.MetricSample
- func (s *SysmonService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
- func (s *SysmonService) IsEnabled() bool
- func (s *SysmonService) Name() string
- func (s *SysmonService) Reconfigure(config *sysmon.ParsedConfig) error
- func (s *SysmonService) Start(ctx context.Context) error
- func (s *SysmonService) Stop(ctx context.Context) error
- type SysmonServiceConfig
Constants ¶
const ( // SNMPServiceName is the name used for SNMP in status reports. SNMPServiceName = "snmp" // SNMPServiceType is the type identifier for SNMP services. SNMPServiceType = "snmp" )
const ( // SysmonServiceName is the name used for sysmon in status reports. SysmonServiceName = "sysmon" // SysmonServiceType is the type identifier for sysmon services. SysmonServiceType = "sysmon" )
Variables ¶
var ( // ErrAgentIDRequired indicates agent_id is required in configuration ErrAgentIDRequired = errors.New("agent_id is required in configuration") )
var ErrCollectorNotInitialized = fmt.Errorf("collector not initialized")
ErrCollectorNotInitialized is returned when attempting to reconfigure before starting.
var ErrNilProtoConfig = fmt.Errorf("nil proto config")
ErrNilProtoConfig is returned when a nil proto config is passed to ApplyProtoConfig.
var ErrSNMPServiceNotInitialized = fmt.Errorf("SNMP service not initialized")
ErrSNMPServiceNotInitialized is returned when attempting to reconfigure before starting.
var Version = "dev"
Version is set at build time via -ldflags
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration represents a time duration that can be unmarshaled from JSON.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface to allow parsing of a Duration from a JSON string or number.
type ICMPChecker ¶
ICMPChecker performs ICMP checks using a pre-configured scanner.
func NewICMPChecker ¶
func NewICMPChecker(host string, log logger.Logger) (*ICMPChecker, error)
func NewICMPCheckerWithDeviceID ¶
func NewICMPCheckerWithDeviceID(host, deviceID string, log logger.Logger) (*ICMPChecker, error)
func (*ICMPChecker) Check ¶
func (p *ICMPChecker) Check(ctx context.Context, req *proto.StatusRequest) (isAccessible bool, statusMsg json.RawMessage)
type ICMPResponse ¶
type ICMPResponse struct {
Host string `json:"host"`
ResponseTime int64 `json:"response_time"` // in nanoseconds
PacketLoss float64 `json:"packet_loss"`
Available bool `json:"available"`
AgentID string `json:"agent_id,omitempty"` // Optional agent ID for context
GatewayID string `json:"gateway_id,omitempty"` // Optional gateway ID for context
DeviceID string `json:"device_id,omitempty"` // Device ID for proper correlation (partition:host_ip)
}
ICMPResponse defines the structure of the ICMP check result.
type KVStore ¶
KVStore defines the interface for key-value store operations. It embeds the shared configuration KV interface so agent stores remain compatible with the config loader while allowing optional extensions (e.g. PutIfAbsent).
type MapperResultPublisher ¶ added in v1.0.79
type MapperResultPublisher struct {
// contains filtered or unexported fields
}
MapperResultPublisher buffers discovered devices for push-based ingestion.
func NewMapperResultPublisher ¶ added in v1.0.79
func NewMapperResultPublisher() *MapperResultPublisher
func (*MapperResultPublisher) Drain ¶ added in v1.0.79
func (p *MapperResultPublisher) Drain(max int) ([]map[string]interface{}, bool)
func (*MapperResultPublisher) DrainInterfaces ¶ added in v1.0.79
func (p *MapperResultPublisher) DrainInterfaces(max int) ([]map[string]interface{}, bool)
func (*MapperResultPublisher) DrainTopology ¶ added in v1.0.79
func (p *MapperResultPublisher) DrainTopology(max int) ([]map[string]interface{}, bool)
func (*MapperResultPublisher) PublishDevice ¶ added in v1.0.79
func (p *MapperResultPublisher) PublishDevice(_ context.Context, device *mapper.DiscoveredDevice) error
func (*MapperResultPublisher) PublishInterface ¶ added in v1.0.79
func (p *MapperResultPublisher) PublishInterface(_ context.Context, iface *mapper.DiscoveredInterface) error
func (*MapperResultPublisher) PublishTopologyLink ¶ added in v1.0.79
func (p *MapperResultPublisher) PublishTopologyLink(_ context.Context, link *mapper.TopologyLink) error
type MapperService ¶ added in v1.0.79
type MapperService struct {
// contains filtered or unexported fields
}
MapperService wraps the mapper discovery engine for embedded agent use.
func NewMapperService ¶ added in v1.0.79
func (*MapperService) ApplyMapperConfig ¶ added in v1.0.79
func (s *MapperService) ApplyMapperConfig(cfg *mapper.Config, hash string) error
func (*MapperService) DrainInterfaces ¶ added in v1.0.79
func (s *MapperService) DrainInterfaces(max int) ([]map[string]interface{}, bool)
func (*MapperService) DrainResults ¶ added in v1.0.79
func (s *MapperService) DrainResults(max int) ([]map[string]interface{}, bool)
func (*MapperService) DrainTopology ¶ added in v1.0.79
func (s *MapperService) DrainTopology(max int) ([]map[string]interface{}, bool)
func (*MapperService) GetConfigHash ¶ added in v1.0.79
func (s *MapperService) GetConfigHash() string
func (*MapperService) Name ¶ added in v1.0.79
func (*MapperService) Name() string
func (*MapperService) RunScheduledJob ¶ added in v1.0.91
func (*MapperService) Start ¶ added in v1.0.79
func (s *MapperService) Start(ctx context.Context) error
func (*MapperService) Stop ¶ added in v1.0.79
func (s *MapperService) Stop(ctx context.Context) error
func (*MapperService) UpdateConfig ¶ added in v1.0.79
func (s *MapperService) UpdateConfig(cfg *models.Config) error
type MockKVStore ¶
type MockKVStore struct {
// contains filtered or unexported fields
}
MockKVStore is a mock of KVStore interface.
func NewMockKVStore ¶
func NewMockKVStore(ctrl *gomock.Controller) *MockKVStore
NewMockKVStore creates a new mock instance.
func (*MockKVStore) Create ¶ added in v1.0.55
func (m *MockKVStore) Create(arg0 context.Context, arg1 string, arg2 []byte, arg3 time.Duration) error
Create mocks base method.
func (*MockKVStore) Delete ¶
func (m *MockKVStore) Delete(arg0 context.Context, arg1 string) error
Delete mocks base method.
func (*MockKVStore) EXPECT ¶
func (m *MockKVStore) EXPECT() *MockKVStoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockKVStoreMockRecorder ¶
type MockKVStoreMockRecorder struct {
// contains filtered or unexported fields
}
MockKVStoreMockRecorder is the mock recorder for MockKVStore.
func (*MockKVStoreMockRecorder) Close ¶
func (mr *MockKVStoreMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockKVStoreMockRecorder) Create ¶ added in v1.0.55
func (mr *MockKVStoreMockRecorder) Create(arg0, arg1, arg2, arg3 any) *gomock.Call
Create indicates an expected call of Create.
func (*MockKVStoreMockRecorder) Delete ¶
func (mr *MockKVStoreMockRecorder) Delete(arg0, arg1 any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockKVStoreMockRecorder) Get ¶
func (mr *MockKVStoreMockRecorder) Get(arg0, arg1 any) *gomock.Call
Get indicates an expected call of Get.
type MockObjectStore ¶ added in v1.0.55
type MockObjectStore struct {
// contains filtered or unexported fields
}
MockObjectStore is a mock of ObjectStore interface.
func NewMockObjectStore ¶ added in v1.0.55
func NewMockObjectStore(ctrl *gomock.Controller) *MockObjectStore
NewMockObjectStore creates a new mock instance.
func (*MockObjectStore) DownloadObject ¶ added in v1.0.55
DownloadObject mocks base method.
func (*MockObjectStore) EXPECT ¶ added in v1.0.55
func (m *MockObjectStore) EXPECT() *MockObjectStoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockObjectStoreMockRecorder ¶ added in v1.0.55
type MockObjectStoreMockRecorder struct {
// contains filtered or unexported fields
}
MockObjectStoreMockRecorder is the mock recorder for MockObjectStore.
func (*MockObjectStoreMockRecorder) DownloadObject ¶ added in v1.0.55
func (mr *MockObjectStoreMockRecorder) DownloadObject(arg0, arg1 any) *gomock.Call
DownloadObject indicates an expected call of DownloadObject.
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) EXPECT ¶
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) Start ¶
func (m *MockService) Start(arg0 context.Context) error
Start mocks base method.
func (*MockService) Stop ¶
func (m *MockService) Stop(arg0 context.Context) error
Stop mocks base method.
func (*MockService) UpdateConfig ¶
func (m *MockService) UpdateConfig(arg0 *models.Config) error
UpdateConfig mocks base method.
type MockServiceMockRecorder ¶
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) Name ¶
func (mr *MockServiceMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockServiceMockRecorder) Start ¶
func (mr *MockServiceMockRecorder) Start(arg0 any) *gomock.Call
Start indicates an expected call of Start.
func (*MockServiceMockRecorder) Stop ¶
func (mr *MockServiceMockRecorder) Stop(arg0 any) *gomock.Call
Stop indicates an expected call of Stop.
func (*MockServiceMockRecorder) UpdateConfig ¶
func (mr *MockServiceMockRecorder) UpdateConfig(arg0 any) *gomock.Call
UpdateConfig indicates an expected call of UpdateConfig.
type MockSweepStatusProvider ¶
type MockSweepStatusProvider struct {
// contains filtered or unexported fields
}
MockSweepStatusProvider is a mock of SweepStatusProvider interface.
func NewMockSweepStatusProvider ¶
func NewMockSweepStatusProvider(ctrl *gomock.Controller) *MockSweepStatusProvider
NewMockSweepStatusProvider creates a new mock instance.
func (*MockSweepStatusProvider) EXPECT ¶
func (m *MockSweepStatusProvider) EXPECT() *MockSweepStatusProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSweepStatusProvider) GetStatus ¶
func (m *MockSweepStatusProvider) GetStatus(arg0 context.Context) (*proto.StatusResponse, error)
GetStatus mocks base method.
type MockSweepStatusProviderMockRecorder ¶
type MockSweepStatusProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockSweepStatusProviderMockRecorder is the mock recorder for MockSweepStatusProvider.
type MultiSweepService ¶ added in v1.0.90
type MultiSweepService struct {
// contains filtered or unexported fields
}
MultiSweepService manages multiple sweep groups and schedules them independently.
func NewMultiSweepService ¶ added in v1.0.90
func NewMultiSweepService(cfg *ServerConfig, groups []SweepGroupConfig, log logger.Logger) (*MultiSweepService, error)
NewMultiSweepService creates a new MultiSweepService from sweep group configs.
func (*MultiSweepService) GetConfigHash ¶ added in v1.0.90
func (s *MultiSweepService) GetConfigHash() string
GetConfigHash returns the current config hash for change detection.
func (*MultiSweepService) GetStatus ¶ added in v1.0.90
func (s *MultiSweepService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
GetStatus returns a status response for the most recent sweep group.
func (*MultiSweepService) GetSweepResults ¶ added in v1.0.90
func (s *MultiSweepService) GetSweepResults(ctx context.Context, _ string) (*proto.ResultsResponse, error)
GetSweepResults returns sweep results for the next group that has new data.
func (*MultiSweepService) Name ¶ added in v1.0.90
func (*MultiSweepService) Name() string
Name returns the service name.
func (*MultiSweepService) RunSweepGroup ¶ added in v1.0.91
func (s *MultiSweepService) RunSweepGroup(ctx context.Context, groupID string) error
RunSweepGroup triggers a single sweep for the specified group.
func (*MultiSweepService) Start ¶ added in v1.0.90
func (s *MultiSweepService) Start(ctx context.Context) error
Start begins all sweep group services.
func (*MultiSweepService) Stop ¶ added in v1.0.90
func (s *MultiSweepService) Stop(_ context.Context) error
Stop gracefully stops all sweep group services.
func (*MultiSweepService) UpdateConfig ¶ added in v1.0.90
func (s *MultiSweepService) UpdateConfig(config *models.Config) error
UpdateConfig updates the sweep config, treating it as a single group.
func (*MultiSweepService) UpdateSweepGroups ¶ added in v1.0.90
func (s *MultiSweepService) UpdateSweepGroups(config *SweepGroupsConfig) error
UpdateSweepGroups updates sweep group configs, creating or removing per-group services as needed.
type ObjectStore ¶ added in v1.0.55
ObjectStore defines read access to the JetStream-backed object store.
type PluginEngineSnapshot ¶ added in v1.0.83
type PluginEngineSnapshot struct {
ObservedAt time.Time
Limits pluginEngineLimits
RequestedMemoryMB int
RequestedCPUMS int
RequestedConnections int
AssignmentsTotal int
AssignmentsAdmitted int
AssignmentsRejected int
ActiveExecutions int
OpenConnections int
ExecTotal int64
ExecFailures int64
LastExecAt time.Time
LastFailureAt time.Time
LastConfigAt time.Time
}
type PluginManager ¶ added in v1.0.83
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager manages Wasm plugin assignments and execution.
func NewPluginManager ¶ added in v1.0.83
func NewPluginManager(ctx context.Context, cfg PluginManagerConfig) *PluginManager
NewPluginManager initializes a new plugin manager.
func (*PluginManager) ApplyConfig ¶ added in v1.0.83
func (m *PluginManager) ApplyConfig(cfg *proto.PluginConfig)
ApplyConfig applies plugin assignments from config, replacing existing runners.
func (*PluginManager) DrainResults ¶ added in v1.0.83
func (m *PluginManager) DrainResults(max int) []PluginResult
DrainResults returns up to max pending results.
func (*PluginManager) Snapshot ¶ added in v1.0.83
func (m *PluginManager) Snapshot() PluginEngineSnapshot
func (*PluginManager) Stop ¶ added in v1.0.83
func (m *PluginManager) Stop()
Stop stops all plugin runners.
type PluginManagerConfig ¶ added in v1.0.83
type PluginManagerConfig struct {
CacheDir string
LocalStoreDir string
Logger logger.Logger
HTTPClient *http.Client
}
PluginManagerConfig configures the Wasm plugin manager.
type PluginResult ¶ added in v1.0.83
type PluginResult struct {
AssignmentID string
PluginID string
PluginName string
Payload []byte
ObservedAt time.Time
}
PluginResult captures a raw plugin result payload.
type PushLoop ¶ added in v1.0.79
type PushLoop struct {
// contains filtered or unexported fields
}
PushLoop manages the periodic pushing of agent status to the gateway.
func NewPushLoop ¶ added in v1.0.79
func NewPushLoop(server *Server, gateway *agentgateway.GatewayClient, interval time.Duration, log logger.Logger) *PushLoop
NewPushLoop creates a new push loop.
func (*PushLoop) SetStatusDebounceInterval ¶ added in v1.0.83
SetStatusDebounceInterval updates the minimum interval between unchanged status pushes.
func (*PushLoop) SetStatusHeartbeatInterval ¶ added in v1.0.83
SetStatusHeartbeatInterval updates the maximum interval between status pushes (heartbeat).
type SNMPAgentService ¶ added in v1.0.79
type SNMPAgentService struct {
// contains filtered or unexported fields
}
SNMPAgentService wraps the SNMP service as an agent Service.
func NewSNMPAgentService ¶ added in v1.0.79
func NewSNMPAgentService(cfg SNMPAgentServiceConfig) (*SNMPAgentService, error)
NewSNMPAgentService creates a new SNMP agent service.
func (*SNMPAgentService) ApplyProtoConfig ¶ added in v1.0.79
func (s *SNMPAgentService) ApplyProtoConfig(ctx context.Context, protoConfig *proto.SNMPConfig) error
ApplyProtoConfig applies configuration from the protobuf SNMPConfig message. This is used when receiving config from the control plane.
func (*SNMPAgentService) DrainMetrics ¶ added in v1.0.90
DrainMetrics returns all data points collected since the last Drain call.
func (*SNMPAgentService) GetConfigHash ¶ added in v1.0.79
func (s *SNMPAgentService) GetConfigHash() string
GetConfigHash returns the hash of the current configuration.
func (*SNMPAgentService) GetConfigSource ¶ added in v1.0.79
func (s *SNMPAgentService) GetConfigSource() string
GetConfigSource returns the source of the current configuration.
func (*SNMPAgentService) GetStatus ¶ added in v1.0.79
func (s *SNMPAgentService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
GetStatus returns the current SNMP status as a StatusResponse.
func (*SNMPAgentService) GetTargetStatuses ¶ added in v1.0.83
func (s *SNMPAgentService) GetTargetStatuses(ctx context.Context) (map[string]snmp.TargetStatus, error)
GetTargetStatuses returns the raw SNMP target status map, including target config.
func (*SNMPAgentService) IsEnabled ¶ added in v1.0.79
func (s *SNMPAgentService) IsEnabled() bool
IsEnabled returns whether SNMP collection is enabled.
func (*SNMPAgentService) Name ¶ added in v1.0.79
func (s *SNMPAgentService) Name() string
Name returns the service name.
type SNMPAgentServiceConfig ¶ added in v1.0.79
type SNMPAgentServiceConfig struct {
AgentID string
Partition string
ConfigDir string
Logger logger.Logger
// TestConfig overrides the default SNMP config for testing.
TestConfig *snmp.SNMPConfig
// ServiceFactory allows injection of mock services for testing.
// If nil, the default factory is used.
ServiceFactory SNMPServiceFactory
}
SNMPAgentServiceConfig holds configuration for the SNMP agent service.
type SNMPServiceFactory ¶ added in v1.0.79
type SNMPServiceFactory interface {
// CreateService creates an SNMP service from the given config.
CreateService(config *snmp.SNMPConfig, log logger.Logger) (*snmp.SNMPService, error)
}
SNMPServiceFactory creates SNMP services for the agent. This interface allows injection of mock services for testing.
type ScanStats ¶
type ScanStats struct {
// contains filtered or unexported fields
}
ScanStats tracks scanning statistics.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the main agent server that handles service coordination and management. In push-mode, the Server coordinates embedded services, collecting their status to be pushed to the gateway by PushLoop.
func NewServer ¶
func NewServer(ctx context.Context, configDir string, cfg *ServerConfig, log logger.Logger) (*Server, error)
NewServer initializes a new Server instance.
func (*Server) GetSNMPStatus ¶ added in v1.0.79
GetSNMPStatus returns the current SNMP status if the service is running.
func (*Server) GetSysmonStatus ¶ added in v1.0.79
GetSysmonStatus returns the current sysmon metrics if the service is running.
func (*Server) RestartServices ¶ added in v1.0.55
RestartServices stops and starts all managed services using the current configuration.
func (*Server) SecurityConfig ¶
func (s *Server) SecurityConfig() *models.SecurityConfig
SecurityConfig returns the server's security configuration.
func (*Server) UpdateConfig ¶ added in v1.0.55
func (s *Server) UpdateConfig(newCfg *ServerConfig)
UpdateConfig applies logging/security updates at runtime where possible. Security changes typically require a restart to fully apply to gRPC servers/clients.
type ServerConfig ¶
type ServerConfig struct {
AgentID string `json:"agent_id"` // Unique identifier for this agent
AgentName string `json:"agent_name,omitempty"` // Explicit name for KV namespacing
ComponentType string `json:"component_type,omitempty"` // Component type (agent, gateway, checker)
HostIP string `json:"host_ip,omitempty"` // Host IP address for device correlation
Partition string `json:"partition,omitempty"` // Partition for device correlation
Security *models.SecurityConfig `json:"security,omitempty"` // Security config for checker connections
KVAddress string `json:"kv_address,omitempty"` // Optional KV store address
KVSecurity *models.SecurityConfig `json:"kv_security,omitempty"` // Separate security config for KV
CheckersDir string `json:"checkers_dir"`
Logging *logger.Config `json:"logging,omitempty" hot:"reload"`
// Gateway configuration for push-based architecture
GatewayAddr string `json:"gateway_addr,omitempty"` // Address of the agent-gateway to push status to
GatewaySecurity *models.SecurityConfig `json:"gateway_security,omitempty"` // Security config for gateway connection
PushInterval Duration `json:"push_interval,omitempty"` // How often to run the push loop (default: 30s)
StatusDebounceInterval Duration `json:"status_debounce_interval,omitempty"` // Minimum interval between unchanged status pushes
StatusHeartbeatInterval Duration `json:"status_heartbeat_interval,omitempty"` // Maximum interval between status pushes (heartbeat)
// Embedded sync runtime
SyncRuntimeEnabled *bool `json:"sync_runtime_enabled,omitempty"` // Enable embedded integration sync runtime
}
ServerConfig holds the configuration for the agent server.
type Service ¶
type Service interface {
Start(context.Context) error
Stop(ctx context.Context) error
Name() string
UpdateConfig(config *models.Config) error // Added for dynamic config updates
}
Service defines the interface for agent services that can be started, stopped, and configured.
type ServiceError ¶
ServiceError represents an error that occurred in a specific service.
type SweepConfig ¶
type SweepConfig struct {
MaxTargets int
MaxGoroutines int
BatchSize int
MemoryLimit int64
Networks []string `json:"networks"`
Ports []int `json:"ports"`
SweepModes []models.SweepMode `json:"sweep_modes"`
DeviceTargets []models.DeviceTarget `json:"device_targets,omitempty"` // Per-device sweep configuration
Interval Duration `json:"interval"`
Concurrency int `json:"concurrency"`
Timeout Duration `json:"timeout"`
SweepGroupID string `json:"sweep_group_id,omitempty"` // Sweep group UUID for result tracking
ConfigHash string `json:"config_hash,omitempty"` // Hash of config for change detection
}
SweepConfig defines configuration parameters for network sweep operations.
type SweepGroupConfig ¶ added in v1.0.90
type SweepGroupConfig struct {
ID string
SweepGroupID string
Networks []string
Ports []int
SweepModes []models.SweepMode
DeviceTargets []models.DeviceTarget
Interval Duration
Concurrency int
Timeout Duration
ScheduleType string
CronExpression string
ConfigHash string
}
SweepGroupConfig represents a single sweep group config parsed from gateway payloads.
type SweepGroupConfigUpdater ¶ added in v1.0.90
type SweepGroupConfigUpdater interface {
UpdateSweepGroups(*SweepGroupsConfig) error
}
SweepGroupConfigUpdater applies multi-group sweep configurations.
type SweepGroupsConfig ¶ added in v1.0.90
type SweepGroupsConfig struct {
Groups []SweepGroupConfig
ConfigHash string
}
SweepGroupsConfig bundles multiple sweep group configs with a shared config hash.
type SweepResultsProvider ¶ added in v1.0.90
type SweepResultsProvider interface {
GetSweepResults(context.Context, string) (*proto.ResultsResponse, error)
GetConfigHash() string
}
SweepResultsProvider provides sweep results with sequence tracking.
type SweepService ¶
type SweepService struct {
// contains filtered or unexported fields
}
SweepService implements Service for network scanning.
func (*SweepService) Check ¶
func (s *SweepService) Check(ctx context.Context, _ *proto.StatusRequest) (bool, json.RawMessage)
func (*SweepService) Close ¶
func (s *SweepService) Close() error
func (*SweepService) GetConfigHash ¶ added in v1.0.79
func (s *SweepService) GetConfigHash() string
GetConfigHash returns the current config hash for change detection.
func (*SweepService) GetStatus ¶
func (s *SweepService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
GetStatus returns the current status of the sweep service (lightweight version without hosts).
func (*SweepService) GetSweepResults ¶
func (s *SweepService) GetSweepResults(ctx context.Context, lastSequence string) (*proto.ResultsResponse, error)
GetSweepResults returns sweep results with sequence tracking for change detection.
func (*SweepService) RunOnce ¶ added in v1.0.91
func (s *SweepService) RunOnce(ctx context.Context) error
RunOnce triggers a single sweep outside the scheduled interval.
func (*SweepService) SetExecutionContext ¶ added in v1.0.79
func (s *SweepService) SetExecutionContext(sweepGroupID, configHash string)
SetExecutionContext updates the sweep group ID and config hash from config. This should be called when the sweep config is updated from the gateway.
func (*SweepService) Start ¶
func (s *SweepService) Start(ctx context.Context) error
Start begins the sweep service.
func (*SweepService) Stop ¶
func (s *SweepService) Stop(_ context.Context) error
Stop gracefully stops the sweep service.
func (*SweepService) UpdateConfig ¶
func (s *SweepService) UpdateConfig(config *models.Config) error
UpdateConfig updates the service configuration.
type SweepStatusProvider ¶
type SweepStatusProvider interface {
GetStatus(context.Context) (*proto.StatusResponse, error)
}
SweepStatusProvider is an interface for services that can provide sweep status.
type SyncRuntime ¶ added in v1.0.90
type SyncRuntime struct {
// contains filtered or unexported fields
}
SyncRuntime executes integration sources delivered via GetConfig.
func NewSyncRuntime ¶ added in v1.0.90
func NewSyncRuntime(server *Server, gateway *agentgateway.GatewayClient, log logger.Logger) *SyncRuntime
NewSyncRuntime builds the integration sync runtime for an agent.
func (*SyncRuntime) ApplyConfig ¶ added in v1.0.90
func (r *SyncRuntime) ApplyConfig(configJSON []byte)
ApplyConfig parses sync sources from the gateway payload and starts/stops runners.
func (*SyncRuntime) SetContext ¶ added in v1.0.90
func (r *SyncRuntime) SetContext(ctx context.Context)
SetContext sets the base context for sync runners (called from PushLoop.Start).
type SysmonService ¶ added in v1.0.79
type SysmonService struct {
// contains filtered or unexported fields
}
SysmonService wraps the sysmon collector as an agent Service.
func NewSysmonService ¶ added in v1.0.79
func NewSysmonService(cfg SysmonServiceConfig) (*SysmonService, error)
NewSysmonService creates a new sysmon service.
func (*SysmonService) DrainMetrics ¶ added in v1.0.90
func (s *SysmonService) DrainMetrics() []*sysmon.MetricSample
DrainMetrics returns all buffered metric samples since the last call.
func (*SysmonService) GetConfigHash ¶ added in v1.0.79
func (s *SysmonService) GetConfigHash() string
GetConfigHash returns the hash of the current configuration.
func (*SysmonService) GetConfigSource ¶ added in v1.0.79
func (s *SysmonService) GetConfigSource() string
GetConfigSource returns the source of the current configuration. Returns one of: "local:<path>", "cache:<path>", "default", or "" if not started.
func (*SysmonService) GetLatestSample ¶ added in v1.0.79
func (s *SysmonService) GetLatestSample() *sysmon.MetricSample
GetLatestSample returns the most recent metric sample.
func (*SysmonService) GetStatus ¶ added in v1.0.79
func (s *SysmonService) GetStatus(ctx context.Context) (*proto.StatusResponse, error)
GetStatus returns the current sysmon status as a StatusResponse.
func (*SysmonService) IsEnabled ¶ added in v1.0.79
func (s *SysmonService) IsEnabled() bool
IsEnabled returns whether sysmon collection is enabled.
func (*SysmonService) Name ¶ added in v1.0.79
func (s *SysmonService) Name() string
Name returns the service name.
func (*SysmonService) Reconfigure ¶ added in v1.0.79
func (s *SysmonService) Reconfigure(config *sysmon.ParsedConfig) error
Reconfigure updates the sysmon configuration at runtime.
type SysmonServiceConfig ¶ added in v1.0.79
type SysmonServiceConfig struct {
AgentID string
Partition string
ConfigDir string
Logger logger.Logger
// TestConfig overrides the default sysmon config for testing.
// Use this in tests to set a fast sample interval (e.g., 100ms).
TestConfig *sysmon.Config
}
SysmonServiceConfig holds configuration for the sysmon service.
Source Files
¶
- control_stream.go
- errors.go
- icmp_checker.go
- interfaces.go
- ipv4_sorter.go
- json_helpers.go
- kv.go
- mapper_config_gateway.go
- mapper_service.go
- mock_agent.go
- multi_sweep_service.go
- plugin_runtime.go
- push_loop.go
- server.go
- snmp_service.go
- sweep_config_gateway.go
- sweep_results_limits.go
- sweep_service.go
- sync_runtime.go
- sysmon_service.go
- test_helpers.go
- types.go