diff --git a/doc/API/API-Docs.md b/doc/API/API-Docs.md index 3e3bdabb8..ddd786d54 100644 --- a/doc/API/API-Docs.md +++ b/doc/API/API-Docs.md @@ -487,6 +487,7 @@ Output: "count": 7, "alerts": [ { + "hostname": "localhost", "id": "1", "device_id": "1", "rule_id": "1", diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index 161ce3fc8..019b073c2 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -536,7 +536,7 @@ function list_alerts() { $sql = "AND id=?"; array_push($param,$alert_id); } - $alerts = dbFetchRows("SELECT * FROM `alerts` WHERE `state` IN (?) $sql",$param); + $alerts = dbFetchRows("SELECT `D`.`hostname`, `A`.* FROM `alerts` AS `A`, `devices` AS `D` WHERE `D`.`device_id` = `A`.`device_id` AND `A`.`state` IN (?) $sql",$param); $total_alerts = count($alerts); $output = array("status" => "ok", "err-msg" => '', "count" => $total_alerts, "alerts" => $alerts); $app->response->setStatus('200');