Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar_network/node/stats.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-06-12 13:15:00 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-06-13 04:24:20 (GMT)
commite0cff7ad61e521f41a15eafef57b202718b5a9b1 (patch)
tree2202d5b76ae8395440bb10f90f6d88b466ba91de /sugar_network/node/stats.py
parentb43a3006aac9c8ca1e508fd77c92c8cb28f23e44 (diff)
Restructure files hierarchy to include server code
Diffstat (limited to 'sugar_network/node/stats.py')
-rw-r--r--sugar_network/node/stats.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/sugar_network/node/stats.py b/sugar_network/node/stats.py
new file mode 100644
index 0000000..30a7095
--- /dev/null
+++ b/sugar_network/node/stats.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2012 Aleksey Lim
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+from gettext import gettext as _
+
+from active_toolkit import optparse
+
+
+stats = optparse.Option(
+ _('enable stats collecting'),
+ default=False, type_cast=optparse.Option.bool_cast,
+ action='store_true')
+
+stats_root = optparse.Option(
+ _('path to the root directory for placing stats'),
+ default='/var/lib/sugar-network/stats')
+
+stats_step = optparse.Option(
+ _('step interval in seconds for RRD databases'),
+ default=60, type_cast=int)
+
+stats_server_rras = optparse.Option(
+ _('space separated list of RRAs for RRD databases on a server side'),
+ default='RRA:AVERAGE:0.5:1:4320 RRA:AVERAGE:0.5:5:2016',
+ type_cast=lambda x: [i for i in x.split() if i],
+ type_repr=lambda x: ' '.join(x))
+
+stats_client_rras = optparse.Option(
+ _('space separated list of RRAs for RRD databases on client side'),
+ default='RRA:AVERAGE:0.5:1:4320 RRA:AVERAGE:0.5:5:2016',
+ type_cast=lambda x: [i for i in x.split() if i],
+ type_repr=lambda x: ' '.join(x))