Browse Source

update octopushttp

pull/544/head
tzwang 2 months ago
parent
commit
ccbaae766f
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      internal/storeLink/octopusHttp/octopusHttp.go

+ 13
- 3
internal/storeLink/octopusHttp/octopusHttp.go View File

@@ -1110,15 +1110,25 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector.
var cpuCore int64
var memGi int64

// card
if cNum == "" {
return nil, nil
}
cardNum, err := strconv.ParseInt(cNum, 10, 64)
if err != nil {
cardNum = 0
return nil, nil
}

// cpu
if s.ResourceQuantity.Cpu == "" {
return nil, nil
}
cpuCore, err = strconv.ParseInt(s.ResourceQuantity.Cpu, 10, 64)
if err != nil {
cpuCore = 0
return nil, nil
}

//memory
if s.ResourceQuantity.Memory != "" {
gi := strings.Split(s.ResourceQuantity.Memory, Gi)
if len(gi) != 2 {
@@ -1132,7 +1142,7 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector.
memGi = mGi
}
} else {
memGi = 0
return nil, nil
}

card := &collector.Usage{


Loading…
Cancel
Save