mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02: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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ if (!empty($ifName) && is_numeric($port_id)) {
|
||||
if (dbUpdate(array('ifAlias'=>$descr), 'ports', '`port_id`=?', array($port_id)) > 0) {
|
||||
$device = device_by_id_cache($device_id);
|
||||
if ($descr === 'repoll') {
|
||||
del_dev_attrib($device, 'ifName');
|
||||
del_dev_attrib($device, 'ifName:'.$ifName);
|
||||
}
|
||||
else {
|
||||
set_dev_attrib($device, 'ifName', $ifName);
|
||||
set_dev_attrib($device, 'ifName:'.$ifName, 1);
|
||||
}
|
||||
$status = 'ok';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('pulse_sessions.rrd');
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$ds = 'sessions';
|
||||
|
||||
$colour_area = '9999cc';
|
||||
$colour_line = '0000cc';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
$graph_min = 0;
|
||||
|
||||
$unit_text = 'Sessions';
|
||||
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('pulse_users.rrd');
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$ds = 'users';
|
||||
|
||||
$colour_area = '9999cc';
|
||||
$colour_line = '0000cc';
|
||||
|
||||
$colour_area_max = '9999cc';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Users';
|
||||
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
||||
@@ -70,11 +70,7 @@ foreach ($rrd_list as $rrd) {
|
||||
$rrd_options .= ' VDEF:tot'.$i.'=octets'.$i.',TOTAL';
|
||||
}
|
||||
|
||||
if ($i) {
|
||||
$stack = 'STACK';
|
||||
}
|
||||
|
||||
$rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In '$stack";
|
||||
$rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In '";
|
||||
$rrd_options .= ' GPRINT:inbits'.$i.':LAST:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:inbits'.$i.':AVERAGE:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:inbits'.$i.':MAX:%6.2lf%s';
|
||||
@@ -84,7 +80,7 @@ foreach ($rrd_list as $rrd) {
|
||||
}
|
||||
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
$rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out.":$stack";
|
||||
$rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out;
|
||||
$rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 10)."Out'";
|
||||
$rrd_options .= ' GPRINT:outbits'.$i.':LAST:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:outbits'.$i.':AVERAGE:%6.2lf%s';
|
||||
|
||||
@@ -166,7 +166,7 @@ foreach (dbFetchRows($sql, $param) as $device) {
|
||||
$port_count = dbFetchCell('SELECT COUNT(*) FROM `ports` WHERE `device_id` = ?', array($device['device_id']));
|
||||
$sensor_count = dbFetchCell('SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ?', array($device['device_id']));
|
||||
|
||||
$actions = ('<div class="row">
|
||||
$actions = ('<div class="container-fluid"><div class="row">
|
||||
<div class="col-xs-1">');
|
||||
$actions .= '<a href="'.generate_device_url($device).'"> <img src="images/16/server.png" border="0" align="absmiddle" alt="View device" title="View device" /></a> ';
|
||||
$actions .= ('</div>
|
||||
@@ -190,7 +190,7 @@ foreach (dbFetchRows($sql, $param) as $device) {
|
||||
<div class="col-xs-1">
|
||||
<a href="https://'.$device['hostname'].'"><img src="images/16/http.png" alt="https" title="Launch browser https://'.$device['hostname'].'" border="0" width="16" height="16" target="_blank"></a>
|
||||
</div>
|
||||
</div>');
|
||||
</div></div>');
|
||||
|
||||
$hostname = generate_device_link($device);
|
||||
$platform = $device['hardware'].'<br />'.$device['features'];
|
||||
|
||||
Reference in New Issue
Block a user