diff --git a/add b/add
index a7ba04e..753e013 100755
--- a/add
+++ b/add
@@ -59,6 +59,20 @@ else
exit
fi
+while read ds junk
+do
+ ds="${ds//ds[/}"
+ ds="${ds//]*/}"
+ datasets+=("$ds")
+done < <(rrdtool info ingress.rrd |grep index)
+for ds in ${dsnames[@]}
+do
+ if [[ ! ${datasets[@]} =~ $ds ]]
+ then
+ cp -f ingress.rrd ingress.rrd.bak_add_$ds
+ ./dsaddtor.pl ingress.rrd $ds GAUGE $((48*60*60)) 0 NaN
+ fi
+done
data=N
for dsname in "${dsnames[@]}"
do
diff --git a/add.html b/add.html
index d74c359..565f39e 100755
--- a/add.html
+++ b/add.html
@@ -67,6 +67,7 @@ then
DS:Link_Length_x_Days:GAUGE:$((48*60*60)):0:NaN \
DS:Field_Held:GAUGE:$((48*60*60)):0:NaN \
DS:Field_x_Days:GAUGE:$((48*60*60)):0:NaN \
+ DS:Mercenary:GAUGE:$((48*60*60)):0:NaN \
RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \
RRA:AVERAGE:99e-2:1:$((24*15)) \
RRA:MAX:99e-2:1:$((24*15)) \
diff --git a/dsaddtor.pl b/dsaddtor.pl
new file mode 100755
index 0000000..051bd9c
--- /dev/null
+++ b/dsaddtor.pl
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+# dsaddtor.pl, Program to add datasources to an existing RRD
+#
+# Copyright (C) 2010 R. Sandevoir remi.sandevoir(at)gmail.com
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+
+use strict;
+use warnings;
+
+use RRD::Simple ();
+
+my $rrdfile = shift || &Usage;
+if ($rrdfile eq '-h') {
+ &Usage;
+ exit 0;
+}
+
+my $name = shift || &Usage;
+my $type = shift || 'COUNTER';
+my $heartbeat = shift || '600';
+my $min = shift || 'NaN';
+my $max = shift || 'NaN';
+
+my $rrd = RRD::Simple->new(
+ file => $rrdfile,
+ rrdtool => "/usr/bin/rrdtool",
+);
+
+print "Adding DS $name on $rrdfile\n";
+$rrd->add_source($rrdfile, $name => $type);
+
+print "Heartbeat : $heartbeat\nMinimum value : $min\nMaximum value : $max\n";
+RRDs::tune ($rrdfile, "-h","$name:$heartbeat");
+RRDs::tune ($rrdfile, "-i","$name:$min");
+RRDs::tune ($rrdfile, "-a","$name:$max");
+
+sub Usage {
+ print "dsaddtor.pl [type] [heartbeat] [rrdmin] [rrdmax]\n";
+ print "\t\tSource RRD file\n";
+ print "\t\tDatasource name to add\n";
+ print "\t[type]\t\tType of datasource (i.e. COUNTER, GAUGE...). Default : COUNTER\n";
+ print "\t[heartbeat]\tLength of time in seconds before RRD thinks your DS is dead. Default : 600\n";
+ print "\t[rrdmin]\tMinimum value allowed for each datasource. Default : NaN\n";
+ print "\t[rrdmax]\tMax value allowed for each datasource. Default : NaN\n";
+ exit 0
+}
diff --git a/index b/index
index 48574d2..90b5b2a 100755
--- a/index
+++ b/index
@@ -331,30 +331,7 @@ then
if (( show_all ))
then
stats=(
- AP
- Explorer
- Seer
- XM
- Hacker
- Builder
- Connector
- Mind_Controller
- MU
- Longest_Link
- Largest_Field
- Recharger
- Liberator
- Pioneer
- Purifier
- Neutralized
- Links_Destroyed
- Fields_Destroyed
- Walked
- Guardian
- Link_Maintained
- Link_Length_x_Days
- Field_Held
- Field_x_Days
+ "${dsnames[@]}"
)
else
stats=(
diff --git a/lib/globals b/lib/globals
index c45e2a4..f4eb12f 100644
--- a/lib/globals
+++ b/lib/globals
@@ -34,3 +34,30 @@ declare \
start \
end \
+want_ds=(
+ AP
+ Explorer
+ Seer
+ XM
+ Hacker
+ Builder
+ Connector
+ Mind_Controller
+ MU
+ Longest_Link
+ Largest_Field
+ Recharger
+ Liberator
+ Pioneer
+ Purifier
+ Neutralized
+ Links_Destroyed
+ Fields_Destroyed
+ Walked
+ Guardian
+ Link_Maintained
+ Link_Length_x_Days
+ Field_Held
+ Field_x_Days
+ Mercenary
+)
diff --git a/settings b/settings
index 14ac58f..0e3309b 100644
--- a/settings
+++ b/settings
@@ -60,6 +60,7 @@ uinames=(
"Max Link Length x Days"
"Max Time Field Held"
"Largest Field MUs x Days"
+ "Unique missions completed"
)
dsnames=(
AP
@@ -86,6 +87,7 @@ dsnames=(
Link_Length_x_Days
Field_Held
Field_x_Days
+ Mercenary
)
medals=(
Explorer