sysinfo

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package sysinfo defines the RPC interface for the sansshell SysInfo actions.

Index

Constants

View Source
const (
	SysInfo_Uptime_FullMethodName  = "/SysInfo.SysInfo/Uptime"
	SysInfo_Dmesg_FullMethodName   = "/SysInfo.SysInfo/Dmesg"
	SysInfo_Journal_FullMethodName = "/SysInfo.SysInfo/Journal"
)
View Source
const JounalEntriesLimit = 10000

Maximum journal entries we can fetch for each host

View Source
const TimeFormat_YYYYMMDDHHMMSS = "2006-01-02 15:04:05"

YYYY-MM-DD HH:MM:SS time format

Variables

View Source
var File_sysinfo_proto protoreflect.FileDescriptor
View Source
var SysInfo_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "SysInfo.SysInfo",
	HandlerType: (*SysInfoServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Uptime",
			Handler:    _SysInfo_Uptime_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Dmesg",
			Handler:       _SysInfo_Dmesg_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Journal",
			Handler:       _SysInfo_Journal_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "sysinfo.proto",
}

SysInfo_ServiceDesc is the grpc.ServiceDesc for SysInfo service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSysInfoServer

func RegisterSysInfoServer(s grpc.ServiceRegistrar, srv SysInfoServer)

Types

type DmesgManyResponse added in v1.23.0

type DmesgManyResponse struct {
	Target string
	// As targets can be duplicated this is the index into the slice passed to proxy.Conn.
	Index int
	Resp  *DmesgReply
	Error error
}

DmesgManyResponse encapsulates a proxy data packet. It includes the target, index, response and possible error returned.

type DmesgReply added in v1.23.0

type DmesgReply struct {
	Record *DmsgRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
	// contains filtered or unexported fields
}

DmesgReply contains the messages from kernel

func (*DmesgReply) Descriptor deprecated added in v1.23.0

func (*DmesgReply) Descriptor() ([]byte, []int)

Deprecated: Use DmesgReply.ProtoReflect.Descriptor instead.

func (*DmesgReply) GetRecord added in v1.23.0

func (x *DmesgReply) GetRecord() *DmsgRecord

func (*DmesgReply) ProtoMessage added in v1.23.0

func (*DmesgReply) ProtoMessage()

func (*DmesgReply) ProtoReflect added in v1.23.0

func (x *DmesgReply) ProtoReflect() protoreflect.Message

func (*DmesgReply) Reset added in v1.23.0

func (x *DmesgReply) Reset()

func (*DmesgReply) String added in v1.23.0

func (x *DmesgReply) String() string

type DmesgRequest added in v1.23.0

type DmesgRequest struct {

	// tail the number of line from the dmesg output, negative means display all messages
	TailLines   int32  `protobuf:"varint,1,opt,name=tail_lines,json=tailLines,proto3" json:"tail_lines,omitempty"`
	Grep        string `protobuf:"bytes,2,opt,name=grep,proto3" json:"grep,omitempty"`
	IgnoreCase  bool   `protobuf:"varint,3,opt,name=ignore_case,json=ignoreCase,proto3" json:"ignore_case,omitempty"`
	InvertMatch bool   `protobuf:"varint,4,opt,name=invert_match,json=invertMatch,proto3" json:"invert_match,omitempty"`
	// contains filtered or unexported fields
}

DmesgRequest describes the filename to be tailed.

func (*DmesgRequest) Descriptor deprecated added in v1.23.0

func (*DmesgRequest) Descriptor() ([]byte, []int)

Deprecated: Use DmesgRequest.ProtoReflect.Descriptor instead.

func (*DmesgRequest) GetGrep added in v1.23.0

func (x *DmesgRequest) GetGrep() string

func (*DmesgRequest) GetIgnoreCase added in v1.23.0

func (x *DmesgRequest) GetIgnoreCase() bool

func (*DmesgRequest) GetInvertMatch added in v1.23.0

func (x *DmesgRequest) GetInvertMatch() bool

func (*DmesgRequest) GetTailLines added in v1.23.0

func (x *DmesgRequest) GetTailLines() int32

func (*DmesgRequest) ProtoMessage added in v1.23.0

func (*DmesgRequest) ProtoMessage()

func (*DmesgRequest) ProtoReflect added in v1.23.0

func (x *DmesgRequest) ProtoReflect() protoreflect.Message

func (*DmesgRequest) Reset added in v1.23.0

func (x *DmesgRequest) Reset()

func (*DmesgRequest) String added in v1.23.0

func (x *DmesgRequest) String() string

type DmsgRecord added in v1.23.0

type DmsgRecord struct {
	Time    *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
	Message string                 `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

DmesgRecord contains the specific fields about the a dmesg record

func (*DmsgRecord) Descriptor deprecated added in v1.23.0

func (*DmsgRecord) Descriptor() ([]byte, []int)

Deprecated: Use DmsgRecord.ProtoReflect.Descriptor instead.

func (*DmsgRecord) GetMessage added in v1.23.0

func (x *DmsgRecord) GetMessage() string

func (*DmsgRecord) GetTime added in v1.23.0

func (x *DmsgRecord) GetTime() *timestamppb.Timestamp

func (*DmsgRecord) ProtoMessage added in v1.23.0

func (*DmsgRecord) ProtoMessage()

func (*DmsgRecord) ProtoReflect added in v1.23.0

func (x *DmsgRecord) ProtoReflect() protoreflect.Message

func (*DmsgRecord) Reset added in v1.23.0

func (x *DmsgRecord) Reset()

func (*DmsgRecord) String added in v1.23.0

func (x *DmsgRecord) String() string

type JournalManyResponse added in v1.23.5

type JournalManyResponse struct {
	Target string
	// As targets can be duplicated this is the index into the slice passed to proxy.Conn.
	Index int
	Resp  *JournalReply
	Error error
}

JournalManyResponse encapsulates a proxy data packet. It includes the target, index, response and possible error returned.

type JournalRecord added in v1.23.5

type JournalRecord struct {
	RealtimeTimestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=realtime_timestamp,json=realtimeTimestamp,proto3" json:"realtime_timestamp,omitempty"`
	Hostname          string                 `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"`
	SyslogIdentifier  string                 `protobuf:"bytes,3,opt,name=syslog_identifier,json=syslogIdentifier,proto3" json:"syslog_identifier,omitempty"`
	Pid               int32                  `protobuf:"varint,4,opt,name=pid,proto3" json:"pid,omitempty"`
	Message           string                 `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

journal record is the default format and contains fields the same as journalctl output in linux

func (*JournalRecord) Descriptor deprecated added in v1.23.5

func (*JournalRecord) Descriptor() ([]byte, []int)

Deprecated: Use JournalRecord.ProtoReflect.Descriptor instead.

func (*JournalRecord) GetHostname added in v1.23.5

func (x *JournalRecord) GetHostname() string

func (*JournalRecord) GetMessage added in v1.23.5

func (x *JournalRecord) GetMessage() string

func (*JournalRecord) GetPid added in v1.23.5

func (x *JournalRecord) GetPid() int32

func (*JournalRecord) GetRealtimeTimestamp added in v1.23.5

func (x *JournalRecord) GetRealtimeTimestamp() *timestamppb.Timestamp

func (*JournalRecord) GetSyslogIdentifier added in v1.23.5

func (x *JournalRecord) GetSyslogIdentifier() string

func (*JournalRecord) ProtoMessage added in v1.23.5

func (*JournalRecord) ProtoMessage()

func (*JournalRecord) ProtoReflect added in v1.23.5

func (x *JournalRecord) ProtoReflect() protoreflect.Message

func (*JournalRecord) Reset added in v1.23.5

func (x *JournalRecord) Reset()

func (*JournalRecord) String added in v1.23.5

func (x *JournalRecord) String() string

type JournalRecordRaw added in v1.23.5

type JournalRecordRaw struct {

	// when output is set to json or json-pretty
	// a list of key-value pairs will be set here
	// the key-value pairs will be different with different messages
	Entry map[string]string `` /* 151-byte string literal not displayed */
	// contains filtered or unexported fields
}

raw journal record will contain most fields and display in specified output format

func (*JournalRecordRaw) Descriptor deprecated added in v1.23.5

func (*JournalRecordRaw) Descriptor() ([]byte, []int)

Deprecated: Use JournalRecordRaw.ProtoReflect.Descriptor instead.

func (*JournalRecordRaw) GetEntry added in v1.23.5

func (x *JournalRecordRaw) GetEntry() map[string]string

func (*JournalRecordRaw) ProtoMessage added in v1.23.5

func (*JournalRecordRaw) ProtoMessage()

func (*JournalRecordRaw) ProtoReflect added in v1.23.5

func (x *JournalRecordRaw) ProtoReflect() protoreflect.Message

func (*JournalRecordRaw) Reset added in v1.23.5

func (x *JournalRecordRaw) Reset()

func (*JournalRecordRaw) String added in v1.23.5

func (x *JournalRecordRaw) String() string

type JournalReply added in v1.23.5

type JournalReply struct {

	// Types that are assignable to Response:
	//
	//	*JournalReply_Journal
	//	*JournalReply_JournalRaw
	Response isJournalReply_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

func (*JournalReply) Descriptor deprecated added in v1.23.5

func (*JournalReply) Descriptor() ([]byte, []int)

Deprecated: Use JournalReply.ProtoReflect.Descriptor instead.

func (*JournalReply) GetJournal added in v1.23.5

func (x *JournalReply) GetJournal() *JournalRecord

func (*JournalReply) GetJournalRaw added in v1.23.5

func (x *JournalReply) GetJournalRaw() *JournalRecordRaw

func (*JournalReply) GetResponse added in v1.23.5

func (m *JournalReply) GetResponse() isJournalReply_Response

func (*JournalReply) ProtoMessage added in v1.23.5

func (*JournalReply) ProtoMessage()

func (*JournalReply) ProtoReflect added in v1.23.5

func (x *JournalReply) ProtoReflect() protoreflect.Message

func (*JournalReply) Reset added in v1.23.5

func (x *JournalReply) Reset()

func (*JournalReply) String added in v1.23.5

func (x *JournalReply) String() string

type JournalReply_Journal added in v1.23.5

type JournalReply_Journal struct {
	Journal *JournalRecord `protobuf:"bytes,1,opt,name=journal,proto3,oneof"`
}

type JournalReply_JournalRaw added in v1.23.5

type JournalReply_JournalRaw struct {
	JournalRaw *JournalRecordRaw `protobuf:"bytes,2,opt,name=journalRaw,proto3,oneof"`
}

type JournalRequest added in v1.23.5

type JournalRequest struct {

	// The start time for query, timestamp format will be YYYY-MM-DD HH:MM:SS
	TimeSince *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=time_since,json=timeSince,proto3" json:"time_since,omitempty"`
	// The end time for query
	TimeUntil *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=time_until,json=timeUntil,proto3" json:"time_until,omitempty"`
	// Tail the latest number of log entries from the journal, negative means display all messages
	TailLine uint32 `protobuf:"varint,3,opt,name=tail_line,json=tailLine,proto3" json:"tail_line,omitempty"`
	// Filter messages for specified systemd units
	Unit string `protobuf:"bytes,4,opt,name=unit,proto3" json:"unit,omitempty"`
	// Controls the format of the journal entries
	EnableJson bool `protobuf:"varint,5,opt,name=enable_json,json=enableJson,proto3" json:"enable_json,omitempty"`
	// contains filtered or unexported fields
}

func (*JournalRequest) Descriptor deprecated added in v1.23.5

func (*JournalRequest) Descriptor() ([]byte, []int)

Deprecated: Use JournalRequest.ProtoReflect.Descriptor instead.

func (*JournalRequest) GetEnableJson added in v1.23.5

func (x *JournalRequest) GetEnableJson() bool

func (*JournalRequest) GetTailLine added in v1.23.5

func (x *JournalRequest) GetTailLine() uint32

func (*JournalRequest) GetTimeSince added in v1.23.5

func (x *JournalRequest) GetTimeSince() *timestamppb.Timestamp

func (*JournalRequest) GetTimeUntil added in v1.23.5

func (x *JournalRequest) GetTimeUntil() *timestamppb.Timestamp

func (*JournalRequest) GetUnit added in v1.23.5

func (x *JournalRequest) GetUnit() string

func (*JournalRequest) ProtoMessage added in v1.23.5

func (*JournalRequest) ProtoMessage()

func (*JournalRequest) ProtoReflect added in v1.23.5

func (x *JournalRequest) ProtoReflect() protoreflect.Message

func (*JournalRequest) Reset added in v1.23.5

func (x *JournalRequest) Reset()

func (*JournalRequest) String added in v1.23.5

func (x *JournalRequest) String() string

type SysInfoClient

type SysInfoClient interface {
	// Uptime return
	Uptime(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UptimeReply, error)
	// display kernel-related messages
	Dmesg(ctx context.Context, in *DmesgRequest, opts ...grpc.CallOption) (SysInfo_DmesgClient, error)
	// Journal returns journal entries collected by systemd journald service
	Journal(ctx context.Context, in *JournalRequest, opts ...grpc.CallOption) (SysInfo_JournalClient, error)
}

SysInfoClient is the client API for SysInfo service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewSysInfoClient

func NewSysInfoClient(cc grpc.ClientConnInterface) SysInfoClient

type SysInfoClientProxy

type SysInfoClientProxy interface {
	SysInfoClient
	UptimeOneMany(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (<-chan *UptimeManyResponse, error)
	DmesgOneMany(ctx context.Context, in *DmesgRequest, opts ...grpc.CallOption) (SysInfo_DmesgClientProxy, error)
	JournalOneMany(ctx context.Context, in *JournalRequest, opts ...grpc.CallOption) (SysInfo_JournalClientProxy, error)
}

SysInfoClientProxy is the superset of SysInfoClient which additionally includes the OneMany proxy methods

func NewSysInfoClientProxy

func NewSysInfoClientProxy(cc *proxy.Conn) SysInfoClientProxy

NewSysInfoClientProxy creates a SysInfoClientProxy for use in proxied connections. NOTE: This takes a proxy.Conn instead of a generic ClientConnInterface as the methods here are only valid in proxy.Conn contexts.

type SysInfoServer

type SysInfoServer interface {
	// Uptime return
	Uptime(context.Context, *emptypb.Empty) (*UptimeReply, error)
	// display kernel-related messages
	Dmesg(*DmesgRequest, SysInfo_DmesgServer) error
	// Journal returns journal entries collected by systemd journald service
	Journal(*JournalRequest, SysInfo_JournalServer) error
}

SysInfoServer is the server API for SysInfo service. All implementations should embed UnimplementedSysInfoServer for forward compatibility

type SysInfo_DmesgClient added in v1.23.0

type SysInfo_DmesgClient interface {
	Recv() (*DmesgReply, error)
	grpc.ClientStream
}

type SysInfo_DmesgClientProxy added in v1.23.0

type SysInfo_DmesgClientProxy interface {
	Recv() ([]*DmesgManyResponse, error)
	grpc.ClientStream
}

type SysInfo_DmesgServer added in v1.23.0

type SysInfo_DmesgServer interface {
	Send(*DmesgReply) error
	grpc.ServerStream
}

type SysInfo_JournalClient added in v1.23.5

type SysInfo_JournalClient interface {
	Recv() (*JournalReply, error)
	grpc.ClientStream
}

type SysInfo_JournalClientProxy added in v1.23.5

type SysInfo_JournalClientProxy interface {
	Recv() ([]*JournalManyResponse, error)
	grpc.ClientStream
}

type SysInfo_JournalServer added in v1.23.5

type SysInfo_JournalServer interface {
	Send(*JournalReply) error
	grpc.ServerStream
}

type UnimplementedSysInfoServer

type UnimplementedSysInfoServer struct {
}

UnimplementedSysInfoServer should be embedded to have forward compatible implementations.

func (UnimplementedSysInfoServer) Dmesg added in v1.23.0

func (UnimplementedSysInfoServer) Journal added in v1.23.5

func (UnimplementedSysInfoServer) Uptime

type UnsafeSysInfoServer

type UnsafeSysInfoServer interface {
	// contains filtered or unexported methods
}

UnsafeSysInfoServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SysInfoServer will result in compilation errors.

type UptimeManyResponse

type UptimeManyResponse struct {
	Target string
	// As targets can be duplicated this is the index into the slice passed to proxy.Conn.
	Index int
	Resp  *UptimeReply
	Error error
}

UptimeManyResponse encapsulates a proxy data packet. It includes the target, index, response and possible error returned.

type UptimeReply

type UptimeReply struct {

	// show the uptime in protobuf.Duration
	UptimeSeconds *durationpb.Duration `protobuf:"bytes,1,opt,name=uptime_seconds,json=uptimeSeconds,proto3" json:"uptime_seconds,omitempty"`
	// contains filtered or unexported fields
}

func (*UptimeReply) Descriptor deprecated

func (*UptimeReply) Descriptor() ([]byte, []int)

Deprecated: Use UptimeReply.ProtoReflect.Descriptor instead.

func (*UptimeReply) GetUptimeSeconds

func (x *UptimeReply) GetUptimeSeconds() *durationpb.Duration

func (*UptimeReply) ProtoMessage

func (*UptimeReply) ProtoMessage()

func (*UptimeReply) ProtoReflect

func (x *UptimeReply) ProtoReflect() protoreflect.Message

func (*UptimeReply) Reset

func (x *UptimeReply) Reset()

func (*UptimeReply) String

func (x *UptimeReply) String() string

Directories

Path Synopsis
Package client provides the client interface for 'sysinfo'
Package client provides the client interface for 'sysinfo'
Package server implements the sansshell 'SysInfo' service.
Package server implements the sansshell 'SysInfo' service.

Jump to

Keyboard shortcuts

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