5efc9a6688
* Removed duplicate licence, updated links do Contributing and Licence in sub-readme. * Renamed bridge-monitor to monitor. * Removed package-lock.json. * Added monitor workspace with linting. * Consistent eslint version. * Added readme for merging.
31 lines
925 B
JavaScript
31 lines
925 B
JavaScript
const fs = require('fs')
|
|
const path = require('path')
|
|
const logger = require('./logger')('checkWorker2')
|
|
const eventsStats = require('./eventsStats')
|
|
const alerts = require('./alerts')
|
|
|
|
async function checkWorker2() {
|
|
try {
|
|
logger.debug('calling eventsStats()')
|
|
const evStats = await eventsStats()
|
|
if (!evStats) throw new Error('evStats is empty: ' + JSON.stringify(evStats))
|
|
fs.writeFileSync(
|
|
path.join(__dirname, '/responses/eventsStats.json'),
|
|
JSON.stringify(evStats, null, 4)
|
|
)
|
|
logger.debug('calling alerts()')
|
|
const _alerts = await alerts()
|
|
if (!_alerts) throw new Error('alerts is empty: ' + JSON.stringify(_alerts))
|
|
fs.writeFileSync(
|
|
path.join(__dirname, '/responses/alerts.json'),
|
|
JSON.stringify(_alerts, null, 4)
|
|
)
|
|
logger.debug('Done x2')
|
|
return evStats
|
|
} catch (e) {
|
|
logger.error('checkWorker2.js', e)
|
|
throw e
|
|
}
|
|
}
|
|
checkWorker2()
|