diff --git a/web/skins/bootstrap/js/controllers.js b/web/skins/bootstrap/js/controllers.js index fde6e5d97..29b3f83c4 100644 --- a/web/skins/bootstrap/js/controllers.js +++ b/web/skins/bootstrap/js/controllers.js @@ -50,6 +50,34 @@ ZoneMinder.controller('ConsoleController', function($scope, Console) { $scope['Counts' + mid] = count; } }); + + Console.getMonitors().then(function(results) { + var monitors = new Array(); + var daemons = ['zmc', 'zma']; // Daemons to check for each monitor + + // For each monitor + angular.forEach(results['data']['monitors'], function(value, key) { + var id = value.Monitor.Id; + var alerts = value.Monitor.alerts = new Array(); + + // Check if the above daemons are running for it + angular.forEach(daemons, function(daemon) { + // Ask the API for the daemonStatus of the id + Console.daemonStatus(id, daemon).then(function(results) { + value.Monitor.alerts[daemon] = results.data.status; + + // If there is a failed daemon, set a generic error + if (daemon) { + value.Monitor.alert = 'zma or zmc is not running'; + } + }); + }); + + monitors.push(value.Monitor); + }); + + $scope.monitors = monitors; + }); }); diff --git a/web/skins/bootstrap/views/console.php b/web/skins/bootstrap/views/console.php index b6bb4398b..2664dee4b 100644 --- a/web/skins/bootstrap/views/console.php +++ b/web/skins/bootstrap/views/console.php @@ -60,40 +60,21 @@ xhtmlHeaders( __FILE__, $SLANG['Console'] );