omreport

package module
v0.0.0-...-636ec49 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

README

gomreport CircleCI GoDoc Go Report Card

A Go library for programmatically interacting with Dell OpenManage's omreport utility. For documentation on how to use this library, see godoc.

Compatibility

Dell servers with OMSA versions 7.x, 8.x, or 9.x installed are currently supported.

OMSA Version Supported
7.x
8.x
9.x

Contributing

Bug reports

If a bug is discovered, file a GitHub issue with the following information:

  • Description of the problem
  • Steps to reproduce the problem
  • Version of OMSA installed
  • Linux distribution and kernel version
  • Any other relevant information that will be useful for debugging and reproducing the problem

Features and enhancements

Feature and enhancement requests including support for additional fields and subcommands should first be raised as a GitHub issue.

Bugfixes

Minor and trivial bugfixes can be addressed via a PR without raising a GitHub issue.

Documentation

Index

Constants

View Source
const (
	// DefaultOMCLIProxyDir is the default path to directory that contains omcliproxy.
	DefaultOMCLIProxyDir = "/opt/dell/srvadmin/sbin"

	// DefaultOMCLIProxyBinaryName is the default name of the omcliproxy binary.
	DefaultOMCLIProxyBinaryName = "omcliproxy"

	// DefaultOMReportCommandName is the default name of omreport subcommand passed to omcliproxy.
	DefaultOMReportCommandName = "omreport"
)
View Source
const (
	AttrLogicalConnector = 1 << 6
	AttrGlobalHS         = 1 << 7
	AttrDedicatedHS      = 1 << 8
	AttrNonRAID          = 1 << 9
	AttrFailurePredicted = 1 << 11

	StatusOK          Status = 2
	StatusNonCritical Status = 3
	StatusCritical    Status = 4

	StateReady                    State = 1
	StateFailed                   State = 2
	StateOnline                   State = 4
	StateOffline                  State = 8
	StateDegraded                 State = 32
	StateNonRAID                  State = 4096
	StateReplacing                State = 2097152
	StateRebuilding               State = 8388608
	StateBackgroundInitialization State = 34359738368
	StateForeign                  State = 274877906944
	StateClear                    State = 549755813888
	StateDegradedRedundancy       State = 9007199254740992

	LayoutRAID0  Layout = 2
	LayoutRAID1  Layout = 4
	LayoutRAID5  Layout = 64
	LayoutRAID6  Layout = 128
	LayoutRAID60 Layout = 262144

	BusProtocolSCSI BusProtocol = 1
	BusProtocolIDE  BusProtocol = 2
	BusProtocolSATA BusProtocol = 7
	BusProtocolSAS  BusProtocol = 8
	BusProtocolPCIe BusProtocol = 9

	// NaN is an enum for fields that use the string 'N/A'.
	NaN = -1 << 31
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AboutOutput

type AboutOutput struct {
	Version string `xml:"About>ProductVersion"`
}

AboutOutput models the output of 'omreport about'.

type BatteryProbe

type BatteryProbe struct {
	ID       int    `xml:"index,attr"`
	Location string `xml:"ProbeLocation"`
	Status   Status `xml:"objstatus"`
}

BatteryProbe models a battery probe described by omreport.

type BusProtocol

type BusProtocol int

BusProtocol models the bus protocol used by a hardware component.

func (*BusProtocol) String

func (b *BusProtocol) String() string

type ChassisBatteriesOutput

type ChassisBatteriesOutput struct {
	Probes []BatteryProbe `xml:"BatteryObj"`
}

ChassisBatteriesOutput models the output of 'omreport chassis batteries'.

type ChassisEntry

type ChassisEntry struct {
	Hostname     string          `xml:"ChassisInfo>SystemInfo>SystemName"`
	FirmwareList []FirmwareEntry `xml:"ChassisInfo>FirmwareList>Firmware"`
	Model        string          `xml:"ChassisInfo>ChassisProps1>ChassModel"`
	LockPresent  bool            `xml:"ChassisInfo>ChassisProps1>ChassLockPresent"`
	ServiceTag   string          `xml:"ChassisInfo>ChassisProps2>ServiceTag"`
}

ChassisEntry models a chassis described by omreport.

type ChassisFansOutput

type ChassisFansOutput struct {
	Probes []FanProbe `xml:"Chassis>FanProbeList>FanProbe"`
}

ChassisFansOutput models the output of 'omreport chassis fans'.

type ChassisInfoOutput

type ChassisInfoOutput struct {
	ChassisList []ChassisEntry `xml:"ChassisList>Chassis"`
}

ChassisInfoOutput models the output of 'omreport chassis info'.

type ChassisMemoryOutput

type ChassisMemoryOutput struct {
	TotalPhysicalMemorySize     float64 `xml:"MemoryInfo>TotalPhysMemorySize"`
	AvailablePhysicalMemorySize float64 `xml:"MemoryInfo>AvailPhysMemorySize"`
	Dimms                       []Dimm  `xml:"MemDevObj"`
	Status                      Status  `xml:"ObjStatus"`
}

ChassisMemoryOutput models the output of 'omreport chassis memory'.

type ChassisOutput

type ChassisOutput struct {
	FansStatus            Status `xml:"Parent>fans>computedobjstatus"`
	MemoryStatus          Status `xml:"Parent>memory>computedobjstatus"`
	PowerSuppliesStatus   Status `xml:"Parent>powersupply>computedobjstatus"`
	PowerManagementStatus Status `xml:"Parent>powermonitoring>computedobjstatus"`
	ProcessorsStatus      Status `xml:"Parent>processor>computedobjstatus"`
	TemperaturesStatus    Status `xml:"Parent>temperatures>computedobjstatus"`
	VoltagesStatus        Status `xml:"Parent>voltages>computedobjstatus"`
	HardwareLogStatus     Status `xml:"Parent>esmlog>computedobjstatus"`
	BatteriesStatus       Status `xml:"Parent>batteries>computedobjstatus"`
}

ChassisOutput models the output of 'omreport chassis'.

type ChassisPowerMonitoringOutput

type ChassisPowerMonitoringOutput struct {
	Probes []PowerProbe `xml:"CurrentProbeList>CurrentProbe"`
	Status Status       `xml:"ObjStatus"`
}

ChassisPowerMonitoringOutput models the output of 'omreport chassis pwrmonitoring'.

type ChassisPowerSuppliesOutput

type ChassisPowerSuppliesOutput struct {
	PowerSupplies []PowerSupply `xml:"Chassis>PowerSupplyList>PowerSupply"`
}

ChassisPowerSuppliesOutput models the output of 'omreport chassis pwrsupplies'.

type ChassisProcessorsOutput

type ChassisProcessorsOutput struct {
	Processors []Processor      `xml:"ProcessorList>ProcessorConn"`
	Probes     []ProcessorProbe `xml:"CPUStatusProbeList>CPUStatusProbe"`
}

ChassisProcessorsOutput models the output of 'omreport chassis processors'.

type ChassisTempsOutput

type ChassisTempsOutput struct {
	Probes []TemperatureProbe `xml:"Chassis>TemperatureProbeList>TemperatureProbe"`
}

ChassisTempsOutput models the output of 'omreport chassis temps'.

type Config

type Config struct {
	// Full path to the omcliproxy binary.
	OMCLIProxyPath string

	// Whether or not to enable enhanced security mode.
	// Enabling this checks the sha256 of the omcliproxy binary
	// and ensures that it has not been modified prior to executing it.
	EnhancedSecurityMode bool
}

type Controller

type Controller struct {
	ID     int    `xml:"ControllerNum"`
	Name   string `xml:"Name"`
	Status Status `xml:"ObjStatus"`
	State  State  `xml:"ObjState"`
}

Controller models a controller described by omreport.

type Dimm

type Dimm struct {
	ArrayNo         int    `xml:"deviceSet"`
	AssetTag        string `xml:"AssetTag"`
	Errors          int    `xml:"errCount"`
	MultiBitErrors  int    `xml:"mbErrCount"`
	Name            string `xml:"DeviceLocator"`
	PartNo          string `xml:"PartNumber"`
	SingleBitErrors int    `xml:"sbErrCount"`
}

Dimm models a single memory module.

type Enclosure

type Enclosure struct {
	ID           int    `xml:"EnclosureID"`
	ControllerID int    `xml:"ControllerNum"`
	Status       Status `xml:"ObjStatus"`
	State        State  `xml:"ObjState"`
}

Enclosure models a enclosure described by omreport.

type FanProbe

type FanProbe struct {
	ID                      int     `xml:"index,attr"`
	Reading                 float64 `xml:"ProbeReading"`
	Status                  Status  `xml:"ProbeStatus"`
	Location                string  `xml:"ProbeLocation"`
	MinCriticalThreshold    float64 `xml:"ProbeThresholds>LCThreshold"`
	MinNonCriticalThreshold float64 `xml:"ProbeThresholds>LNCThreshold"`
}

FanProbe models a fan probe described by omreport.

type Fans

type Fans struct {
	Probes []Probe `xml:"FanObj"`
	Status Status  `xml:"computedobjstatus"`
}

Fans models a group of fans and their status.

type FirmwareEntry

type FirmwareEntry struct {
	Name    string `xml:"FWText"`
	Version string `xml:"FWVersion"`
}

FirmwareEntry models a firmware entry described by omreport.

type Layout

type Layout int

Layout models the layout of a RAID (e.g. RAID-0, RAID-1, RAID-10, etc.)

func (*Layout) String

func (l *Layout) String() string

type OMReport

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

OMReport implements OMReporter.

func NewOMReporter

func NewOMReporter(cfg *Config) (*OMReport, error)

NewOMReporter returns a struct that implements OMReporter. Returns an error if the provided path to omcliproxy is potentially malicious and doesn't match known signatures.

func (*OMReport) About

func (om *OMReport) About() (*AboutOutput, error)

About returns OMSA version information gathered from omreport.

func (*OMReport) Chassis

func (om *OMReport) Chassis() (*ChassisOutput, error)

Chassis returns server chassis information gathered from omreport.

func (*OMReport) ChassisBatteries

func (om *OMReport) ChassisBatteries() (*ChassisBatteriesOutput, error)

ChassisBatteries returns battery information gathered from omreport.

func (*OMReport) ChassisFans

func (om *OMReport) ChassisFans() (*ChassisFansOutput, error)

ChassisFans returns fan information gathered from omreport.

func (*OMReport) ChassisInfo

func (om *OMReport) ChassisInfo() (*ChassisInfoOutput, error)

ChassisInfo returns chassis information gathered from omreport.

func (*OMReport) ChassisMemory

func (om *OMReport) ChassisMemory() (*ChassisMemoryOutput, error)

ChassisMemory returns memory information gathered from omreport.

func (*OMReport) ChassisPowerMonitoring

func (om *OMReport) ChassisPowerMonitoring() (*ChassisPowerMonitoringOutput, error)

ChassisPowerMonitoring returns power monitoring information gathered from omreport.

func (*OMReport) ChassisPowerSupplies

func (om *OMReport) ChassisPowerSupplies() (*ChassisPowerSuppliesOutput, error)

ChassisPowerSupplies returns power supply information gathered from omreport.

func (*OMReport) ChassisProcessors

func (om *OMReport) ChassisProcessors() (*ChassisProcessorsOutput, error)

ChassisProcessors returns processor information gathered from omreport.

func (*OMReport) ChassisTemps

func (om *OMReport) ChassisTemps() (*ChassisTempsOutput, error)

ChassisTemps returns temperature information gathered from omreport.

func (*OMReport) Report

func (om *OMReport) Report(args ...string) ([]byte, error)

Report runs the specified omreport command with provided arguments.

func (*OMReport) StorageController

func (om *OMReport) StorageController() (*StorageControllerOutput, error)

StorageController returns RAID controller information gathered from omreport.

func (*OMReport) StorageEnclosure

func (om *OMReport) StorageEnclosure() (*StorageEnclosureOutput, error)

StorageEnclosure returns storage enclosure information gathered from omreport.

func (*OMReport) StoragePDisk

func (om *OMReport) StoragePDisk(cid int) (*StoragePDiskOutput, error)

StoragePDisk returns physical disk information associated with the provided storage controller gathered from omreport.

func (*OMReport) StorageVDisk

func (om *OMReport) StorageVDisk() (*StorageVDiskOutput, error)

StorageVDisk returns virtual disk information gathered from omreport.

func (*OMReport) SuspiciousOMCLIProxyBinary

func (om *OMReport) SuspiciousOMCLIProxyBinary() error

SuspiciousOMCLIProxyBinary is a method that can be called by clients to check whether the configured omcliproxy binary is suspicious. The binary is considered suspicious if its sha256 checksum is different from the checksum computed when the omreport object was first instantiated using NewOMReporter. This implies that something has changed the the executable contents underneath this process and that further execution should proceed with caution. Returns a non-nil error if the binary is considered suspicious or if the file checksum cannot be calculated.

type OMReporter

type OMReporter interface {
	Report(...string) ([]byte, error)
	Chassis() (*ChassisOutput, error)
	ChassisInfo() (*ChassisInfoOutput, error)
	ChassisBatteries() (*ChassisBatteriesOutput, error)
	ChassisFans() (*ChassisFansOutput, error)
	ChassisProcessors() (*ChassisProcessorsOutput, error)
	ChassisMemory() (*ChassisMemoryOutput, error)
	ChassisTemps() (*ChassisTempsOutput, error)
	ChassisPowerMonitoring() (*ChassisPowerMonitoringOutput, error)
	ChassisPowerSupplies() (*ChassisPowerSuppliesOutput, error)
	StorageController() (*StorageControllerOutput, error)
	StorageEnclosure() (*StorageEnclosureOutput, error)
	StorageVDisk() (*StorageVDiskOutput, error)
	StoragePDisk(cid int) (*StoragePDiskOutput, error)
	SuspiciousOMCLIProxyBinary() error
}

An OMReporter gathers information from Dell's omreport utility.

type PDisk

type PDisk struct {
	AttributesMask string      `xml:"AttributesMask"`
	BusProtocol    BusProtocol `xml:"BusProtocol"`
	ID             int         `xml:"DeviceID"`
	ControllerID   int         `xml:"ControllerNum"`
	EnclosureID    int         `xml:"EnclosureID"`
	PartNo         string      `xml:"PartNo"`
	ProductID      string      `xml:"ProductID"`
	SerialNo       string      `xml:"DeviceSerialNumber"`
	SlotNo         int         `xml:"EnclosureIndex"`
	Status         Status      `xml:"ObjStatus"`
	State          State       `xml:"ObjState"`
	Vendor         string      `xml:"Vendor"`
}

PDisk models a physical disk described by omreport.

func (*PDisk) DedicatedHotSpare

func (p *PDisk) DedicatedHotSpare() (bool, error)

DedicatedHotSpare returns true if a physical disk is a dedicated hot spare. Returns an error if attribute cannot be determined.

func (*PDisk) FailurePredicted

func (p *PDisk) FailurePredicted() (bool, error)

FailurePredicted returns true if a physical disk is in a failure predicted state. Returns an error if attribute cannot be determined.

func (*PDisk) GlobalHotSpare

func (p *PDisk) GlobalHotSpare() (bool, error)

GlobalHotSpare returns true if a physical disk is a global hot spare. Returns an error if attribute cannot be determined.

type PowerProbe

type PowerProbe struct {
	ID                int     `xml:"index,attr"`
	Name              string  `xml:"ProbeLocation"`
	Reading           float64 `xml:"ProbeReading"`
	Status            Status  `xml:"ProbeStatus"`
	CriticalThreshold float64 `xml:"ProbeThresholds>UCThreshold"`
	WarningThreshold  float64 `xml:"ProbeThresholds>UNCThreshold"`
}

PowerProbe models a power consumption probe.

type PowerSupply

type PowerSupply struct {
	ID                     int              `xml:"index,attr"`
	InputRatedWatts        float64          `xml:"InputRatedWatts"`
	FirmwareVersion        string           `xml:"FirmWareVersion"`
	PowerMonitoringCapable bool             `xml:"PMCapable"`
	OutputWatts            float64          `xml:"OutputWatts"`
	Location               string           `xml:"PSLocation"`
	State                  PowerSupplyState `xml:"PSState"`
}

PowerSupply models a power supply described by omreport.

type PowerSupplyState

type PowerSupplyState struct {
	PresenceDetected      bool `xml:"PSPresenceDetected"`
	FailureDetected       bool `xml:"PSFailureDetected"`
	PredictiveFailure     bool `xml:"PSPredictiveFailure"`
	ACLost                bool `xml:"PSACLost"`
	ACLostOrOutOfRange    bool `xml:"PSACLostorOutofRange"`
	ACPresentOrOutOfRange bool `xml:"PSACPresentorOutofRange"`
	ConfigError           bool `xml:"PSConfigError"`
}

PowerSupplyState models the state of a power supply.

type Probe

type Probe struct {
	ID                      int     `xml:"instance,attr"`
	Name                    string  `xml:"ProbeLocation"`
	MinCriticalThreshold    float64 `xml:"probeThresholds>lcThreshold"`
	MinNonCriticalThreshold float64 `xml:"probeThresholds>lncThreshold"`
	MaxCriticalThreshold    float64 `xml:"probeThresholds>ucThreshold"`
	MaxNonCriticalThreshold float64 `xml:"probeThresholds>uncThreshold"`
	Reading                 float64 `xml:"probeReading"`
	Status                  Status  `xml:"objstatus"`
}

Probe models a generic probe.

type Processor

type Processor struct {
	ID            int     `xml:"index,attr"`
	Name          string  `xml:"DevProcessor>ExtName"`
	MaxSpeed      float64 `xml:"DevProcessor>MaxSpeed"`
	CurrentSpeed  float64 `xml:"DevProcessor>CurSpeed"`
	Manufacturer  string  `xml:"DevProcessor>Manufacturer"`
	Model         string  `xml:"DevProcessor>Brand"`
	PhysicalCores int     `xml:"DevProcessor>CoreCount"`
	VirtualCores  int     `xml:"DevProcessor>ThreadCount"`
	Status        Status  `xml:"status,attr"`
}

Processor models a CPU described by omreport.

type ProcessorProbe

type ProcessorProbe struct {
	ID                   int    `xml:"index,attr"`
	Location             string `xml:"ProbeLocation"`
	InternalError        bool   `xml:"ProcessorStatus>CPUStatusIErr"`
	ThermTrip            bool   `xml:"ProcessorStatus>CPUStatusThermTrip"`
	ConfigError          bool   `xml:"ProcessorStatus>CPUStatusConfigErr"`
	PresenceDetected     bool   `xml:"ProcessorStatus>CPUStatusPresenceDetected"`
	Disabled             bool   `xml:"ProcessorStatus>CPUStatusDisabled"`
	TermPresenceDetected bool   `xml:"ProcessorStatus>CPUStatusTermPresenceDetected"`
	Throttled            bool   `xml:"ProcessorStatus>CPUStatusThrottled"`
}

ProcessorProbe models a CPU probe described by omreport.

type State

type State int

State models the state of a hardware component (e.g. Ready, Degraded, Failed, etc.)

func (*State) String

func (s *State) String() string

type Status

type Status int

Status models the status of a hardware component (e.g. OK, Critical, NonCritical).

func (*Status) String

func (s *Status) String() string

type StorageControllerOutput

type StorageControllerOutput struct {
	Controllers []Controller `xml:"Controllers>DCStorageObject"`
}

StorageControllerOutput models the output of 'omreport storage controller'.

type StorageEnclosureOutput

type StorageEnclosureOutput struct {
	Enclosures []Enclosure `xml:"Enclosures>DCStorageObject"`
}

StorageEnclosureOutput models the output of 'omreport storage enclosure'.

type StoragePDiskOutput

type StoragePDiskOutput struct {
	PDisks []PDisk `xml:"ArrayDisks>DCStorageObject"`
}

StoragePDiskOutput models the output of 'omreport storage pdisk controller=<ID>'.

type StorageVDiskOutput

type StorageVDiskOutput struct {
	VDisks []VDisk `xml:"VirtualDisks>DCStorageObject"`
}

StorageVDiskOutput models the output of 'omreport storage vdisk'.

type TemperatureProbe

type TemperatureProbe struct {
	ID       int     `xml:"index,attr"`
	Reading  float64 `xml:"ProbeReading"`
	Status   Status  `xml:"ProbeStatus"`
	Location string  `xml:"ProbeLocation"`
}

TemperatureProbe models a temperature probe described by omreport.

type VDisk

type VDisk struct {
	ID          int         `xml:"DeviceID"`
	BusProtocol BusProtocol `xml:"BusProtocol"`
	Name        string      `xml:"Name"`
	DeviceName  string      `xml:"DeviceName"`
	Layout      Layout      `xml:"Layout"`
	State       State       `xml:"ObjState"`
	Status      Status      `xml:"ObjStatus"`
	Size        int         `xml:"Length"`
}

VDisk models a virtual disk described by omreport.

type Voltages

type Voltages struct {
	Probes []Probe `xml:"VoltageObj"`
	Status Status  `xml:"computedobjstatus"`
}

Voltages models a group of voltage probes and their status.

Jump to

Keyboard shortcuts

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