Meghal .B. Gosalia has uploaded a new change for review.

Change subject: Add HostTime Collector for writing time based mom policies.
......................................................................

Add HostTime Collector for writing time based mom policies.

It returns host time statistics using python datetime module.
These stats would be useful for creating a time based policy.
Host Collector time interval is controlled in config file.
It provides the following stats -
year, month, day, hour, minute, second, microsecond

Change-Id: I88a9d87d5f7e5a5c5baae2c20518a26a513dcda4
Signed-off-by: Meghal Gosalia <meg...@yahoo-inc.com>
---
A mom/Collectors/HostTime.py
1 file changed, 36 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/mom refs/changes/13/28613/1

diff --git a/mom/Collectors/HostTime.py b/mom/Collectors/HostTime.py
new file mode 100644
index 0000000..baaaa82
--- /dev/null
+++ b/mom/Collectors/HostTime.py
@@ -0,0 +1,36 @@
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+import datetime
+from mom.Collectors.Collector import *
+
+class HostTime(Collector):
+    """
+    This Collector returns host time statistics using python datetime module.
+    These stats would be useful for creating a time based policy.
+    Time interval at which this collector is run is controlled in config file.
+    It provides the following stats -
+        year, month, day, hour, minute, second, microsecond
+    """
+    def __init__(self, properties):
+        pass
+
+    def collect(self):
+        now = datetime.datetime.now()
+        data = { 'year': now.year, 'month': now.month, \
+                 'day': now.day, 'hour': now.hour, 'minute': now.minute, \
+                 'second': now.second, 'microsecond': now.microsecond }
+        return data
+
+    def getFields(self=None):
+        return set(['year', 'month', 'day', 'hour', \
+                   'minute', 'second', 'microsecond'])


-- 
To view, visit http://gerrit.ovirt.org/28613
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I88a9d87d5f7e5a5c5baae2c20518a26a513dcda4
Gerrit-PatchSet: 1
Gerrit-Project: mom
Gerrit-Branch: master
Gerrit-Owner: Meghal .B. Gosalia <meghalgosa...@gmail.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to