Include hostname in alerts_list API command

- Include hostname in alerts_list API command
- Update API docs
This commit is contained in:
Søren Rosiak
2015-04-19 13:28:58 +02:00
parent c1a2e630e1
commit 9da3efe091
2 changed files with 2 additions and 1 deletions

View File

@ -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');