2020-04-10 00:43:15 +02:00
|
|
|
import * as MonitoringService from "../services/monitoringService";
|
2020-06-30 17:08:24 +02:00
|
|
|
import {jobResultOkay, jobResultWarning} from "./scheduler";
|
2020-04-08 23:41:04 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'NodeInformationRetrievalJob',
|
|
|
|
description: 'Fetches the nodes.json and calculates and stores the monitoring / online status for registered nodes.',
|
|
|
|
|
2020-06-30 17:08:24 +02:00
|
|
|
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.`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
2020-04-08 23:41:04 +02:00
|
|
|
};
|