Пример #1
0
from monitorgui import web

render = web.template.render('monitorgui/templates/')

urls = (
  "", "chart_request_handler",
)

class chart_request_handler:
     def GET(self):
        user_data = web.input()
        return render.display_graph("/query?inst_id="+str(user_data.inst_id)+"&env="+str(user_data.env))
    

app_chart_request_handler = web.application(urls, locals())
Пример #2
0
from monitorgui import web,query,chart_request_handler,instances
from monitorgui.web import form
from services import aws_ec2
from utils import Config


render = web.template.render('monitorgui/templates/')

urls = ('/', 'server', "/query", query.app_query, '/chart_request_handler', chart_request_handler.app_chart_request_handler,
        '/instances', instances.app_instances)
app = web.application(urls, globals())



class server: 
    def GET(self): 
        config = Config.Config()
        list_envs = [env for env in config.get_all_sections() if env != 'default']
        return render.environments(list_envs)
               
                
if __name__=="__main__":
    web.internalerror = web.debugerror
    app.run()
Пример #3
0
)

render = web.template.render('monitorgui/templates/')

class instances:
    def GET(self):
  
        user_data = web.input()
        env_id = user_data.env_id
        config = Config.Config (str(env_id))
                 
        #get stopped instances
        stopped_instances = list()
        stopped_instances=config.get_list('stopped_instances')
           
            
        #get running instances
        instance_list = aws_ec2.get_running_instances(config)
        instance_id_list = list()
        for instance in instance_list:
                instance_id_list.append(instance.id)
        
       
        return render.instances(instance_id_list,str(env_id),stopped_instances)
                   
        
       
    

app_instances = web.application(urls, locals())