linux

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

File Monitor Plugin Watches for changes to files in the interesting directories

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

File Monitor Plugin Watches for changes to files in the interesting directories

Index

Constants

View Source
const (
	DPKG_INFO_DIR   = "/var/lib/dpkg/info"
	FSN_CLOSE_WRITE = 16
)
View Source
const (
	WRITABLE_MASK = 0222
	READABLE_MASK = 0444
)
View Source
const (
	RpmPath = "/bin/rpm"
)

Paths

View Source
const (
	SYSV_INIT_DIR = "/var/run"
)

Variables

View Source
var ErrSELinuxDisabled = errors.New("SELinux status: disabled")
View Source
var (
	PluginDisabledErr = errors.New("frequency disabled plugin")
)

Inventory plugin errors

View Source
var SELinuxConfigProperties = map[string]string{
	"SELinux status":          "Status",
	"SELinuxfs mount":         "FSMount",
	"Current mode":            "CurrentMode",
	"Policy version":          "PolicyVersion",
	"Policy from config file": "PolicyLevel",
}

Output we care about - if the label from sestatus output matches a key, we'll return its value using this map's value as the ID for the inventory entity.

View Source
var SshdConfigConfigRegexp *regexp.Regexp
View Source
var SshdConfigProperties = map[string]bool{
	"PermitRootLogin":                 true,
	"PermitEmptyPasswords":            true,
	"PasswordAuthentication":          true,
	"ChallengeResponseAuthentication": true,
}

Functions

func NewCloudSecurityGroupsPlugin

func NewCloudSecurityGroupsPlugin(id ids.PluginID, ctx agent.AgentContext, harvester cloud.Harvester) agent.Plugin

func NewDaemontoolsPlugin

func NewDaemontoolsPlugin(id ids.PluginID, ctx agent.AgentContext) agent.Plugin

func NewDpkgPlugin

func NewDpkgPlugin(id ids.PluginID, ctx agent.AgentContext) agent.Plugin

func NewHostinfoPlugin

func NewHostinfoPlugin(ctx agent.AgentContext, cloudHarvester cloud.Harvester) agent.Plugin

func NewKernelModulesPlugin

func NewKernelModulesPlugin(id ids.PluginID, ctx agent.AgentContext) agent.Plugin

func NewRpmPlugin

func NewRpmPlugin(ctx agent.AgentContext) agent.Plugin

func NewSELinuxPlugin

func NewSELinuxPlugin(id ids.PluginID, ctx agent.AgentContext) agent.Plugin

func NewSupervisorPlugin

func NewSupervisorPlugin(id ids.PluginID, ctx agent.AgentContext) agent.Plugin

func NewSystemdPlugin

func NewSystemdPlugin(ctx agent.AgentContext) agent.Plugin

func NewSysvInitPlugin

func NewSysvInitPlugin(id ids.PluginID, ctx agent.AgentContext) agent.Plugin

func NewUpstartPlugin

func NewUpstartPlugin(id ids.PluginID, ctx agent.AgentContext) agent.Plugin

func NewUsersPlugin

func NewUsersPlugin(ctx agent.AgentContext) agent.Plugin

Types

type CloudSecurityGroup

type CloudSecurityGroup struct {
	SecurityGroup string `json:"id"`
}

func (CloudSecurityGroup) SortKey

func (c CloudSecurityGroup) SortKey() string

type CloudSecurityGroupsPlugin

type CloudSecurityGroupsPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*CloudSecurityGroupsPlugin) Run

func (p *CloudSecurityGroupsPlugin) Run()

type DaemontoolsPlugin

type DaemontoolsPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*DaemontoolsPlugin) Run

func (self *DaemontoolsPlugin) Run()

type DaemontoolsService

type DaemontoolsService struct {
	Name string `json:"id"`
	Pid  string `json:"pid"`
}

func (DaemontoolsService) SortKey

func (self DaemontoolsService) SortKey() string

type DpkgItem

type DpkgItem struct {
	Name         string `json:"id"`
	Architecture string `json:"architecture"`
	Essential    string `json:"essential"`
	Priority     string `json:"priority"`
	Status       string `json:"status"`
	Version      string `json:"version"`
	InstallTime  string `json:"installed_epoch"`
}

func (DpkgItem) SortKey

func (self DpkgItem) SortKey() string

type DpkgPlugin

type DpkgPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*DpkgPlugin) Run

func (self *DpkgPlugin) Run()

Run is the main processing loop that drives the logic for the plugin

type Facter

type Facter interface {
	Initialize() error
	Facts() (map[string]FacterItem, error)
}

type FacterClient

type FacterClient struct {
	// contains filtered or unexported fields
}

func (*FacterClient) Facts

func (self *FacterClient) Facts() (map[string]FacterItem, error)

func (*FacterClient) Initialize

func (self *FacterClient) Initialize() error

type FacterItem

type FacterItem struct {
	Name  string      `json:"id"`
	Value interface{} `json:"value"`
}

func (FacterItem) SortKey

func (fi FacterItem) SortKey() string

type FacterPlugin

type FacterPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func NewFacterPlugin

func NewFacterPlugin(ctx agent.AgentContext) *FacterPlugin

func (*FacterPlugin) CanRun

func (self *FacterPlugin) CanRun() bool

func (*FacterPlugin) Data

func (*FacterPlugin) Run

func (self *FacterPlugin) Run()

type HostinfoData

type HostinfoData struct {
	System        string `json:"id"`
	Distro        string `json:"distro"`
	KernelVersion string `json:"kernel_version"`
	HostType      string `json:"host_type"`
	CpuName       string `json:"cpu_name"`
	// Number of cores within a single CPU ('cpu cores' field in /proc/cpuinfo)
	// It is shown as 'coreCount' in New Relic UI
	CpuNum string `json:"cpu_num"`
	// Total number of cores in all the CPUs ('processor' entries in /proc/cpuinfo)
	// It is shown as 'processorCount' in New Relic UI
	TotalCpu            string `json:"total_cpu"`
	Ram                 string `json:"ram"`
	UpSince             string `json:"boot_timestamp"`
	AgentVersion        string `json:"agent_version"`
	AgentName           string `json:"agent_name"`
	AgentMode           string `json:"agent_mode"`
	OperatingSystem     string `json:"operating_system"`
	ProductUuid         string `json:"product_uuid"`
	BootId              string `json:"boot_id"`
	RegionAWS           string `json:"aws_region,omitempty"`
	RegionAzure         string `json:"region_name,omitempty"`
	RegionGCP           string `json:"zone,omitempty"`
	RegionAlibaba       string `json:"region_id,omitempty"`
	AWSAccountID        string `json:"aws_account_id,omitempty"`
	AWSAvailabilityZone string `json:"aws_availability_zone,omitempty"`
	AWSImageID          string `json:"aws_image_id,omitempty"`
}

func (HostinfoData) SortKey

func (self HostinfoData) SortKey() string

type HostinfoPlugin

type HostinfoPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*HostinfoPlugin) Data

func (*HostinfoPlugin) Run

func (self *HostinfoPlugin) Run()

type KernelModule

type KernelModule struct {
	Name        string `json:"id"`
	Version     string `json:"version"`
	Description string `json:"description"`
}

func (KernelModule) SortKey

func (self KernelModule) SortKey() string

type KernelModulesPlugin

type KernelModulesPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*KernelModulesPlugin) Run

func (self *KernelModulesPlugin) Run()

type RpmItem

type RpmItem struct {
	Name         string `json:"id"`
	Version      string `json:"version"`
	Release      string `json:"release"`
	Architecture string `json:"architecture"`
	InstallTime  string `json:"installed_epoch"`
	EpochTag     string `json:"epoch_tag"`
}

func (RpmItem) SortKey

func (p RpmItem) SortKey() string

type SELinuxConfigValue

type SELinuxConfigValue struct {
	Key   string `json:"id"`
	Value string `json:"value"`
}

func (SELinuxConfigValue) SortKey

func (self SELinuxConfigValue) SortKey() string

type SELinuxPlugin

type SELinuxPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*SELinuxPlugin) Run

func (self *SELinuxPlugin) Run()

type SELinuxPolicyModule

type SELinuxPolicyModule struct {
	Key     string `json:"id"`
	Version string `json:"version"`
}

func (SELinuxPolicyModule) SortKey

func (self SELinuxPolicyModule) SortKey() string

type SshdConfigPlugin

type SshdConfigPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func NewSshdConfigPlugin

func NewSshdConfigPlugin(id ids.PluginID, ctx agent.AgentContext) *SshdConfigPlugin

func (*SshdConfigPlugin) Run

func (self *SshdConfigPlugin) Run()

type SshdConfigValue

type SshdConfigValue struct {
	Key   string `json:"id"`
	Value string `json:"value"`
}

func (SshdConfigValue) SortKey

func (self SshdConfigValue) SortKey() string

type Supervisor

type Supervisor interface {
	Processes() ([]SupervisorProcess, error)
}

type SupervisorClient

type SupervisorClient struct {
	// contains filtered or unexported fields
}

func NewSupervisorClient

func NewSupervisorClient(proto string, address string) (cl *SupervisorClient, err error)

func (*SupervisorClient) Processes

func (self *SupervisorClient) Processes() ([]SupervisorProcess, error)

type SupervisorItem

type SupervisorItem struct {
	Name string `json:"id"`
	Pid  string `json:"pid"`
}

func (SupervisorItem) SortKey

func (self SupervisorItem) SortKey() string

type SupervisorPlugin

type SupervisorPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*SupervisorPlugin) CanRun

func (self *SupervisorPlugin) CanRun() bool

func (*SupervisorPlugin) Data

func (*SupervisorPlugin) GetClient

func (self *SupervisorPlugin) GetClient() (cl Supervisor, err error)

func (*SupervisorPlugin) Run

func (self *SupervisorPlugin) Run()

type SupervisorProcess

type SupervisorProcess struct {
	Name          string `xmlrpc:"name"`
	Group         string `xmlrpc:"group"`
	Start         int64  `xmlrpc:"start"`
	Stop          int64  `xmlrpc:"stop"`
	Now           int64  `xmlrpc:"now"`
	State         int    `xmlrpc:"state"`
	StateName     string `xmlrpc:"statename"`
	SpawnError    string `xmlrpc:"spawnerr"`
	ExitStatus    int    `xmlrpc:"exitstatus"`
	StdOutLogFile string `xmlrpc:"stdout_logfile"`
	StdErrLogFile string `xmlrpc:"stderr_logfile"`
	Pid           int64  `xmlrpc:"pid"`
}

type SysctlItem

type SysctlItem struct {
	Sysctl string `json:"id"`
	Value  string `json:"sysctl_value"`
}

func (SysctlItem) SortKey

func (self SysctlItem) SortKey() string

type SysctlPlugin

type SysctlPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func NewSysctlPollingMonitor

func NewSysctlPollingMonitor(id ids.PluginID, ctx agent.AgentContext) *SysctlPlugin

NewSysctlPollingMonitor creates a /proc/sys parser polling on intervals

func (*SysctlPlugin) Run

func (sp *SysctlPlugin) Run()

Run is where you implement your plugin logic

func (*SysctlPlugin) Sysctls

func (sp *SysctlPlugin) Sysctls() (dataset agent.PluginInventoryDataset, err error)

type SysctlSubscriberPlugin

type SysctlSubscriberPlugin struct {
	SysctlPlugin
	// contains filtered or unexported fields
}

func NewSysctlSubscriberMonitor

func NewSysctlSubscriberMonitor(id ids.PluginID, ctx agent.AgentContext) (*SysctlSubscriberPlugin, error)

NewSysctlSubscriberMonitor creates a /proc/sys parser, walking once the full path and then subscribing to changed FS events.

func (*SysctlSubscriberPlugin) EventsCh

func (p *SysctlSubscriberPlugin) EventsCh() chan fsnotify.Event

deprecated, just for testing purposes

func (*SysctlSubscriberPlugin) Run

func (p *SysctlSubscriberPlugin) Run()

Run is where you implement your plugin logic

type SystemdPlugin

type SystemdPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*SystemdPlugin) Run

func (self *SystemdPlugin) Run()

type SystemdService

type SystemdService struct {
	Name string `json:"id"`
	Pid  string `json:"pid"`
}

func (SystemdService) SortKey

func (self SystemdService) SortKey() string

type SysvInitPlugin

type SysvInitPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*SysvInitPlugin) Run

func (self *SysvInitPlugin) Run()

type SysvService

type SysvService struct {
	Name string `json:"id"`
	helpers.ServiceDetails
}

func (SysvService) SortKey

func (self SysvService) SortKey() string

type UpstartPlugin

type UpstartPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*UpstartPlugin) Run

func (up *UpstartPlugin) Run()

type UpstartService

type UpstartService struct {
	Name string `json:"id"`
	Pid  string `json:"pid"`
}

func (UpstartService) SortKey

func (us UpstartService) SortKey() string

type User

type User struct {
	Name string `json:"id"`
}

func (User) SortKey

func (self User) SortKey() string

type UsersPlugin

type UsersPlugin struct {
	agent.PluginCommon
	// contains filtered or unexported fields
}

func (*UsersPlugin) Run

func (self *UsersPlugin) Run()

Jump to

Keyboard shortcuts

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