Cleanup unused code (#11391)

* Global Settings - Alert Default Settings

* Revert "Global Settings - Alert Default Settings"

This reverts commit a1af62b146.

* remove not more used code

* Travis restart
This commit is contained in:
SourceDoctor
2020-04-08 22:56:44 +02:00
committed by GitHub
parent a4cf77b26b
commit fc921a143c
2 changed files with 1 additions and 27 deletions

View File

@@ -764,7 +764,7 @@ foreach ($ports as $port) {
$port['stats']['ifInBits_rate'] = round(($port['stats']['ifInOctets_rate'] * 8));
$port['stats']['ifOutBits_rate'] = round(($port['stats']['ifOutOctets_rate'] * 8));
// If we have a valid ifSpeed we should populate the stats for checking.
// If we have a valid ifSpeed we should populate the stats for checking
if (is_numeric($this_port['ifSpeed']) && $this_port['ifSpeed'] > 0) {
$port['stats']['ifInBits_perc'] = round(($port['stats']['ifInBits_rate'] / $this_port['ifSpeed'] * 100));
$port['stats']['ifOutBits_perc'] = round(($port['stats']['ifOutBits_rate'] / $this_port['ifSpeed'] * 100));
@@ -774,17 +774,6 @@ foreach ($ports as $port) {
echo 'bytes(' . formatStorage($port['stats']['ifInOctets_diff']) . '/' . formatStorage($port['stats']['ifOutOctets_diff']) . ')';
echo 'pkts(' . format_si($port['stats']['ifInUcastPkts_rate']) . 'pps/' . format_si($port['stats']['ifOutUcastPkts_rate']) . 'pps)';
// Port utilisation % threshold alerting. // FIXME allow setting threshold per-port. probably 90% of ports we don't care about.
if (Config::get('alerts.port_util_alert') && $port['ignore'] == '0') {
// Check for port saturation of 'alerts.port_util_perc' or higher. Alert if we see this.
// Check both inbound and outbound rates
$saturation_threshold = ($this_port['ifSpeed'] * (Config::get('alerts.port_util_perc') / 100));
echo 'IN: ' . $port['stats']['ifInBits_rate'] . ' OUT: ' . $port['stats']['ifOutBits_rate'] . ' THRESH: ' . $saturation_threshold;
if (($port['stats']['ifInBits_rate'] >= $saturation_threshold || $port['stats']['ifOutBits_rate'] >= $saturation_threshold) && $saturation_threshold > 0) {
log_event('Port reached saturation threshold: ' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ' - ifspeed: ' . formatRates($this_port['stats']['ifSpeed']), $device, 'interface', 4, $port['port_id']);
}
}
// Update data stores
$rrd_name = getPortRrdName($port_id);
$rrdfile = rrd_name($device['hostname'], $rrd_name);

View File

@@ -148,21 +148,6 @@
"default": false,
"type": "boolean"
},
"alerts.port.ifdown": {
"default": false,
"type": "boolean"
},
"alerts.port_util_alert": {
"default": false,
"type": "boolean"
},
"alerts.port_util_perc": {
"default": 85,
"type": "integer",
"validate": {
"value": "integer|between:0,100"
}
},
"alert_rule.severity": {
"default": "warning",
"group": "alerting",