From b9a08b369a4e292601c24e3b12b88322e1e6215b Mon Sep 17 00:00:00 2001 From: Kris Popendorf Date: Tue, 23 Apr 2013 23:50:58 +0900 Subject: [PATCH] Allows setting warnings by environment variables. --- plugins/network/bandwidth_ | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/network/bandwidth_ b/plugins/network/bandwidth_ index 1ceda5e6..8e1d3865 100755 --- a/plugins/network/bandwidth_ +++ b/plugins/network/bandwidth_ @@ -32,7 +32,7 @@ Please note that aliases cannot be monitored with this plugin. =head1 VERSION -$Id: bandwidth_,v 1.35 2012/01/23 20:04:33 root Exp $ +$Id: bandwidth_,v 1.37 2012/01/23 20:04:33 root Exp $ =head1 AUTHOR @@ -75,6 +75,9 @@ my $count30 = 2592000; # The number of seconds in 30 days my $unix_ts = time; my $rollover = 4294967295; +my $monthlyCap = ($ENV{monthlycap} or 268435456000); +my $warnRate = $monthlyCap/$count30; + init(); sub autoconf { @@ -177,9 +180,9 @@ monthly.info Your projected monthly network rate based on your average network r graph_category network graph_args --base 1024 -l 0 graph_info This graph show your current average bandwidth usage and projected 30 day average based on your last 30 day usage. -average.warning 103563 -monthly.warning 268435456000 -30dayusage.warning 268435456000 +average.warning $warnRate +monthly.warning $monthlyCap +30dayusage.warning $monthlyCap EOM exit 0; }