Monitoring data retrieval job now working.

This commit is contained in:
baldo 2016-05-24 20:29:28 +02:00
parent 3cbb65f66d
commit b84bfb5c99
2 changed files with 8 additions and 9 deletions

View file

@ -31,8 +31,7 @@ angular.module('ffffng').factory('Scheduler', function ($injector, Logger, confi
schedule('0 */1 * * * *', 'MailQueueJob'); schedule('0 */1 * * * *', 'MailQueueJob');
if (config.client.monitoring.enabled) { if (config.client.monitoring.enabled) {
// schedule('0 */5 * * * *', 'NodeInformationRetrievalJob'); schedule('30 */5 * * * *', 'NodeInformationRetrievalJob');
schedule('*/10 * * * * *', 'NodeInformationRetrievalJob');
// schedule('0 */1 * * * *', 'NodeInformationCleanupJob'); // schedule('0 */1 * * * *', 'NodeInformationCleanupJob');
} }
} }

View file

@ -55,11 +55,11 @@ angular.module('ffffng')
return Database.run( return Database.run(
'UPDATE node_state ' + 'UPDATE node_state ' +
'WHERE id = ? AND mac = ?' + 'SET state = ?, last_seen = ?, import_timestamp = ?, modified_at = ?' +
'SET state = ?, last_seen = ?, import_timestamp = ?, modified_at = ?', 'WHERE id = ? AND mac = ?',
[ [
row.id, node.mac, nodeData.state, nodeData.lastSeen.unix(), nodeData.importTimestamp.unix(), moment().unix(),
nodeData.state, nodeData.lastSeen.unix(), nodeData.importTimestamp.unix(), moment.unix() row.id, node.mac
], ],
callback callback
); );
@ -92,7 +92,7 @@ angular.module('ffffng')
} }
}); });
} else { } else {
return deleteNodeInformation(node, callback); return deleteNodeInformation(nodeData, node, callback);
} }
} }
@ -105,7 +105,7 @@ angular.module('ffffng')
if (!_.isString(json.timestamp)) { if (!_.isString(json.timestamp)) {
return moment.invalid(); return moment.invalid();
} }
return moment(timestamp); return moment.utc(timestamp);
} }
var data = {}; var data = {};
@ -291,7 +291,7 @@ angular.module('ffffng')
if (err) { if (err) {
Logger Logger
.tag('monitoring', 'information-retrieval') .tag('monitoring', 'information-retrieval')
.debug('Could not update / deleting node data:', nodeData.mac, err); .debug('Could not update / deleting node data: ', nodeData.mac, err);
return nodeCallback(err); return nodeCallback(err);
} }