mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
#2079 Add unmute alert function
This commit is contained in:
@@ -795,7 +795,39 @@ function ack_alert() {
|
|||||||
$app->response->setStatus($code);
|
$app->response->setStatus($code);
|
||||||
$app->response->headers->set('Content-Type', 'application/json');
|
$app->response->headers->set('Content-Type', 'application/json');
|
||||||
echo _json_encode($output);
|
echo _json_encode($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unmute_alert() {
|
||||||
|
global $config;
|
||||||
|
$app = \Slim\Slim::getInstance();
|
||||||
|
$router = $app->router()->getCurrentRoute()->getParams();
|
||||||
|
$alert_id = mres($router['id']);
|
||||||
|
$status = 'error';
|
||||||
|
$err_msg = '';
|
||||||
|
$message = '';
|
||||||
|
$code = 500;
|
||||||
|
if (is_numeric($alert_id)) {
|
||||||
|
$status = 'ok';
|
||||||
|
$code = 200;
|
||||||
|
if (dbUpdate(array('state' => 1), 'alerts', '`id` = ? LIMIT 1', array($alert_id))) {
|
||||||
|
$message = 'Alert has been unmuted';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message = 'No alert by that ID';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$err_msg = 'Invalid alert has been provided';
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = array(
|
||||||
|
'status' => $status,
|
||||||
|
'err-msg' => $err_msg,
|
||||||
|
'message' => $message,
|
||||||
|
);
|
||||||
|
$app->response->setStatus($code);
|
||||||
|
$app->response->headers->set('Content-Type', 'application/json');
|
||||||
|
echo _json_encode($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user