Skip to content

Commit 72fdaae

Browse files
committed
add check for docker image
1 parent 6664750 commit 72fdaae

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

src/server/extension/monitoring-endpoint.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ process.stdin.on('end', () => {
375375
}
376376

377377
function getOpenSearchWatermarkConfig() {
378-
return new Promise((resolve, reject) => {
378+
return new Promise((resolve, reject) => {
379379
var url = 'http://opensearch:9200/_cluster/settings?include_defaults=true&filter_path=defaults.cluster.routing.allocation.disk.watermark';
380380
fetch(url, {
381381
headers: {
@@ -520,31 +520,55 @@ process.stdin.on('end', () => {
520520
})
521521
}
522522

523+
function getSettingsFromAPI() {
524+
return new Promise((resolve, reject) => {
525+
var url = 'http://fylr.localhost:8081/api/v1/settings?access_token=' + access_token
526+
fetch(url, {
527+
headers: {
528+
'Accept': 'application/json'
529+
},
530+
})
531+
.then(response => {
532+
if (response.ok) {
533+
resolve(response.json());
534+
} else {
535+
throwError("Fehler bei der Anfrage an /api/v1/settings ", '');
536+
}
537+
})
538+
.catch(error => {
539+
console.log(error);
540+
throwError("Fehler bei der Anfrage an /api/v1/settings ", '');
541+
});
542+
});
543+
}
544+
523545
function getUnusedPlugins(installedPlugins, currentSchema, baseConfig) {
524546
const unusedPlugins = [];
525547

526548
// get names of installed plugins and add their dependencies to a map + put disabled plugins into unusedPlugins
527549
installedPlugins.Plugins.forEach(plugin => {
528550
const pluginName = plugin.Name
529551

530-
if(pluginName.startsWith('custom-data-type')){
552+
if (pluginName.startsWith('custom-data-type')) {
531553
const isUsed = currentSchema.tables.some((table) => {
532554
return table.columns.some((colum) => {
533555
if (colum.kind !== 'column' || !colum.type.startsWith('custom:')) return false;
534556

535557
const columnPluginName = colum.type.split('.')[1]
536-
return columnPluginName === pluginName
558+
return columnPluginName === pluginName
537559
})
538560
})
539-
if(!isUsed){
561+
if (!isUsed) {
540562
unusedPlugins.push(pluginName)
541563
}
542-
564+
543565
} else if (pluginName === 'default-values-from-pool') {
544566
if (!isDefaultValuesFromPoolUsed(baseConfig)) {
545567
unusedPlugins.push(pluginName)
546568
}
547569
}
570+
// editor-field-visibility und find-duplicate-field-values und custom-mask-splitter-detail-linked können noch geprüft werden
571+
// Das sind Plugins, die in den Masken vorhanden sein sollten, wenn genutzt.
548572
});
549573

550574
return unusedPlugins
@@ -576,7 +600,8 @@ process.stdin.on('end', () => {
576600
poolStatsResult,
577601
diskUsageResult,
578602
objectTypeStatsResult,
579-
sqlBackupsResult
603+
sqlBackupsResult,
604+
settingsResult
580605
] = await Promise.all([
581606
getStatsInfoFromAPI(),
582607
getSessionInfoFromAPI(),
@@ -588,7 +613,8 @@ process.stdin.on('end', () => {
588613
getPoolStatsFromAPI(),
589614
getDiskUsageFromAPI(),
590615
getObjectTypeStatsFromAPI(),
591-
checkSqlBackups()
616+
checkSqlBackups(),
617+
getSettingsFromAPI()
592618
]);
593619

594620
let statusMessages = [];
@@ -1162,7 +1188,7 @@ process.stdin.on('end', () => {
11621188
const validStatus = ['green', 'yellow'];
11631189
let openSearchClusterHealth = await getOpenSearchClusterHealth();
11641190
openSearchClusterHealth = openSearchClusterHealth.status;
1165-
1191+
11661192
if (!validStatus.includes(openSearchClusterHealth)) {
11671193
increaseStatus('error');
11681194
statusMessages.push('Opensearch Cluster Health: ' + openSearchClusterHealth);
@@ -1186,6 +1212,9 @@ process.stdin.on('end', () => {
11861212
result.opensearch.status.adresses = configInspectResult.Config.Fylr.Elastic.Addresses;
11871213
}
11881214

1215+
// check if the used docker image is latest or main
1216+
result.dockerImage = settingsResult.version_release_date === '<unreleased>' ? 'latest' : 'main'
1217+
11891218
if (statusMessages.length > 0) {
11901219
result.statusmessage = 'Problems: ' + statusMessages.join(', ');
11911220
}

0 commit comments

Comments
 (0)