mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Adapt new rawConfig unmarshal for influxdbclient
This commit is contained in:
parent
cad68362fe
commit
ed18df2ecf
@ -19,7 +19,9 @@ import (
|
|||||||
type InfluxDBv2DataRepositoryConfig struct {
|
type InfluxDBv2DataRepositoryConfig struct {
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
// TODO: bucket, ...
|
Bucket string `json:"bucket"`
|
||||||
|
Org string `json:"org"`
|
||||||
|
SkipTls bool `json:"skiptls"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type InfluxDBv2DataRepository struct {
|
type InfluxDBv2DataRepository struct {
|
||||||
@ -34,8 +36,9 @@ func (idb *InfluxDBv2DataRepository) Init(rawConfig json.RawMessage) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
idb.client = influxdb2.NewClientWithOptions(config.Url, config.Token, influxdb2.DefaultOptions().SetTLSConfig(&tls.Config {InsecureSkipVerify: true,} ))
|
idb.client = influxdb2.NewClientWithOptions(config.Url, config.Token, influxdb2.DefaultOptions().SetTLSConfig(&tls.Config {InsecureSkipVerify: config.SkipTls,} ))
|
||||||
idb.queryClient = idb.client.QueryAPI("ClusterCockpit") // TODO: Make configurable
|
idb.queryClient = idb.client.QueryAPI(config.Org)
|
||||||
|
idb.bucket = config.Bucket
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -52,10 +55,8 @@ func (idb *InfluxDBv2DataRepository) LoadData(job *schema.Job, metrics []string,
|
|||||||
|
|
||||||
// Set Bucket & Prepare Measurement
|
// Set Bucket & Prepare Measurement
|
||||||
if (job.Cluster == "woody" || job.Cluster == "emmy" || job.Cluster == "meggie") {
|
if (job.Cluster == "woody" || job.Cluster == "emmy" || job.Cluster == "meggie") {
|
||||||
idb.bucket = "ClusterCockpit/data" // Temporary: Old Line Protocol for old cluster, TODO: Make configurable
|
|
||||||
idb.measurement = "data" // Temporary: Old Line Protocol for old cluster
|
idb.measurement = "data" // Temporary: Old Line Protocol for old cluster
|
||||||
} else {
|
} else {
|
||||||
// idb.bucket = job.Cluster // New: Bucket per Cluster
|
|
||||||
// idb.measurement = nil // New: Measurement = metric; Placeholder at this stage
|
// idb.measurement = nil // New: Measurement = metric; Placeholder at this stage
|
||||||
log.Println(fmt.Sprintf("New line protocol unimplemented for influx: %s", job.Cluster))
|
log.Println(fmt.Sprintf("New line protocol unimplemented for influx: %s", job.Cluster))
|
||||||
return nil, errors.New("new line protocol unimplemented")
|
return nil, errors.New("new line protocol unimplemented")
|
||||||
|
Loading…
Reference in New Issue
Block a user