mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Include hostname in alerts_list API command
- Include hostname in alerts_list API command - Update API docs
This commit is contained in:
@ -487,6 +487,7 @@ Output:
|
|||||||
"count": 7,
|
"count": 7,
|
||||||
"alerts": [
|
"alerts": [
|
||||||
{
|
{
|
||||||
|
"hostname": "localhost",
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"device_id": "1",
|
"device_id": "1",
|
||||||
"rule_id": "1",
|
"rule_id": "1",
|
||||||
|
@ -536,7 +536,7 @@ function list_alerts() {
|
|||||||
$sql = "AND id=?";
|
$sql = "AND id=?";
|
||||||
array_push($param,$alert_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);
|
$total_alerts = count($alerts);
|
||||||
$output = array("status" => "ok", "err-msg" => '', "count" => $total_alerts, "alerts" => $alerts);
|
$output = array("status" => "ok", "err-msg" => '', "count" => $total_alerts, "alerts" => $alerts);
|
||||||
$app->response->setStatus('200');
|
$app->response->setStatus('200');
|
||||||
|
Reference in New Issue
Block a user