mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-07-21 04:11:41 +02:00
Compare commits
3 Commits
check_file
...
likwidMetr
Author | SHA1 | Date | |
---|---|---|---|
|
8daa3701b9 | ||
|
c1395ec2ed | ||
|
16faa70867 |
20
.github/workflows/Release.yml
vendored
20
.github/workflows/Release.yml
vendored
@@ -73,21 +73,21 @@ jobs:
|
|||||||
NEW_SRPM=${OLD_SRPM/el8/alma8}
|
NEW_SRPM=${OLD_SRPM/el8/alma8}
|
||||||
mv "${OLD_RPM}" "${NEW_RPM}"
|
mv "${OLD_RPM}" "${NEW_RPM}"
|
||||||
mv "${OLD_SRPM}" "${NEW_SRPM}"
|
mv "${OLD_SRPM}" "${NEW_SRPM}"
|
||||||
echo "SRPM=${NEW_SRPM}" >> $GITHUB_OUTPUT
|
echo "EL8_SRPM=${NEW_SRPM}" >> $GITHUB_OUTPUT
|
||||||
echo "RPM=${NEW_RPM}" >> $GITHUB_OUTPUT
|
echo "EL8_RPM=${NEW_RPM}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# See: https://github.com/actions/upload-artifact
|
# See: https://github.com/actions/upload-artifact
|
||||||
- name: Save RPM as artifact
|
- name: Save RPM as artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: cc-metric-collector RPM for AlmaLinux 8
|
name: cc-metric-collector RPM for AlmaLinux 8
|
||||||
path: ${{ steps.rpmrename.outputs.RPM }}
|
path: ${{ steps.rpmrename.outputs.EL8_RPM }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
- name: Save SRPM as artifact
|
- name: Save SRPM as artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: cc-metric-collector SRPM for AlmaLinux 8
|
name: cc-metric-collector SRPM for AlmaLinux 8
|
||||||
path: ${{ steps.rpmrename.outputs.SRPM }}
|
path: ${{ steps.rpmrename.outputs.EL8_SRPM }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -152,21 +152,21 @@ jobs:
|
|||||||
NEW_SRPM=${OLD_SRPM/el9/alma9}
|
NEW_SRPM=${OLD_SRPM/el9/alma9}
|
||||||
mv "${OLD_RPM}" "${NEW_RPM}"
|
mv "${OLD_RPM}" "${NEW_RPM}"
|
||||||
mv "${OLD_SRPM}" "${NEW_SRPM}"
|
mv "${OLD_SRPM}" "${NEW_SRPM}"
|
||||||
echo "SRPM=${NEW_SRPM}" >> $GITHUB_OUTPUT
|
echo "EL9_SRPM=${NEW_SRPM}" >> $GITHUB_OUTPUT
|
||||||
echo "RPM=${NEW_RPM}" >> $GITHUB_OUTPUT
|
echo "EL9_RPM=${NEW_RPM}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# See: https://github.com/actions/upload-artifact
|
# See: https://github.com/actions/upload-artifact
|
||||||
- name: Save RPM as artifact
|
- name: Save RPM as artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: cc-metric-collector RPM for AlmaLinux 9
|
name: cc-metric-collector RPM for AlmaLinux 9
|
||||||
path: ${{ steps.rpmrename.outputs.RPM }}
|
path: ${{ steps.rpmrename.outputs.EL9_RPM }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
- name: Save SRPM as artifact
|
- name: Save SRPM as artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: cc-metric-collector SRPM for AlmaLinux 9
|
name: cc-metric-collector SRPM for AlmaLinux 9
|
||||||
path: ${{ steps.rpmrename.outputs.SRPM }}
|
path: ${{ steps.rpmrename.outputs.EL9_SRPM }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -235,10 +235,6 @@ jobs:
|
|||||||
# See: https://catalog.redhat.com/software/containers/ubi8/ubi/5c359854d70cc534b3a3784e?container-tabs=gti
|
# See: https://catalog.redhat.com/software/containers/ubi8/ubi/5c359854d70cc534b3a3784e?container-tabs=gti
|
||||||
container: redhat/ubi9
|
container: redhat/ubi9
|
||||||
# The job outputs link to the outputs of the 'rpmbuild' step
|
# The job outputs link to the outputs of the 'rpmbuild' step
|
||||||
# The job outputs link to the outputs of the 'rpmbuild' step
|
|
||||||
outputs:
|
|
||||||
rpm : ${{steps.rpmbuild.outputs.RPM}}
|
|
||||||
srpm : ${{steps.rpmbuild.outputs.SRPM}}
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# Use dnf to install development packages
|
# Use dnf to install development packages
|
||||||
|
17
.github/workflows/runonce.yml
vendored
17
.github/workflows/runonce.yml
vendored
@@ -33,11 +33,6 @@ jobs:
|
|||||||
- name: Build MetricCollector
|
- name: Build MetricCollector
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
- name: Set config file permissions
|
|
||||||
run: |
|
|
||||||
chown $USER .github/ci*.json
|
|
||||||
chmod 0600 .github/ci*.json
|
|
||||||
|
|
||||||
- name: Run MetricCollector once
|
- name: Run MetricCollector once
|
||||||
run: ./cc-metric-collector --once --config .github/ci-config.json
|
run: ./cc-metric-collector --once --config .github/ci-config.json
|
||||||
|
|
||||||
@@ -64,11 +59,6 @@ jobs:
|
|||||||
- name: Build MetricCollector
|
- name: Build MetricCollector
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
- name: Set config file permissions
|
|
||||||
run: |
|
|
||||||
chown $USER .github/ci*.json
|
|
||||||
chmod 0600 .github/ci*.json
|
|
||||||
|
|
||||||
- name: Run MetricCollector once
|
- name: Run MetricCollector once
|
||||||
run: ./cc-metric-collector --once --config .github/ci-config.json
|
run: ./cc-metric-collector --once --config .github/ci-config.json
|
||||||
|
|
||||||
@@ -95,11 +85,6 @@ jobs:
|
|||||||
- name: Build MetricCollector
|
- name: Build MetricCollector
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
- name: Set config file permissions
|
|
||||||
run: |
|
|
||||||
chown $USER .github/ci*.json
|
|
||||||
chmod 0600 .github/ci*.json
|
|
||||||
|
|
||||||
- name: Run MetricCollector once
|
- name: Run MetricCollector once
|
||||||
run: ./cc-metric-collector --once --config .github/ci-config.json
|
run: ./cc-metric-collector --once --config .github/ci-config.json
|
||||||
|
|
||||||
@@ -346,4 +331,4 @@ jobs:
|
|||||||
id: dpkg-build
|
id: dpkg-build
|
||||||
run: |
|
run: |
|
||||||
export PATH=/usr/local/go/bin:/usr/local/go/pkg/tool/linux_amd64:$PATH
|
export PATH=/usr/local/go/bin:/usr/local/go/pkg/tool/linux_amd64:$PATH
|
||||||
make DEB
|
make DEB
|
@@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -16,9 +15,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
lp "github.com/ClusterCockpit/cc-energy-manager/pkg/cc-message"
|
|
||||||
mr "github.com/ClusterCockpit/cc-metric-collector/internal/metricRouter"
|
mr "github.com/ClusterCockpit/cc-metric-collector/internal/metricRouter"
|
||||||
cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger"
|
cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger"
|
||||||
|
lp "github.com/ClusterCockpit/cc-energy-manager/pkg/cc-message"
|
||||||
mct "github.com/ClusterCockpit/cc-metric-collector/pkg/multiChanTicker"
|
mct "github.com/ClusterCockpit/cc-metric-collector/pkg/multiChanTicker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -43,27 +42,6 @@ func LoadCentralConfiguration(file string, config *CentralConfigFile) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConfigFileCheck(file string) error {
|
|
||||||
|
|
||||||
info, err := os.Stat(file)
|
|
||||||
if err != nil {
|
|
||||||
cclog.Error("Cannot access file", file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
uid := info.Sys().(*syscall.Stat_t).Uid
|
|
||||||
perm := info.Mode().Perm()
|
|
||||||
if uid != uint32(os.Getuid()) {
|
|
||||||
err = fmt.Errorf("file %s has a different owner", file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if perm != 0600 {
|
|
||||||
err = fmt.Errorf("file %s has a invalid permissions", file)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeConfig struct {
|
type RuntimeConfig struct {
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
@@ -189,12 +167,6 @@ func mainFunc() int {
|
|||||||
CliArgs: ReadCli(),
|
CliArgs: ReadCli(),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ConfigFileCheck(rcfg.CliArgs["configfile"])
|
|
||||||
if err != nil {
|
|
||||||
cclog.Error(err.Error())
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load and check configuration
|
// Load and check configuration
|
||||||
err = LoadCentralConfiguration(rcfg.CliArgs["configfile"], &rcfg.ConfigFile)
|
err = LoadCentralConfiguration(rcfg.CliArgs["configfile"], &rcfg.ConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -236,31 +208,16 @@ func mainFunc() int {
|
|||||||
cclog.Error("Metric router configuration file must be set")
|
cclog.Error("Metric router configuration file must be set")
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
err = ConfigFileCheck(rcfg.ConfigFile.RouterConfigFile)
|
|
||||||
if err != nil {
|
|
||||||
cclog.Error(err.Error())
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(rcfg.ConfigFile.SinkConfigFile) == 0 {
|
if len(rcfg.ConfigFile.SinkConfigFile) == 0 {
|
||||||
cclog.Error("Sink configuration file must be set")
|
cclog.Error("Sink configuration file must be set")
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
err = ConfigFileCheck(rcfg.ConfigFile.SinkConfigFile)
|
|
||||||
if err != nil {
|
|
||||||
cclog.Error(err.Error())
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(rcfg.ConfigFile.CollectorConfigFile) == 0 {
|
if len(rcfg.ConfigFile.CollectorConfigFile) == 0 {
|
||||||
cclog.Error("Metric collector configuration file must be set")
|
cclog.Error("Metric collector configuration file must be set")
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
err = ConfigFileCheck(rcfg.ConfigFile.CollectorConfigFile)
|
|
||||||
if err != nil {
|
|
||||||
cclog.Error(err.Error())
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set log file
|
// Set log file
|
||||||
if logfile := rcfg.CliArgs["logfile"]; logfile != "stderr" {
|
if logfile := rcfg.CliArgs["logfile"]; logfile != "stderr" {
|
||||||
@@ -303,11 +260,6 @@ func mainFunc() int {
|
|||||||
|
|
||||||
// Create new receive manager
|
// Create new receive manager
|
||||||
if len(rcfg.ConfigFile.ReceiverConfigFile) > 0 {
|
if len(rcfg.ConfigFile.ReceiverConfigFile) > 0 {
|
||||||
err = ConfigFileCheck(rcfg.ConfigFile.ReceiverConfigFile)
|
|
||||||
if err != nil {
|
|
||||||
cclog.Error(err.Error())
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
rcfg.ReceiveManager, err = receivers.New(&rcfg.Sync, rcfg.ConfigFile.ReceiverConfigFile)
|
rcfg.ReceiveManager, err = receivers.New(&rcfg.Sync, rcfg.ConfigFile.ReceiverConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cclog.Error(err.Error())
|
cclog.Error(err.Error())
|
||||||
|
@@ -33,8 +33,10 @@ In contrast to the configuration files for sinks and receivers, the collectors c
|
|||||||
* [`topprocs`](./topprocsMetric.md)
|
* [`topprocs`](./topprocsMetric.md)
|
||||||
* [`nfs3stat`](./nfs3Metric.md)
|
* [`nfs3stat`](./nfs3Metric.md)
|
||||||
* [`nfs4stat`](./nfs4Metric.md)
|
* [`nfs4stat`](./nfs4Metric.md)
|
||||||
|
* [`nfsiostat`](./nfsiostatMetric.md)
|
||||||
* [`cpufreq`](./cpufreqMetric.md)
|
* [`cpufreq`](./cpufreqMetric.md)
|
||||||
* [`cpufreq_cpuinfo`](./cpufreqCpuinfoMetric.md)
|
* [`cpufreq_cpuinfo`](./cpufreqCpuinfoMetric.md)
|
||||||
|
* [`schedstat`](./schedstatMetric.md)
|
||||||
* [`numastats`](./numastatsMetric.md)
|
* [`numastats`](./numastatsMetric.md)
|
||||||
* [`gpfs`](./gpfsMetric.md)
|
* [`gpfs`](./gpfsMetric.md)
|
||||||
* [`beegfs_meta`](./beegfsmetaMetric.md)
|
* [`beegfs_meta`](./beegfsmetaMetric.md)
|
||||||
|
@@ -190,12 +190,8 @@ func getBaseFreq() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if math.IsNaN(freq) {
|
if math.IsNaN(freq) {
|
||||||
C.power_init(0)
|
C.timer_init()
|
||||||
info := C.get_powerInfo()
|
freq = float64(C.timer_getCycleClock()) / 1e3
|
||||||
if float64(info.baseFrequency) != 0 {
|
|
||||||
freq = float64(info.baseFrequency)
|
|
||||||
}
|
|
||||||
C.power_finalize()
|
|
||||||
}
|
}
|
||||||
return freq * 1e3
|
return freq * 1e3
|
||||||
}
|
}
|
||||||
|
@@ -91,17 +91,18 @@ func (r *NatsReceiver) _NatsReceive(m *nats.Msg) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
y, _ := lp.NewMessage(
|
y, err := lp.NewMessage(
|
||||||
string(measurement),
|
string(measurement),
|
||||||
tags,
|
tags,
|
||||||
nil,
|
nil,
|
||||||
fields,
|
fields,
|
||||||
t,
|
t,
|
||||||
)
|
)
|
||||||
|
if err == nil {
|
||||||
m, err := r.mp.ProcessMessage(y)
|
m, err := r.mp.ProcessMessage(y)
|
||||||
if err == nil && m != nil {
|
if err == nil && m != nil && r.sink != nil {
|
||||||
r.sink <- m
|
r.sink <- m
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user