monitor

package
v0.0.0-...-f8e543c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package monitor holds rules related files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportRuleSetLoaded

func ReportRuleSetLoaded(acc *events.AgentContainerContext, sender events.EventSender, statsdClient statsd.ClientInterface, policies []*PolicyState)

ReportRuleSetLoaded reports to Datadog that a new ruleset was loaded

Types

type CoreDumpAction

type CoreDumpAction struct {
	Process       bool `json:"process,omitempty"`
	Mount         bool `json:"mount,omitempty"`
	Dentry        bool `json:"dentry,omitempty"`
	NoCompression bool `json:"no_compression,omitempty"`
}

CoreDumpAction is used to report the 'coredump' action easyjson:json

func (CoreDumpAction) MarshalEasyJSON

func (v CoreDumpAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CoreDumpAction) UnmarshalEasyJSON

func (v *CoreDumpAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type HashAction

type HashAction struct {
	Enabled bool `json:"enabled,omitempty"`
}

HashAction is used to report 'hash' action easyjson:json

func (HashAction) MarshalEasyJSON

func (v HashAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*HashAction) UnmarshalEasyJSON

func (v *HashAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type HeartbeatEvent

type HeartbeatEvent struct {
	events.CustomEventCommonFields
	Policy *PolicyState `json:"policy"`
}

HeartbeatEvent is used to report the policies that has been loaded easyjson:json

func (HeartbeatEvent) MarshalEasyJSON

func (v HeartbeatEvent) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (HeartbeatEvent) ToJSON

func (e HeartbeatEvent) ToJSON() ([]byte, error)

ToJSON marshal using json format

func (*HeartbeatEvent) UnmarshalEasyJSON

func (v *HeartbeatEvent) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PolicyMonitor

type PolicyMonitor struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PolicyMonitor defines a policy monitor

func NewPolicyMonitor

func NewPolicyMonitor(statsdClient statsd.ClientInterface, perRuleMetricEnabled bool) *PolicyMonitor

NewPolicyMonitor returns a new Policy monitor

func (*PolicyMonitor) ReportHeartbeatEvent

func (pm *PolicyMonitor) ReportHeartbeatEvent(acc *events.AgentContainerContext, sender events.EventSender)

ReportHeartbeatEvent sends HeartbeatEvents reporting the current set of policies

func (*PolicyMonitor) SetPolicies

func (pm *PolicyMonitor) SetPolicies(policies []*PolicyState)

SetPolicies sets the policies to monitor

func (*PolicyMonitor) Start

func (pm *PolicyMonitor) Start(ctx context.Context)

Start the monitor

type PolicyState

type PolicyState struct {
	Name    string       `json:"name"`
	Version string       `json:"version"`
	Source  string       `json:"source"`
	Rules   []*RuleState `json:"rules"`
}

PolicyState is used to report policy was loaded easyjson:json

func NewPoliciesState

func NewPoliciesState(rs *rules.RuleSet, err *multierror.Error, includeInternalPolicies bool) []*PolicyState

NewPoliciesState returns the states of policies and rules

func PolicyStateFromRule

func PolicyStateFromRule(rule *rules.PolicyRule) *PolicyState

PolicyStateFromRule returns a policy state based on the rule definition

func (PolicyState) MarshalEasyJSON

func (v PolicyState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PolicyState) UnmarshalEasyJSON

func (v *PolicyState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type RuleAction

type RuleAction struct {
	Filter   *string         `json:"filter,omitempty"`
	Set      *RuleSetAction  `json:"set,omitempty"`
	Kill     *RuleKillAction `json:"kill,omitempty"`
	Hash     *HashAction     `json:"hash,omitempty"`
	CoreDump *CoreDumpAction `json:"coredump,omitempty"`
}

RuleAction is used to report policy was loaded easyjson:json

func (RuleAction) MarshalEasyJSON

func (v RuleAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*RuleAction) UnmarshalEasyJSON

func (v *RuleAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type RuleKillAction

type RuleKillAction struct {
	Signal string `json:"signal,omitempty"`
	Scope  string `json:"scope,omitempty"`
}

RuleKillAction is used to report the 'kill' action easyjson:json

func (RuleKillAction) MarshalEasyJSON

func (v RuleKillAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*RuleKillAction) UnmarshalEasyJSON

func (v *RuleKillAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type RuleSetAction

type RuleSetAction struct {
	Name   string      `json:"name,omitempty"`
	Value  interface{} `json:"value,omitempty"`
	Field  string      `json:"field,omitempty"`
	Append bool        `json:"append,omitempty"`
	Scope  string      `json:"scope,omitempty"`
}

RuleSetAction is used to report 'set' action easyjson:json

func (RuleSetAction) MarshalEasyJSON

func (v RuleSetAction) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*RuleSetAction) UnmarshalEasyJSON

func (v *RuleSetAction) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type RuleSetLoadedReport

type RuleSetLoadedReport struct {
	Rule  *rules.Rule
	Event *events.CustomEvent
}

RuleSetLoadedReport represents the rule and the custom event related to a RuleSetLoaded event, ready to be dispatched

type RuleState

type RuleState struct {
	ID         string            `json:"id"`
	Version    string            `json:"version,omitempty"`
	Expression string            `json:"expression"`
	Status     string            `json:"status"`
	Message    string            `json:"message,omitempty"`
	Tags       map[string]string `json:"tags,omitempty"`
	Actions    []RuleAction      `json:"actions,omitempty"`
	ModifiedBy []*PolicyState    `json:"modified_by,omitempty"`
}

RuleState defines a loaded rule easyjson:json

func RuleStateFromRule

func RuleStateFromRule(rule *rules.PolicyRule, status string, message string) *RuleState

RuleStateFromRule returns a rule state based on the given rule

func (RuleState) MarshalEasyJSON

func (v RuleState) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*RuleState) UnmarshalEasyJSON

func (v *RuleState) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type RulesetLoadedEvent

type RulesetLoadedEvent struct {
	events.CustomEventCommonFields
	Policies []*PolicyState `json:"policies"`
}

RulesetLoadedEvent is used to report that a new ruleset was loaded easyjson:json

func (RulesetLoadedEvent) MarshalEasyJSON

func (v RulesetLoadedEvent) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RulesetLoadedEvent) ToJSON

func (e RulesetLoadedEvent) ToJSON() ([]byte, error)

ToJSON marshal using json format

func (*RulesetLoadedEvent) UnmarshalEasyJSON

func (v *RulesetLoadedEvent) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL