Add logic step to findThresholds

- fixes reference lines for subclusters w/o extra config
This commit is contained in:
Christoph Kluge 2023-06-20 13:16:00 +02:00
parent 5ba84efab6
commit b450cdd20f

View File

@ -270,6 +270,7 @@
} }
export function findThresholds(metricConfig, scope, subCluster) { export function findThresholds(metricConfig, scope, subCluster) {
// console.log('NAME ' + metricConfig.name + ' / SCOPE ' + scope + ' / SUBCLUSTER ' + subCluster.name)
if (!metricConfig || !scope || !subCluster) { if (!metricConfig || !scope || !subCluster) {
console.warn('Argument missing for findThresholds!') console.warn('Argument missing for findThresholds!')
return null return null
@ -280,8 +281,10 @@
// console.log('subClusterConfigs array empty, use metricConfig defaults') // console.log('subClusterConfigs array empty, use metricConfig defaults')
return { normal: metricConfig.normal, caution: metricConfig.caution, alert: metricConfig.alert } return { normal: metricConfig.normal, caution: metricConfig.caution, alert: metricConfig.alert }
} else if (metricConfig.subClusters && metricConfig.subClusters.length > 0) { } else if (metricConfig.subClusters && metricConfig.subClusters.length > 0) {
// console.log('subClusterConfigs found, find and use subCluster Settings') // console.log('subClusterConfigs found, use subCluster Settings if matching jobs subcluster:')
return metricConfig.subClusters.find(sc => sc.name == subCluster.name) let forSubCluster = metricConfig.subClusters.find(sc => sc.name == subCluster.name)
if (forSubCluster && forSubCluster.normal && forSubCluster.caution && forSubCluster.alert) return forSubCluster
else return { normal: metricConfig.normal, caution: metricConfig.caution, alert: metricConfig.alert }
} else { } else {
console.warn('metricConfig.subClusters not found!') console.warn('metricConfig.subClusters not found!')
return null return null