mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-04-08 22:45:55 +02:00
Set default cmd to 'mmpmon'
This commit is contained in:
parent
7f62975a68
commit
5b951fcfe8
@ -17,6 +17,8 @@ import (
|
|||||||
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DEFAULT_GPFS_CMD = "mmpmon"
|
||||||
|
|
||||||
type GpfsCollector struct {
|
type GpfsCollector struct {
|
||||||
metricCollector
|
metricCollector
|
||||||
tags map[string]string
|
tags map[string]string
|
||||||
@ -38,7 +40,7 @@ func (m *GpfsCollector) Init(config json.RawMessage) error {
|
|||||||
m.setup()
|
m.setup()
|
||||||
|
|
||||||
// Set default mmpmon binary
|
// Set default mmpmon binary
|
||||||
m.config.Mmpmon = "/usr/lpp/mmfs/bin/mmpmon"
|
m.config.Mmpmon = DEFAULT_GPFS_CMD
|
||||||
|
|
||||||
// Read JSON configuration
|
// Read JSON configuration
|
||||||
if len(config) > 0 {
|
if len(config) > 0 {
|
||||||
@ -64,7 +66,7 @@ func (m *GpfsCollector) Init(config json.RawMessage) error {
|
|||||||
// GPFS / IBM Spectrum Scale file system statistics can only be queried by user root
|
// GPFS / IBM Spectrum Scale file system statistics can only be queried by user root
|
||||||
user, err := user.Current()
|
user, err := user.Current()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to get current user: %v", err)
|
return fmt.Errorf("failed to get current user: %v", err)
|
||||||
}
|
}
|
||||||
if user.Uid != "0" {
|
if user.Uid != "0" {
|
||||||
return fmt.Errorf("GPFS file system statistics can only be queried by user root")
|
return fmt.Errorf("GPFS file system statistics can only be queried by user root")
|
||||||
@ -73,7 +75,7 @@ func (m *GpfsCollector) Init(config json.RawMessage) error {
|
|||||||
// Check if mmpmon is in executable search path
|
// Check if mmpmon is in executable search path
|
||||||
_, err = exec.LookPath(m.config.Mmpmon)
|
_, err = exec.LookPath(m.config.Mmpmon)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to find mmpmon binary '%s': %v", m.config.Mmpmon, err)
|
return fmt.Errorf("failed to find mmpmon binary '%s': %v", m.config.Mmpmon, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
m.init = true
|
m.init = true
|
||||||
|
@ -16,7 +16,7 @@ The reported filesystems can be filtered with the `exclude_filesystem` option
|
|||||||
in the configuration.
|
in the configuration.
|
||||||
|
|
||||||
The path to the `mmpmon` command can be configured with the `mmpmon_path` option
|
The path to the `mmpmon` command can be configured with the `mmpmon_path` option
|
||||||
in the configuration.
|
in the configuration. If nothing is set, the collector searches in `$PATH` for `mmpmon`.
|
||||||
|
|
||||||
Metrics:
|
Metrics:
|
||||||
* `bytes_read`
|
* `bytes_read`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user