Admin: Add message with failed / total nodes for nodes.json-task.

This commit is contained in:
baldo 2020-06-30 17:08:24 +02:00
parent fb87695b3e
commit b6a67d6e74
12 changed files with 120 additions and 20 deletions

View file

@ -1,8 +1,20 @@
import * as MonitoringService from "../services/monitoringService";
import {jobResultOkay, jobResultWarning} from "./scheduler";
export default {
name: 'NodeInformationRetrievalJob',
description: 'Fetches the nodes.json and calculates and stores the monitoring / online status for registered nodes.',
run: MonitoringService.retrieveNodeInformation,
async run () {
const result = await MonitoringService.retrieveNodeInformation();
if (result.failedParsingNodesCount > 0) {
return jobResultWarning(
`Warning: ${result.failedParsingNodesCount} of ${result.totalNodesCount} nodes could not be processed.`
);
} else {
return jobResultOkay(
`${result.totalNodesCount} nodes have been processed.`
);
}
},
};