Documentation ¶
Index ¶
- Constants
- func ByteCountSI(b uint64) string
- func FileExists(path string) bool
- func GenerateAgentID() (ulid.ULID, error)
- func GetMonth(month string) time.Month
- func IsValidIP(ip string) bool
- func KillProc(pid int32) error
- func StripAll(s string) string
- func TestTCP(addr string) error
- func Unzip(src, dest string) error
- type Agent
- func (a *Agent) BootTime() int64
- func (a *Agent) CreateAgentTempDir()
- func (a *Agent) GetHostname() string
- func (a *Agent) OSInfo() (plat, osFullName string)
- func (a *Agent) PublicIP() string
- func (a *Agent) SetupNatsOptions() []nats.Option
- func (a *Agent) Start(s service.Service) error
- func (a *Agent) Stop(s service.Service) error
- func (a *Agent) TotalRAM() float64
- type AgentConfig
- type IAgent
- type IAgentConfig
- type InfoCollector
- type InstallInfo
- type Messenger
- type PackageManager
- type RpcProcessor
- type ServiceManager
- type TaskChecker
- type TaskScheduler
Constants ¶
View Source
const ( AGENT_NAME_LONG = "RMM Agent" AGENT_TEMP_DIR = "rmm" NATS_DEFAULT_PORT = 4222 TASK_PREFIX = "RMM_" )
View Source
const ( NATS_CMD_AGENT_UNINSTALL = "uninstall" NATS_CMD_AGENT_UPDATE = "agentupdate" NATS_CMD_CHOCO_INSTALL = "installwithchoco" NATS_CMD_CPULOADAVG = "cpuloadavg" NATS_CMD_EVENTLOG = "eventlog" NATS_CMD_GETWINUPDATES = "getwinupdates" NATS_CMD_INSTALL_CHOCO = "installchoco" NATS_CMD_INSTALL_WINUPDATES = "installwinupdates" NATS_CMD_PING = "ping" NATS_CMD_PROCS_KILL = "killproc" NATS_CMD_PROCS_LIST = "procs" NATS_CMD_PUBLICIP = "publicip" NATS_CMD_RAWCMD = "rawcmd" NATS_CMD_REBOOT_NEEDED = "needsreboot" NATS_CMD_REBOOT_NOW = "rebootnow" NATS_CMD_RECOVER = "recover" NATS_CMD_RUNCHECKS = "runchecks" NATS_CMD_SCRIPT_RUN = "runscript" NATS_CMD_SCRIPT_RUN_FULL = "runscriptfull" NATS_CMD_SOFTWARE_LIST = "softwarelist" NATS_CMD_SYNC = "sync" NATS_CMD_SYSINFO = "sysinfo" NATS_CMD_TASK_ADD = "schedtask" NATS_CMD_TASK_DEL = "delschedtask" NATS_CMD_TASK_ENABLE = "enableschedtask" NATS_CMD_TASK_LIST = "listschedtasks" NATS_CMD_TASK_RUN = "runtask" NATS_CMD_WINSERVICES = "winservices" NATS_CMD_WINSVC_ACTION = "winsvcaction" NATS_CMD_WINSVC_DETAIL = "winsvcdetail" NATS_CMD_WINSVC_EDIT = "editwinsvc" NATS_CMD_WMI = "wmi" )
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶
func GenerateAgentID ¶
func GenerateAgentID() (ulid.ULID, error)
GenerateAgentID creates and returns a unique agent ULID
func Unzip ¶
Unzip a source file to a destination Source: https://golangcode.com/unzip-files-in-go/
Types ¶
type Agent ¶
type Agent struct { IAgent *AgentConfig Logger *logrus.Logger RClient *resty.Client }
func (*Agent) CreateAgentTempDir ¶
func (a *Agent) CreateAgentTempDir()
CreateAgentTempDir Create the temp directory for running scripts
func (*Agent) GetHostname ¶
func (*Agent) PublicIP ¶
PublicIP returns the agent's public IP address Tries 3 times before giving up
func (*Agent) SetupNatsOptions ¶
func (a *Agent) SetupNatsOptions() []nats.Option
SetupNatsOptions todo: review authentication https://docs.nats.io/running-a-nats-service/configuration/securing_nats/auth_intro/nkey_auth
type AgentConfig ¶
type AgentConfig struct { AgentID string // Username (as ULID) AgentPK int // Primary Key on server? BaseURL string // Server URL ApiURL string // NATS ApiPort int // NATS Port (4222) Token string // Authorization token Cert string // Root Certificate Arch string // "x86_64", "x86" Debug bool Hostname string Version string Headers map[string]string }
type IAgent ¶
type IAgent interface { InfoCollector PackageManager RpcProcessor // Messenger service.Interface // contains filtered or unexported methods }
type IAgentConfig ¶
type IAgentConfig interface {
// contains filtered or unexported methods
}
type InfoCollector ¶
type InstallInfo ¶
type InstallInfo struct { Headers map[string]string ServerURL string // JSON endpoint URL ApiURL string // RPC endpoint (NATS) URL ClientID int // Client ID SiteID int // Client Site ID Description string // Defaults to hostname Token string // Authorization token (password) RootCert string // Trusted Root Certificate Timeout time.Duration // Installation timeout Silent bool // Silent installation }
type Messenger ¶
type Messenger interface { RpcProcessor Send(any) Receive(any) }
Messenger is our communication interface (for RPC, JSON, etc.)
type PackageManager ¶
type RpcProcessor ¶
type RpcProcessor interface {
ProcessRpcMsg(conn *nats.Conn, msg *nats.Msg)
}
type TaskChecker ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.