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