use machine name if available in alerts
This commit is contained in:
parent
3720c2eca9
commit
0d4ce51467
2 changed files with 7 additions and 4 deletions
|
|
@ -95,7 +95,7 @@ function devicesAndEvents () {
|
|||
}
|
||||
|
||||
function checkStatus () {
|
||||
var alerts = {devices: {}}
|
||||
var alerts = {devices: {}, deviceNames: {}}
|
||||
alerts.general = checkBalances()
|
||||
|
||||
return devicesAndEvents()
|
||||
|
|
@ -105,6 +105,7 @@ function checkStatus () {
|
|||
|
||||
devices.rows.forEach(function (deviceRow) {
|
||||
var deviceFingerprint = deviceRow.fingerprint
|
||||
var deviceName = deviceRow.name || deviceFingerprint
|
||||
var deviceEvents = events.rows.filter(function (eventRow) {
|
||||
return eventRow.device_fingerprint === deviceFingerprint
|
||||
})
|
||||
|
|
@ -113,7 +114,8 @@ function checkStatus () {
|
|||
deviceAlerts = R.concat(deviceAlerts, checkStuckScreen(deviceEvents))
|
||||
deviceAlerts = R.concat(deviceAlerts, checkPing(deviceEvents))
|
||||
|
||||
alerts.devices[deviceRow.fingerprint] = deviceAlerts
|
||||
alerts.devices[deviceFingerprint] = deviceAlerts
|
||||
alerts.deviceNames[deviceFingerprint] = deviceName
|
||||
})
|
||||
|
||||
return alerts
|
||||
|
|
@ -155,7 +157,8 @@ function printEmailAlerts (alertRec) {
|
|||
}
|
||||
|
||||
R.keys(alertRec.devices).forEach(function (device) {
|
||||
body = body + '\nErrors for ' + device + ':\n'
|
||||
var deviceName = alertRec.deviceNames[device]
|
||||
body = body + '\nErrors for ' + deviceName + ':\n'
|
||||
body = body + emailAlerts(alertRec.devices[device])
|
||||
})
|
||||
|
||||
|
|
|
|||
2
todo.txt
2
todo.txt
|
|
@ -1 +1 @@
|
|||
- configure LOW_BALANCE_THRESHOLD, STALE_STATE, NETWORK_DOWN_TIME
|
||||
- fix tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue