Job to automatically delete nodes after 100 days.
This commit is contained in:
parent
cacc3faeb5
commit
6aac4af80f
4 changed files with 74 additions and 34 deletions
|
@ -1,17 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffng').factory('NodeInformationCleanupJob', function (MonitoringService, Logger) {
|
||||
return {
|
||||
description: 'Cleanup monitoring status entries for nodes no longer having monitoring enabled.',
|
||||
|
||||
run: function (callback) {
|
||||
MonitoringService.cleanupNodeInformation(function (err) {
|
||||
if (err) {
|
||||
Logger.tag('monitoring', 'information-cleanup').error('Error cleaning up node data:', err);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
17
server/jobs/offlineNodesDeletionJob.js
Normal file
17
server/jobs/offlineNodesDeletionJob.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffng').factory('OfflineNodesDeletionJob', function (MonitoringService, Logger) {
|
||||
return {
|
||||
description: 'Delete nodes that are offline for more than 100 days.',
|
||||
|
||||
run: function (callback) {
|
||||
MonitoringService.deleteOfflineNodes(function (err) {
|
||||
if (err) {
|
||||
Logger.tag('nodes', 'delete-offline').error('Error deleting offline nodes:', err);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
|
@ -76,7 +76,7 @@ angular.module('ffffng').factory('Scheduler', function ($injector, Logger, confi
|
|||
if (config.client.monitoring.enabled) {
|
||||
schedule('30 */15 * * * *', 'NodeInformationRetrievalJob');
|
||||
schedule('45 */5 * * * *', 'MonitoringMailsSendingJob');
|
||||
schedule('0 0 3 * * *', 'NodeInformationCleanupJob'); // every night at 3:00
|
||||
schedule('0 0 3 * * *', 'OfflineNodesDeletionJob'); // every night at 3:00
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue