mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
port utilisation alerter (bit dirty, maybe put %age into db too?)
git-svn-id: http://www.observium.org/svn/observer/trunk@2853 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -91,6 +91,11 @@ $config['alerts']['email']['default_only'] = FALSE; ## Only use default recipi
|
||||
$config['alerts']['email']['enable'] = TRUE; ## Enable email alerts
|
||||
$config['alerts']['bgp']['whitelist'] = NULL; ## Populate as an array() with ASNs to alert on.
|
||||
|
||||
### Port bandwidth threshold percentage %age utilisation above this will cause an alert
|
||||
|
||||
$config['alerts']['port_util_alert'] = FALSE; ## Disabled as default
|
||||
$config['alerts']['port_util_perc'] = 85; ## %age above which to alert
|
||||
|
||||
$config['uptime_warning'] = "84600"; ## Time in seconds to display a "Device Rebooted" Alert. 0 to disable warnings.
|
||||
|
||||
### Cosmetics
|
||||
|
@ -274,9 +274,25 @@ foreach ($ports as $port)
|
||||
}
|
||||
}
|
||||
|
||||
echo('bits('.formatRates($port['update']['ifInOctets_rate']).'/'.formatRates($port['update']['ifOutOctets_rate']).')');
|
||||
$port['ifInBits_rate'] = $port['update']['ifInOctets_rate'] * 8;
|
||||
$port['ifOutBits_rate'] = $port['update']['ifOutOctets_rate'] * 8;
|
||||
echo('bits('.formatRates($port['ifInBits_rate']).'/'.formatRates($port['ifOutBits_rate']).')');
|
||||
echo('pkts('.format_si($port['update']['ifInUcastPkts_rate']).'pps/'.format_si($port['update']['ifOutUcastPkts_rate']).'pps)');
|
||||
|
||||
### Port utilisation % threshold alerting. ## Fixme allow setting threshold per-port. probably 90% of ports we don't care about.
|
||||
if($config['alerts']['port_util_alert'])
|
||||
{
|
||||
// Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this.
|
||||
// Check both inbound and outbound rates
|
||||
$saturation_threshold = $this_port['ifSpeed'] * ( $config['alerts']['port_util_perc'] / 100 );
|
||||
echo("IN: " . $port['ifInBits_rate'] . " OUT: " . $port['ifOutBits_rate'] . " THRESH: " . $saturation_threshold);
|
||||
if (($port['ifInBits_rate'] >= $saturation_threshold || $port['ifOutBits_rate'] >= $saturation_threshold) && $saturation_threshold > 0)
|
||||
{
|
||||
log_event('Port reached saturation threshold: ' . formatRates($port['ifInBits_rate']) . '/' . formatRates($port['ifOutBits_rate']) . ' - ifspeed: ' . formatRates( $this_port['ifSpeed']) , $device, 'interface', $port['interface_id']);
|
||||
notify($device, 'Port saturation threshold reached on ' . $device['hostname'] , 'Port saturation threshold alarm: ' . $device['hostname'] . ' on ' . $port['ifDescr'] . "\nRates:" . formatRates($port['ifInBits_rate']) . '/' . formatRates($port['ifOutBits_rate']) . ' - ifspeed: ' . formatRates( $this_port['ifSpeed']) . "\nTimestamp: " . date($config['timestamp_format']));
|
||||
}
|
||||
}
|
||||
|
||||
/// Update RRDs
|
||||
$rrdfile = $host_rrd . "/port-" . safename($port['ifIndex'] . ".rrd");
|
||||
if (!is_file($rrdfile))
|
||||
|
Reference in New Issue
Block a user