mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2026-07-11 04:00:38 +02:00
make fmt
This commit is contained in:
@@ -21,37 +21,37 @@ import (
|
|||||||
|
|
||||||
// Map of all available metric collectors
|
// Map of all available metric collectors
|
||||||
var AvailableCollectors = map[string]MetricCollector{
|
var AvailableCollectors = map[string]MetricCollector{
|
||||||
"likwid": new(LikwidCollector),
|
"likwid": new(LikwidCollector),
|
||||||
"loadavg": new(LoadavgCollector),
|
"loadavg": new(LoadavgCollector),
|
||||||
"memstat": new(MemstatCollector),
|
"memstat": new(MemstatCollector),
|
||||||
"netstat": new(NetstatCollector),
|
"netstat": new(NetstatCollector),
|
||||||
"ibstat": new(InfinibandCollector),
|
"ibstat": new(InfinibandCollector),
|
||||||
"lustrestat": new(LustreCollector),
|
"lustrestat": new(LustreCollector),
|
||||||
"cpustat": new(CpustatCollector),
|
"cpustat": new(CpustatCollector),
|
||||||
"topprocs": new(TopProcsCollector),
|
"topprocs": new(TopProcsCollector),
|
||||||
"nvidia": new(NvidiaCollector),
|
"nvidia": new(NvidiaCollector),
|
||||||
"customcmd": new(CustomCmdCollector),
|
"customcmd": new(CustomCmdCollector),
|
||||||
"iostat": new(IOstatCollector),
|
"iostat": new(IOstatCollector),
|
||||||
"diskstat": new(DiskstatCollector),
|
"diskstat": new(DiskstatCollector),
|
||||||
"tempstat": new(TempCollector),
|
"tempstat": new(TempCollector),
|
||||||
"ipmistat": new(IpmiCollector),
|
"ipmistat": new(IpmiCollector),
|
||||||
"gpfs": new(GpfsCollector),
|
"gpfs": new(GpfsCollector),
|
||||||
"cpufreq": new(CPUFreqCollector),
|
"cpufreq": new(CPUFreqCollector),
|
||||||
"cpufreq_cpuinfo": new(CPUFreqCpuInfoCollector),
|
"cpufreq_cpuinfo": new(CPUFreqCpuInfoCollector),
|
||||||
"nfs3stat": new(Nfs3Collector),
|
"nfs3stat": new(Nfs3Collector),
|
||||||
"nfs4stat": new(Nfs4Collector),
|
"nfs4stat": new(Nfs4Collector),
|
||||||
"numastats": new(NUMAStatsCollector),
|
"numastats": new(NUMAStatsCollector),
|
||||||
"beegfs_meta": new(BeegfsMetaCollector),
|
"beegfs_meta": new(BeegfsMetaCollector),
|
||||||
"beegfs_storage": new(BeegfsStorageCollector),
|
"beegfs_storage": new(BeegfsStorageCollector),
|
||||||
"rapl": new(RAPLCollector),
|
"rapl": new(RAPLCollector),
|
||||||
"rocm_smi": new(RocmSmiCollector),
|
"rocm_smi": new(RocmSmiCollector),
|
||||||
"self": new(SelfCollector),
|
"self": new(SelfCollector),
|
||||||
"schedstat": new(SchedstatCollector),
|
"schedstat": new(SchedstatCollector),
|
||||||
"nfsiostat": new(NfsIOStatCollector),
|
"nfsiostat": new(NfsIOStatCollector),
|
||||||
"slurm_cgroup": new(SlurmCgroupCollector),
|
"slurm_cgroup": new(SlurmCgroupCollector),
|
||||||
"smartmon": new(SmartMonCollector),
|
"smartmon": new(SmartMonCollector),
|
||||||
"lenovo_dense_power": new(LenovoDensePowerCollector),
|
"lenovo_dense_power": new(LenovoDensePowerCollector),
|
||||||
"megware_eureka": new(MegwareEurekaCollector),
|
"megware_eureka": new(MegwareEurekaCollector),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Metric collector manager data structure
|
// Metric collector manager data structure
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ type IpmiCollector struct {
|
|||||||
metricCollector
|
metricCollector
|
||||||
|
|
||||||
config struct {
|
config struct {
|
||||||
IpmitoolPath string `json:"ipmitool_path"`
|
IpmitoolPath string `json:"ipmitool_path"`
|
||||||
IpmisensorsPath string `json:"ipmisensors_path"`
|
IpmisensorsPath string `json:"ipmisensors_path"`
|
||||||
Sudo bool `json:"use_sudo"`
|
Sudo bool `json:"use_sudo"`
|
||||||
IncludeMetrics []string `json:"include_metrics"`
|
IncludeMetrics []string `json:"include_metrics"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ipmitool string
|
ipmitool string
|
||||||
ipmisensors string
|
ipmisensors string
|
||||||
includeMetrics map[string]bool
|
includeMetrics map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ func (m *IpmiCollector) readIpmiTool(output chan lp.CCMessage) error {
|
|||||||
name := strings.ToLower(strings.ReplaceAll(strings.TrimSpace(lv[0]), " ", "_"))
|
name := strings.ToLower(strings.ReplaceAll(strings.TrimSpace(lv[0]), " ", "_"))
|
||||||
|
|
||||||
if len(m.includeMetrics) > 0 && !m.includeMetrics[name] {
|
if len(m.includeMetrics) > 0 && !m.includeMetrics[name] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
unit := strings.TrimSpace(lv[2])
|
unit := strings.TrimSpace(lv[2])
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ func (m *LenovoDensePowerCollector) Read(interval time.Duration, output chan lp.
|
|||||||
}
|
}
|
||||||
energyTimeDiff := energyTime.Sub(m.energyTimeLast)
|
energyTimeDiff := energyTime.Sub(m.energyTimeLast)
|
||||||
if energyTime.Before(m.energyTimeLast) {
|
if energyTime.Before(m.energyTimeLast) {
|
||||||
energyTimeDiff = energyTimeDiff + 0x100000000 * time.Second
|
energyTimeDiff = energyTimeDiff + 0x100000000*time.Second
|
||||||
}
|
}
|
||||||
powerVal = float64(energyValDiff) / energyTimeDiff.Seconds()
|
powerVal = float64(energyValDiff) / energyTimeDiff.Seconds()
|
||||||
|
|
||||||
|
|||||||
+32
-32
@@ -21,25 +21,25 @@ import (
|
|||||||
// MPS refers to Monolithic Power Systems, from which the MP5922 is used
|
// MPS refers to Monolithic Power Systems, from which the MP5922 is used
|
||||||
// to measure telemetry on the Eureka platform.
|
// to measure telemetry on the Eureka platform.
|
||||||
type mpsData struct {
|
type mpsData struct {
|
||||||
cnt int64 `json:"Cnt"` // No idea what this is, ignore
|
cnt int64 `json:"Cnt"` // No idea what this is, ignore
|
||||||
energy float64 `json:"Energy"`
|
energy float64 `json:"Energy"`
|
||||||
vin float64 `json:"Vin"`
|
vin float64 `json:"Vin"`
|
||||||
iin float64 `json:"Iin"`
|
iin float64 `json:"Iin"`
|
||||||
pin float64 `json:"Pin"`
|
pin float64 `json:"Pin"`
|
||||||
pinAvg float64 `json:"PinAvg"`
|
pinAvg float64 `json:"PinAvg"`
|
||||||
vout float64 `json:"Vout"`
|
vout float64 `json:"Vout"`
|
||||||
iout float64 `json:"Iout"`
|
iout float64 `json:"Iout"`
|
||||||
pout float64 `json:"Pout"`
|
pout float64 `json:"Pout"`
|
||||||
standbyVout float64 `json:"StandbyVout"`
|
standbyVout float64 `json:"StandbyVout"`
|
||||||
standbyIout float64 `json:"StandbyIout"`
|
standbyIout float64 `json:"StandbyIout"`
|
||||||
standbyPout float64 `json:"StandbyPout"`
|
standbyPout float64 `json:"StandbyPout"`
|
||||||
tempBusbar float64 `json:"TempBusbar"`
|
tempBusbar float64 `json:"TempBusbar"`
|
||||||
tempSsd float64 `json:"TempSsd"`
|
tempSsd float64 `json:"TempSsd"`
|
||||||
tempMps float64 `json:"TempMps"`
|
tempMps float64 `json:"TempMps"`
|
||||||
// No idea what the ones below mean exactl. Ignore them for now.
|
// No idea what the ones below mean exactl. Ignore them for now.
|
||||||
energyTime int64 `json:"EnergyTime"`
|
energyTime int64 `json:"EnergyTime"`
|
||||||
energyAccumulator int64 `json:"EnergyAccumulator"`
|
energyAccumulator int64 `json:"EnergyAccumulator"`
|
||||||
energyRolloverCnt int64 `json:"EnergyRolloverCnt"`
|
energyRolloverCnt int64 `json:"EnergyRolloverCnt"`
|
||||||
energySampleCntU24 int64 `json:"EnergySampleCntU24"`
|
energySampleCntU24 int64 `json:"EnergySampleCntU24"`
|
||||||
|
|
||||||
timestamp time.Time
|
timestamp time.Time
|
||||||
@@ -50,7 +50,7 @@ type MegwareEurekaCollector struct {
|
|||||||
|
|
||||||
config struct {
|
config struct {
|
||||||
U20Path string `json:"u20_path"`
|
U20Path string `json:"u20_path"`
|
||||||
Sudo bool `json:"use_sudo"`
|
Sudo bool `json:"use_sudo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
u20path string
|
u20path string
|
||||||
@@ -157,24 +157,24 @@ func (m *MegwareEurekaCollector) Read(interval time.Duration, output chan lp.CCM
|
|||||||
}
|
}
|
||||||
|
|
||||||
metricNamePrefix := "eureka_"
|
metricNamePrefix := "eureka_"
|
||||||
metricMap := map[string]struct{
|
metricMap := map[string]struct {
|
||||||
value any
|
value any
|
||||||
unit string
|
unit string
|
||||||
}{
|
}{
|
||||||
"power": { value: powerVal, unit: "Watts" },
|
"power": {value: powerVal, unit: "Watts"},
|
||||||
"vin": { value: data.vin, unit: "Volts" },
|
"vin": {value: data.vin, unit: "Volts"},
|
||||||
"iin": { value: data.iin, unit: "Amperes" },
|
"iin": {value: data.iin, unit: "Amperes"},
|
||||||
"pin": { value: data.pin, unit: "Watts" },
|
"pin": {value: data.pin, unit: "Watts"},
|
||||||
"pin_avg": { value: data.pinAvg, unit: "Watts" },
|
"pin_avg": {value: data.pinAvg, unit: "Watts"},
|
||||||
"vout": { value: data.vout, unit: "Volts" },
|
"vout": {value: data.vout, unit: "Volts"},
|
||||||
"iout": { value: data.iout, unit: "Amperes" },
|
"iout": {value: data.iout, unit: "Amperes"},
|
||||||
"pout": { value: data.pout, unit: "Watts" },
|
"pout": {value: data.pout, unit: "Watts"},
|
||||||
"standby_vout": { value: data.standbyVout, unit: "Volts" },
|
"standby_vout": {value: data.standbyVout, unit: "Volts"},
|
||||||
"standby_iout": { value: data.standbyIout, unit: "Amperes" },
|
"standby_iout": {value: data.standbyIout, unit: "Amperes"},
|
||||||
"standby_pout": { value: data.standbyPout, unit: "Watts" },
|
"standby_pout": {value: data.standbyPout, unit: "Watts"},
|
||||||
"temp_busbar": { value: data.tempBusbar, unit: "degC" },
|
"temp_busbar": {value: data.tempBusbar, unit: "degC"},
|
||||||
"temp_ssd": { value: data.tempSsd, unit: "degC" },
|
"temp_ssd": {value: data.tempSsd, unit: "degC"},
|
||||||
"temp_mps": { value: data.tempMps, unit: "degC" },
|
"temp_mps": {value: data.tempMps, unit: "degC"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for metricName, metricData := range metricMap {
|
for metricName, metricData := range metricMap {
|
||||||
|
|||||||
Reference in New Issue
Block a user