summaryrefslogtreecommitdiff
path: root/bin/remailer-states-create
diff options
context:
space:
mode:
Diffstat (limited to 'bin/remailer-states-create')
-rwxr-xr-xbin/remailer-states-create57
1 files changed, 57 insertions, 0 deletions
diff --git a/bin/remailer-states-create b/bin/remailer-states-create
new file mode 100755
index 0000000..d2c37dc
--- /dev/null
+++ b/bin/remailer-states-create
@@ -0,0 +1,57 @@
+#!/usr/bin/perl -Tw
+
+# $Id: rrd-create,v 1.2 2001/06/29 07:59:51 statkeep Exp $
+
+use strict;
+use RRDs;
+use Getopt::Long;
+#use FindBin qw{ $Bin };
+
+my $RRDTOOL = 'rrdtool';
+my $RRD = 'data/remailer-states.rrd';
+my $DIR = '.';
+
+my $shorthelp = "Usage: $0 [--verbose] [--force]\n";
+
+my $verbose = 0;
+my $force = 0;
+Getopt::Long::config('bundling');
+unless ( GetOptions(
+ "--verbose" , \$verbose,
+ "-v" , \$verbose,
+ "--force" , \$force,
+ "-f" , \$force
+ ) ) {
+ print STDERR $shorthelp;
+ exit 1;
+};
+
+
+chdir($DIR) || die ("Cannot change to $DIR: $!\n");
+
+die ("$RRD already exists - not creating.\n") if ( -e $RRD && !$force );
+
+my @params = ($RRD);
+push @params, qw{ --step 1800
+ DS:state1OK:GAUGE:28800:0:U
+ DS:state1Warning:GAUGE:28800:0:U
+ DS:state1Critical:GAUGE:28800:0:U
+ DS:state2OK:GAUGE:28800:0:U
+ DS:state2Warning:GAUGE:28800:0:U
+ DS:state2Critical:GAUGE:28800:0:U
+
+ RRA:AVERAGE:0.5:1:2880
+ RRA:AVERAGE:0.5:48:8760
+ RRA:AVERAGE:0.5:192:8760
+};
+
+# Keep 30 minute data for 60 days
+# Keep 1 day data for 1 year
+# Keep 4 day data for 4 years
+print "Creating rrd: $RRD...\n" if $verbose;
+RRDs::create @params;
+my $ERR=RRDs::error;
+die "ERROR while creating squid.rrd: $ERR\n" if $ERR;
+print "done.\n" if $verbose;
+
+# vim:set ts=2: