Added date/time information to allow for timeseries

master
Steve L. Nyemba 8 years ago
parent f63bc18cfc
commit ef7136b5a0

@ -10,6 +10,7 @@ import os
import subprocess
from sets import Set
import re
import datetime
class Analysis:
def __init__(self):
@ -17,6 +18,9 @@ class Analysis:
pass
def post(self,object):
self.logs.append(object)
def init(self):
d = datetime.datetime.now()
self.now = {"month":d.month,"year":d.year, "day":d.day,"hour":d.hour}
"""
This class is designed to analyze environment variables. Environment variables can either be folders, files or simple values
The class returns a quantifiable assessment of the environment variables (expected 100%)
@ -25,6 +29,7 @@ class Env(Analysis):
def __init__(self):
Analysis.__init__(self)
def init(self,values):
Analysis.init(self)
self.values = values
"""
This function evaluate the validity of an environment variable by returning a 1 or 0 (computable)
@ -61,6 +66,7 @@ class Sandbox(Analysis):
def __init__(self):
Analysis.__init__(self)
def init(self,conf):
Analysis.init(self)
self.sandbox_path = conf['sandbox']
self.requirements_path = conf['requirements']
def get_requirements (self):
@ -98,6 +104,7 @@ class ProcessCounter(Analysis):
def __init__(self):
Analysis.__init__(self)
def init(self,names):
Analysis.init(self)
self.names = names
def evaluate(self,name):
cmd = "".join(['ps -eo comm |grep ',name,' |wc -l'])
@ -120,6 +127,7 @@ class DetailProcess(Analysis):
def __init__(self):
Analysis.__init__(self)
def init (self,names):
Analysis.init(self)
self.names = names;
def evaluate(self,name) :
cmd = "ps -eo pmem,pcpu,vsize,comm|grep :app$"

Loading…
Cancel
Save