mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge branch 'master' of https://github.com/librenms/librenms into issue-2018
This commit is contained in:
@ -795,7 +795,39 @@ function ack_alert() {
|
||||
$app->response->setStatus($code);
|
||||
$app->response->headers->set('Content-Type', 'application/json');
|
||||
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