def start( args ): """ Entry point for the 'view' command. Synopsis: kube.py view [-a APPS] [-n NETS] [-f FILESYS] [-s SYNTHS] """ configfile=None if args.keys().count('configfile') != 0: configfile=args['configfile'] del args['configfile'] # create the engine instance kube = KUBE(configfile) if len( args.keys())==0: # view everything kube.view() else: opts = args.keys() for o in opts: what = o items = args[what].split(',') if items[0].lower()=='all': kube.view(what) else: for i in items: kube.view(what,i)
def start( args ): """ Entry point for the 'update' command. Synopsis: kube.py update [-a APPS] [-n NETS] [-f FILESYS] [-s SYNTHS] [--since SINCE] [--to TO] [--rrd] [--log FILE] [--force] """ configfile=None if args.keys().count('configfile') != 0: configfile=args['configfile'] del args['configfile'] # create the engine instance kube = KUBE(configfile) opts = args.keys() if 'log' in opts: Printer.setLogfile(args['log']) printer.plain("--------------------------------------------") printer.info("Kube run on date",str(datetime.now())) printer.plain("--------------------------------------------") # remove the --log from the args del ( args['log'] ) useRRD = args['rrd'] del ( args['rrd'] ) useForce = args['force'] del ( args['force'] ) delta=None since=None to=datetime.now() if args.keys().count('since') !=0 : since=parser.parse(args['since']) del(args['since']) if args.keys().count('to') !=0 : to=parser.parse(args['to']) del(args['to']) if since: delta = to-since else: delta = to - datetime(1973,05,02) since = 'origin' opts = args.keys() if len(opts)==0: kube.refine(To=to,Delta=delta,rrd=useRRD,force=useForce) else: for o in opts: what = o items = args[what].split(',') if items[0].lower()=='all': kube.refine(what,To=to,Delta=delta,rrd=useRRD,force=useForce) else: for i in items: kube.refine(what,i,To=to,Delta=delta,rrd=useRRD,force=useForce)
def start(args): """ Entry point for the 'update' command. Synopsis: kube.py update [-a APPS] [-n NETS] [-f FILESYS] [-s SYNTHS] [--since SINCE] [--to TO] [--rrd] [--log FILE] [--force] """ # create the engine instance kube = KUBE() opts = args.keys() if "log" in opts: Printer.setLogfile(args["log"]) printer.plain("--------------------------------------------") printer.info("Kube run on date", str(datetime.now())) printer.plain("--------------------------------------------") # remove the --log from the args del (args["log"]) useRRD = args["rrd"] del (args["rrd"]) useForce = args["force"] del (args["force"]) delta = None since = None to = datetime.now() if args.keys().count("since") != 0: since = parser.parse(args["since"]) del (args["since"]) if args.keys().count("to") != 0: to = parser.parse(args["to"]) del (args["to"]) if since: delta = to - since else: delta = to - datetime(1973, 05, 02) since = "origin" opts = args.keys() if len(opts) == 0: kube.refine(To=to, Delta=delta, rrd=useRRD, force=useForce) else: for o in opts: what = o items = args[what].split(",") if items[0].lower() == "all": kube.refine(what, To=to, Delta=delta, rrd=useRRD, force=useForce) else: for i in items: kube.refine(what, i, To=to, Delta=delta, rrd=useRRD, force=useForce)
def start( args ): """ Entry point for the 'run' command. Synopsis: kube.py run [-a APPS] [-n NETS] [-f FILESYS] [-s SYNTHS] [--log FILE] """ configfile=None if args.keys().count('configfile') != 0: configfile=args['configfile'] del args['configfile'] # create the engine instance kube = KUBE(configfile) opts = args.keys() if 'log' in opts: Printer.setLogfile(args['log']) printer.plain("--------------------------------------------") printer.info("Kube run on date",str(datetime.datetime.now())) printer.plain("--------------------------------------------") # remove the --log from the args del ( args['log'] ) if len( args.keys())==0: # Run everything kube.run() else: for o in opts: if o != 'log': what = o items = args[what].split(',') if items[0].lower()=='all': kube.run(what) else: for i in items: kube.run(what,i)
def start( args ): """ Entry point for the 'probe' command. Synopsis: kube.py probe {-t DIR [-p] [-m METRIC_NAME] [--since SINCE] [--to TO] , -b BASE_DIR [-p] [--target DIR] { [--since SINCE] [--to TO], [--at DATE] }} """ # create the engine instance kube = KUBE() opts = args.keys() delta=None since=None to=datetime.now() printToSTDOUT=args['p'] if 't' in opts: # time analysis mname=None # get target dir target = args['t'] # get the list of the metrics if 'metric_name' in opts: mname = args['metric_name'].split(',') if not 'since' in opts and not 'to' in opts: # call the fast method kube.timeAnalysis(target,mname,printToSTDOUT) else: try: if args.keys().count('since') !=0 : since=parser.parse(args['since']) if args.keys().count('to') !=0 : to=parser.parse(args['to']) if since: delta = to-since else: delta = to - datetime(1973,05,02) except Exception as x : printer.error("Error!!! Possible wrong date format" , str(x)) return kube.timeAnalysis(target,mname,printToSTDOUT,to,delta) return if 'b' in opts: # metrics boxplot graph analysis target = None mname=None at = None # get target dir template = args['b'] # get the list of the metrics if 'metric_name' in opts: mname = args['metric_name'].split(',') # get the target dir if 'target' in opts: target = args['target'] # get the exact date if exists if 'at' in opts: since = parser.parse(args['at']) to = since if not 'since' in opts and not 'to' in opts and not 'at' in opts: # call the fast method kube.metricAnalysis(template,target,printToSTDOUT,to,to - datetime(1973,05,02),mname) else: try: if args.keys().count('since') !=0 : since=parser.parse(args['since']) if args.keys().count('to') !=0 : to=parser.parse(args['to']) if since: delta = to-since else: delta = to - datetime(1973,05,02) except Exception as x : printer.error("Error","Possible wrong date format") return kube.metricAnalysis(template,target,printToSTDOUT,to,delta,mname) return