hmcpcm

package
v0.0.0-...-2987df4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDebugLogger

func GetDebugLogger(filename string) (*log.Logger, error)

GetDebugLogger returns a logger handler for HMC API debug data

func SetLogDir

func SetLogDir(dir string)

SetLogDir xx

Types

type Content

type Content struct {
	//XMLName xml.Name        `xml:"content"`
	System []ManagedSystem `xml:"http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/ ManagedSystem"`
}

Content feed struct containing all managed systems

type Entry

type Entry struct {
	//XMLName xml.Name `xml:"entry"`
	ID   string `xml:"id"`
	Link struct {
		Href string `xml:"href,attr"`
		Type string `xml:"type,attr"`
	} `xml:"link,omitempty"`
	Contents []Content `xml:"content"`
	Category struct {
		Term string `xml:"term,attr"`
	} `xml:"category,omitempty"`
}

Entry is the atom feed section containing the links to PCM data and the Category

type Feed

type Feed struct {
	//XMLName xml.Name `xml:"feed"`
	Entries []Entry `xml:"entry"`
}

Feed base struct of Atom feed

type Link struct {
	Href string `xml:"href,attr"`
}

Link the link itself is stored in the attribute href

type Logger

type Logger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
}

Logger interface

type LogicalPartition

type LogicalPartition struct {
	//XMLName                xml.Name `xml:"LogicalPartition"`
	LogicalSerialNumber    string `xml:"LogicalSerialNumber"`
	OperatingSystemVersion string `xml:"OperatingSystemVersion"`
	PartitionName          string `xml:"PartitionName"`
	PartitionState         string `xml:"PartitionState"`
	PartitionType          string `xml:"PartitionType"`
	PartitionUUID          string `xml:"PartitionUUID"`
}

LogicalPartition Contains

type LparContent

type LparContent struct {
	//XMLName xml.Name           `xml:"content"`
	Lpar []LogicalPartition `xml:"http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/ LogicalPartition"`
}

LparContent feed struct containing all managed systems

type LparData

type LparData struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Type   string `json:"type"`
	Memory struct {
		LogicalMem        []float64 `json:"logicalMem"`
		BackedPhysicalMem []float64 `json:"backedPhysicalMem"`
	} `json:"memory"`
	Processor struct {
		PoolID                      int       `json:"poolId"`
		Weight                      int       `json:"weight"`
		Mode                        string    `json:"mode"`
		MaxVirtualProcessors        []float64 `json:"maxVirtualProcessors"`
		MaxProcUnits                []float64 `json:"maxProcUnits"`
		EntitledProcUnits           []float64 `json:"entitledProcUnits"`
		UtilizedProcUnits           []float64 `json:"utilizedProcUnits"`
		UtilizedCappedProcUnits     []float64 `json:"utilizedCappedProcUnits"`
		UtilizedUncappedProcUnits   []float64 `json:"utilizedUncappedProcUnits"`
		IdleProcUnits               []float64 `json:"idleProcUnits"`
		DonatedProcUnits            []float64 `json:"donatedProcUnits"`
		TimeSpentWaitingForDispatch []float64 `json:"timeSpentWaitingForDispatch"`
		TimePerInstructionExecution []float64 `json:"timePerInstructionExecution"`
	} `json:"processor"`
	Storage struct {
		VirtualFiberChannelAdapters []struct {
			TransmittedBytes []float64 `json:"transmittedBytes"`
			Wwpn             string    `json:"wwpn"`
			Wwpn2            string    `json:"wwpn2"`
			ViosID           int       `json:"viosId"`
			PhysicalLocation string    `json:"physicalLocation"`
			PhysicalPortWWPN string    `json:"physicalPortWWPN"`
			RunningSpeed     []float64 `json:"runningSpeed"`
			ID               string    `json:"id"`
			NumOfReads       []float64 `json:"numOfReads"`
			NumOfWrites      []float64 `json:"numOfWrites"`
			ReadBytes        []float64 `json:"readBytes"`
			WriteBytes       []float64 `json:"writeBytes"`
		} `json:"virtualFiberChannelAdapters"`
		GenericVirtualAdapters []struct {
			TransmittedBytes []float64 `json:"transmittedBytes"`
			Type             string    `json:"type"`
			ID               string    `json:"id"`
			ViosID           int       `json:"viosId"`
			PhysicalLocation string    `json:"physicalLocation"`
			NumOfReads       []float64 `json:"numOfReads"`
			NumOfWrites      []float64 `json:"numOfWrites"`
			ReadBytes        []float64 `json:"readBytes"`
			WriteBytes       []float64 `json:"writeBytes"`
		} `json:"genericVirtualAdapters"`
	} `json:"storage"`
	Network struct {
		VirtualEthernetAdapters []struct {
			TransferredPhysicalBytes []float64 `json:"transferredPhysicalBytes"`
			TransferredBytes         []float64 `json:"transferredBytes"`
			PhysicalLocation         string    `json:"physicalLocation"`
			VlanID                   int       `json:"vlanId"`
			VswitchID                int       `json:"vswitchId"`
			IsPortVlanID             bool      `json:"isPortVlanId"`
			ReceivedPackets          []float64 `json:"receivedPackets"`
			SentPackets              []float64 `json:"sentPackets"`
			DroppedPackets           []float64 `json:"droppedPackets"`
			SentBytes                []float64 `json:"sentBytes"`
			ReceivedBytes            []float64 `json:"receivedBytes"`
			ReceivedPhysicalPackets  []float64 `json:"receivedPhysicalPackets"`
			SentPhysicalPackets      []float64 `json:"sentPhysicalPackets"`
			DroppedPhysicalPackets   []float64 `json:"droppedPhysicalPackets"`
			SentPhysicalBytes        []float64 `json:"sentPhysicalBytes"`
			ReceivedPhysicalBytes    []float64 `json:"receivedPhysicalBytes"`
			ViosID                   int       `json:"viosId,omitempty"`
			SharedEthernetAdapterID  string    `json:"sharedEthernetAdapterId,omitempty"`
		} `json:"virtualEthernetAdapters"`
		SriovLogicalPorts []struct {
			DrcIndex         string    `json:"drcIndex"`
			PhysicalLocation string    `json:"physicalLocation"`
			PhysicalDrcIndex string    `json:"physicalDrcIndex"`
			PhysicalPortID   int       `json:"physicalPortId"`
			TransferredBytes []float64 `json:"transferredBytes"`
			VlanID           int       `json:"vlanId"`
			VswitchID        int       `json:"vswitchId"`
			IsPortVlanID     bool      `json:"isPortVlanId"`
			ReceivedPackets  []float64 `json:"receivedPackets"`
			SentPackets      []float64 `json:"sentPackets"`
			DroppedPackets   []float64 `json:"droppedPackets"`
			SentBytes        []float64 `json:"sentBytes"`
			ReceivedBytes    []float64 `json:"receivedBytes"`
			ViosID           int       `json:"viosId,omitempty"`
		} `json:"sriovLogicalPorts"`
	} `json:"network"`
	State string `json:"state"`
	UUID  string `json:"uuid"`
}

LparData LPAR data

type LparEntry

type LparEntry struct {
	//XMLName  xml.Name      `xml:"entry"`
	ID       string        `xml:"id"`
	Contents []LparContent `xml:"content"`
}

LparEntry is the atom feed section containing the LPAR info

type ManagedSystem

type ManagedSystem struct {
	//XMLName                     xml.Name `xml:"http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/ ManagedSystem"`
	SystemName                  string
	State                       string
	AssociatedLogicalPartitions Partitions `xml:"http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/ AssociatedLogicalPartitions" json:"-"`
	AssociatedVirtualIOServers  Partitions `xml:"http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/ AssociatedVirtualIOServers" json:"-"`
	//Only
	Lpars map[string]*LogicalPartition `xml:"-"`
	Vios  map[string]*VirtualIOServer  `xml:"-"`
	UUID  string                       `xml:"-"`
}

ManagedSystem struct contains a managed system and his associated partitions

type PCMData

type PCMData struct {
	SystemUtil struct {
		UtilInfo struct {
			Version          string   `json:"version"`
			MetricType       string   `json:"metricType"`
			Frequency        int      `json:"frequency"`
			StartTimeStamp   string   `json:"startTimeStamp"`
			EndTimeStamp     string   `json:"endTimeStamp"`
			Mtms             string   `json:"mtms"`
			Name             string   `json:"name"`
			MetricArrayOrder []string `json:"metricArrayOrder"`
			UUID             string   `json:"uuid"`
		} `json:"utilInfo"`
		UtilSamples []struct {
			SampleType         string `json:"sampleType"`
			SystemFirmwareUtil struct {
				UtilizedProcUnits []interface{} `json:"utilizedProcUnits"`
				AssignedMem       []float64     `json:"assignedMem"`
			} `json:"systemFirmwareUtil"`
			ServerUtil ServerData `json:"serverUtil"`
			ViosUtil   []ViosData `json:"viosUtil"`
			LparsUtil  []LparData `json:"lparsUtil"`
			SampleInfo struct {
				TimeStamp string `json:"timeStamp"`
				Status    int    `json:"status"`
				ErrorInfo []struct {
					ErrID           string `json:"errId"`
					ErrMsg          string `json:"errMsg"`
					UUID            string `json:"uuid"`
					ReportedBy      string `json:"reportedBy"`
					OccurrenceCount int    `json:"occurrenceCount"`
				} `json:"errorInfo"`
			} `json:"sampleInfo"`
		} `json:"utilSamples"`
	} `json:"systemUtil"`
}

PCMData contains the json data structure

type Partitions

type Partitions struct {
	Links []Link `xml:"link,omitempty"`
}

Partitions contains links to the partition informations

type ServerData

type ServerData struct {
	Processor struct {
		TotalProcUnits        []float64 `json:"totalProcUnits"`
		UtilizedProcUnits     []float64 `json:"utilizedProcUnits"`
		AvailableProcUnits    []float64 `json:"availableProcUnits"`
		ConfigurableProcUnits []float64 `json:"configurableProcUnits"`
	} `json:"processor"`
	Memory struct {
		TotalMem           []float64 `json:"totalMem"`
		AssignedMemToLpars []float64 `json:"assignedMemToLpars"`
		AvailableMem       []float64 `json:"availableMem"`
		ConfigurableMem    []float64 `json:"configurableMem"`
	} `json:"memory"`
	SharedProcessorPool []struct {
		AssignedProcUnits   []float64 `json:"assignedProcUnits"`
		UtilizedProcUnits   []float64 `json:"utilizedProcUnits"`
		AvailableProcUnits  []float64 `json:"availableProcUnits"`
		ConfiguredProcUnits []float64 `json:"configuredProcUnits"`
		BorrowedProcUnits   []float64 `json:"borrowedProcUnits"`
		ID                  int       `json:"id"`
		Name                string    `json:"name"`
	} `json:"sharedProcessorPool"`
	Network struct {
		Headapters []struct {
			DrcIndex      string `json:"drcIndex"`
			PhysicalPorts []struct {
				TransferredBytes []float64 `json:"transferredBytes"`
				ID               int       `json:"id"`
				PhysicalLocation string    `json:"physicalLocation"`
				ReceivedPackets  []float64 `json:"receivedPackets"`
				SentPackets      []float64 `json:"sentPackets"`
				DroppedPackets   []float64 `json:"droppedPackets"`
				SentBytes        []float64 `json:"sentBytes"`
				ReceivedBytes    []float64 `json:"receivedBytes"`
			} `json:"physicalPorts"`
		} `json:"headapters"`
	} `json:"network"`
}

ServerData HCM Manage System Data

type Session

type Session struct {
	User     string
	Password string

	Debug bool
	// contains filtered or unexported fields
}

Session is the HTTP session struct

func NewSession

func NewSession(url string, user string, password string) (*Session, error)

NewSession initialize a Session struct

func (*Session) Debugf

func (s *Session) Debugf(expr string, vars ...interface{})

Debugf info

func (*Session) DoLogon

func (s *Session) DoLogon() error

DoLogon performs the login to the HMC

func (*Session) Errorf

func (s *Session) Errorf(expr string, vars ...interface{})

Errorf info

func (*Session) GetLparInfo

func (s *Session) GetLparInfo(link string) (*LogicalPartition, error)

GetLparInfo returns a list of the managed systems retrieved from the atom feed

func (*Session) GetLparPCMData

func (s *Session) GetLparPCMData(system *ManagedSystem, lpar *LogicalPartition) (PCMData, error)

GetLparPCMData get PCM for Lpar systems

func (*Session) GetManagedSystems

func (s *Session) GetManagedSystems() (feed *Feed, err error)

GetManagedSystems returns a list of the managed systems retrieved from the atom feed

func (*Session) GetPCMData

func (s *Session) GetPCMData(rawurl string) (PCMData, error)

GetPCMData retreives the PCM data in JSON format and returns them stored in an PCMData struct

func (*Session) GetSysPCMData

func (s *Session) GetSysPCMData(system *ManagedSystem) (PCMData, error)

GetSysPCMData get PCM for sytems

func (*Session) GetViosInfo

func (s *Session) GetViosInfo(link string) (*VirtualIOServer, error)

GetViosInfo returns a list of the managed systems retrieved from the atom feed

func (*Session) Infof

func (s *Session) Infof(expr string, vars ...interface{})

Infof info

func (*Session) PrintHTTPContent

func (s *Session) PrintHTTPContent(contents []byte)

PrintHTTPContent warn data

func (*Session) PrintHTTPContentJSON

func (s *Session) PrintHTTPContentJSON(contents []byte)

PrintHTTPContentJSON print format json

func (*Session) PrintHTTPContentXML

func (s *Session) PrintHTTPContentXML(contents []byte)

PrintHTTPContentXML print format XML

func (*Session) PrintHTTPRequest

func (s *Session) PrintHTTPRequest(request *http.Request)

PrintHTTPRequest print pretty HTTP request

func (*Session) PrintHTTPResponse

func (s *Session) PrintHTTPResponse(response *http.Response, d time.Duration)

PrintHTTPResponse print pretty HTTP response

func (*Session) Release

func (s *Session) Release()

Release session

func (*Session) SetDebugLog

func (s *Session) SetDebugLog(filename string)

SetDebugLog set filename for log

func (*Session) SetLog

func (s *Session) SetLog(l *logrus.Logger)

SetLog set logger the session

func (*Session) SetSamples

func (s *Session) SetSamples(samples int)

SetSamples SetCurrent Samples

func (*Session) Warnf

func (s *Session) Warnf(expr string, vars ...interface{})

Warnf log warn data

type ViosContent

type ViosContent struct {
	//XMLName xml.Name           `xml:"content"`
	Vios []VirtualIOServer `xml:"http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/ VirtualIOServer"`
}

ViosContent feed struct containing all managed systems

type ViosData

type ViosData struct {
	UUID   string `json:"uuid"`
	State  string `json:"state"`
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Memory struct {
		AssignedMem []float64 `json:"assignedMem"`
		UtilizedMem []float64 `json:"utilizedMem"`
	} `json:"memory"`
	Processor struct {
		PoolID                    int       `json:"poolId"`
		Weight                    int       `json:"weight"`
		Mode                      string    `json:"mode"`
		MaxVirtualProcessors      []float64 `json:"maxVirtualProcessors"`
		MaxProcUnits              []float64 `json:"maxProcUnits"`
		EntitledProcUnits         []float64 `json:"entitledProcUnits"`
		UtilizedProcUnits         []float64 `json:"utilizedProcUnits"`
		UtilizedCappedProcUnits   []float64 `json:"utilizedCappedProcUnits"`
		UtilizedUncappedProcUnits []float64 `json:"utilizedUncappedProcUnits"`
		IdleProcUnits             []float64 `json:"idleProcUnits"`
		DonatedProcUnits          []float64 `json:"donatedProcUnits"`
	} `json:"processor"`
	Network struct {
		GenericAdapters []struct {
			TransferredBytes []float64 `json:"transferredBytes"`
			Type             string    `json:"type"`
			ID               string    `json:"id"`
			PhysicalLocation string    `json:"physicalLocation"`
			ReceivedPackets  []float64 `json:"receivedPackets"`
			SentPackets      []float64 `json:"sentPackets"`
			DroppedPackets   []float64 `json:"droppedPackets"`
			SentBytes        []float64 `json:"sentBytes"`
			ReceivedBytes    []float64 `json:"receivedBytes"`
		} `json:"genericAdapters"`
		SharedAdapters []struct {
			TransferredBytes []float64 `json:"transferredBytes"`
			ID               string    `json:"id"`
			Type             string    `json:"type"`
			PhysicalLocation string    `json:"physicalLocation"`
			ReceivedPackets  []float64 `json:"receivedPackets"`
			SentPackets      []float64 `json:"sentPackets"`
			DroppedPackets   []float64 `json:"droppedPackets"`
			SentBytes        []float64 `json:"sentBytes"`
			ReceivedBytes    []float64 `json:"receivedBytes"`
			BridgedAdapters  []string  `json:"bridgedAdapters"`
		} `json:"sharedAdapters"`
	} `json:"network"`
	Storage struct {
		GenericPhysicalAdapters []struct {
			TransmittedBytes []float64 `json:"transmittedBytes"`
			Type             string    `json:"type"`
			ID               string    `json:"id"`
			PhysicalLocation string    `json:"physicalLocation"`
			NumOfReads       []float64 `json:"numOfReads"`
			NumOfWrites      []float64 `json:"numOfWrites"`
			ReadBytes        []float64 `json:"readBytes"`
			WriteBytes       []float64 `json:"writeBytes"`
		} `json:"genericPhysicalAdapters"`
		SharedStoragePools []struct {
			TransmittedBytes []float64 `json:"transmittedBytes"`
			ID               string    `json:"id"`
			TotalSpace       []float64 `json:"totalSpace"`
			UsedSpace        []float64 `json:"usedSpace"`
			NumOfReads       []float64 `json:"numOfReads"`
			NumOfWrites      []float64 `json:"numOfWrites"`
			ReadBytes        []float64 `json:"readBytes"`
			WriteBytes       []float64 `json:"writeBytes"`
		} `json:"sharedStoragePools"`
		FiberChannelAdapters []struct {
			TransmittedBytes []float64 `json:"transmittedBytes"`
			Wwpn             string    `json:"wwpn"`
			PhysicalLocation string    `json:"physicalLocation"`
			NumOfPorts       int       `json:"numOfPorts"`
			RunningSpeed     []float64 `json:"runningSpeed"`
			ID               string    `json:"id"`
			NumOfReads       []float64 `json:"numOfReads"`
			NumOfWrites      []float64 `json:"numOfWrites"`
			ReadBytes        []float64 `json:"readBytes"`
			WriteBytes       []float64 `json:"writeBytes"`
		} `json:"fiberChannelAdapters"`
		GenericVirtualAdapters []struct {
			TransmittedBytes []float64 `json:"transmittedBytes"`
			Type             string    `json:"type"`
			ID               string    `json:"id"`
			PhysicalLocation string    `json:"physicalLocation"`
			NumOfReads       []float64 `json:"numOfReads"`
			NumOfWrites      []float64 `json:"numOfWrites"`
			ReadBytes        []float64 `json:"readBytes"`
			WriteBytes       []float64 `json:"writeBytes"`
		} `json:"genericVirtualAdapters"`
	} `json:"storage"`
}

ViosData VIOS Data

type ViosEntry

type ViosEntry struct {
	//XMLName  xml.Name      `xml:"entry"`
	ID       string        `xml:"id"`
	Contents []ViosContent `xml:"content"`
}

ViosEntry is the atom feed section containing the LPAR info

type VirtualIOServer

type VirtualIOServer LogicalPartition

VirtualIOServer info for virtual servers

Jump to

Keyboard shortcuts

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