test build
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-09-28 11:55:15 +10:00
parent 46f151f599
commit 95a48a89a6
25 changed files with 2358 additions and 12 deletions

View File

@@ -15,13 +15,14 @@ type UcsmTemperaturesCollector struct {
ctx context.Context
}
type ComputeMbTempStats struct {
XMLName xml.Name `xml:"computeMbTempStats"`
Dn string `xml:"dn,attr,omitempty"`
FmTempSenIo string `xml:"fmTempSenIo,attr,omitempty"`
FmTempSenRear string `xml:"fmTempSenRear,attr,omitempty"`
}
/*
type ComputeMbTempStats struct {
XMLName xml.Name `xml:"computeMbTempStats"`
Dn string `xml:"dn,attr,omitempty"`
FmTempSenIo string `xml:"fmTempSenIo,attr,omitempty"`
FmTempSenRear string `xml:"fmTempSenRear,attr,omitempty"`
}
*/
func NewUcsmTemperatureCollector(client *api.Client, ctx context.Context) *UcsmTemperaturesCollector {
return &UcsmTemperaturesCollector{
ucsClient: client,
@@ -52,7 +53,7 @@ func (u *UcsmTemperaturesCollector) Collect(ch chan<- prometheus.Metric) {
type temps struct {
XMLName xml.Name
Temperatures []ComputeMbTempStats `xml:"computeMbTempStats"`
Temperatures []mo.ComputeMbTempStats `xml:"computeMbTempStats"`
}
bladeRequest := api.ConfigResolveClassRequest{
@@ -74,6 +75,7 @@ func (u *UcsmTemperaturesCollector) Collect(ch chan<- prometheus.Metric) {
log.Printf("%s:\n", blade.Dn)
boardDn := "^" + blade.Dn + "/board/"
//boardDn := blade.Dn + "/board/"
log.Printf("%s:\n", boardDn)
log.Printf("\tNumber of CPUs: %d\n", blade.NumOfCpus)
@@ -100,10 +102,12 @@ func (u *UcsmTemperaturesCollector) Collect(ch chan<- prometheus.Metric) {
var tempList temps
log.Printf("Retrieving temperatures for this blade\n")
if err := u.ucsClient.ConfigResolveClass(u.ctx, tempReq, &tempList); err != nil {
log.Fatalf("Unable to retrieve `computeMbTempStats` managed object: %s", err)
}
/*
if err := u.ucsClient.ConfigResolveClass(u.ctx, tempReq, &tempList); err != nil {
log.Fatalf("Unable to retrieve `computeMbTempStats` managed object: %s", err)
}
*/
u.ucsClient.ConfigResolveClass(u.ctx, tempReq, &tempList)
log.Printf("Front Temperature: %v\n", tempList)
}