Skip to content

Commit

Permalink
small fixes on HMC import
Browse files Browse the repository at this point in the history
  • Loading branch information
adejoux committed Nov 20, 2016
1 parent d45edc3 commit 04b2d9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions hmc/hmc.go
Expand Up @@ -39,7 +39,7 @@ type HMC struct {
// Point is a struct to simplify InfluxDB point creation
type Point struct {
Name string
Server string
System string
Metric string
Pool string
Device string
Expand Down Expand Up @@ -91,7 +91,7 @@ func (hmc *HMC) AddPoint(point Point) {
value = float64(point.Value.(int))
}

tags := map[string]string{"server": hmc.GlobalPoint.Server, "name": point.Metric}
tags := map[string]string{"system": hmc.GlobalPoint.System, "name": point.Metric}
if len(hmc.GlobalPoint.Pool) > 0 {
tags["pool"] = point.Pool
}
Expand All @@ -100,7 +100,7 @@ func (hmc *HMC) AddPoint(point Point) {
tags["type"] = point.Type
}
if len(hmc.GlobalPoint.Device) > 0 {
tags["device"] = point.Device
tags["device"] = hmc.GlobalPoint.Device
}

if len(hmc.GlobalPoint.WWPN) > 0 {
Expand Down
10 changes: 6 additions & 4 deletions hmc/import.go
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/codegangsta/cli"
)

const timeFormat = "2006-01-02T15:04:05-0700"

//Import is the entry point for subcommand hmc
func Import(c *cli.Context) {
// parsing parameters
Expand All @@ -34,7 +36,7 @@ func Import(c *cli.Context) {
}

//set parameters common to all points in GlobalPoint
hmc.GlobalPoint.Server = system.Name
hmc.GlobalPoint.System = system.Name

fmt.Printf("MANAGED SYSTEM: %s\n", system.Name)
pcmlinks, getPCMErr := hmc.GetSystemPCMLinks(system.UUID)
Expand All @@ -57,12 +59,12 @@ func Import(c *cli.Context) {
}

for _, lparLink := range lparLinks.Partitions {
hmc.GlobalPoint = Point{Server: system.Name}
hmc.GlobalPoint = Point{System: system.Name}
lparData, getErr := hmc.GetPCMData(lparLink)
nmon2influxdblib.CheckError(getErr)
fmt.Printf("partition %s:", lparData.SystemUtil.UtilSamples[0].LparsUtil[0].Name)
for _, sample := range lparData.SystemUtil.UtilSamples {
timestamp, timeErr := time.Parse("2006-01-02T15:04:05+0000", sample.SampleInfo.TimeStamp)
timestamp, timeErr := time.Parse(timeFormat, sample.SampleInfo.TimeStamp)
nmon2influxdblib.CheckError(timeErr)
//Set timestamp common to all this points
hmc.GlobalPoint.Timestamp = timestamp
Expand Down Expand Up @@ -210,7 +212,7 @@ func Import(c *cli.Context) {
nmon2influxdblib.CheckError(err)
for _, sample := range data.SystemUtil.UtilSamples {

timestamp, timeErr := time.Parse("2006-01-02T15:04:05+0000", sample.SampleInfo.TimeStamp)
timestamp, timeErr := time.Parse(timeFormat, sample.SampleInfo.TimeStamp)
nmon2influxdblib.CheckError(timeErr)

//Set timestamp common to all this points
Expand Down

0 comments on commit 04b2d9f

Please sign in to comment.