# Path: toughnms/console/forms/host_form.py
# def host_add_form(groups=[]):
# def host_update_form(groups=[]):
# 
# Path: toughnms/console/handlers/base.py
# class BaseHandler(cyclone.web.RequestHandler):
#     def __init__(self, *argc, **argkw):
#     def initialize(self):
#     def on_finish(self):
#     def get_error_html(self, status_code=500, **kwargs):
#     def render(self, template_name, **template_vars):
#     def render_error(self, **template_vars):
#     def _write(self, resp):
#     def render_json(self, **template_vars):
#     def render_string(self, template_name, **template_vars):
#     def render_from_string(self, template_string, **template_vars):
#     def make_sign(self, secret, params=[]):
#     def check_sign(self, secret, msg):
#     def get_page_data(self, query):
#     def get_mdb_page_data(self, query):
#     def get_page_url(self, page, form_id=None):
#     def get_current_user(self):
#     def get_params(self):
#     def get_params_obj(self, obj):
#     def get_param_value(self, name, defval=None):
#     def export_file(self, filename, data):
# 
# Path: toughnms/common/nagutils.py
# STATUS = {0: u"正常", 1: u"警告", 2:u"严重", 3: u"未知", 255: u"未知"}
# 
# STYLE = {0: u"status_ok", 1: u"status_warn", 2: u"status_fail", 3: u"status_unknow", 255: u'status_unknow'}


import base
from toughnms.console.forms import host_form
from toughlib.permit import permit
from toughlib import utils,logger
from toughnms.console.handlers.base import MenuRes
from cyclone.web import authenticated
from toughnms.common.nagutils import STATUS,STYLE
from cyclone.web import authenticated
#!/usr/bin/env python
#coding=utf-8


@permit.route('/status/hosts', u"主机状态", MenuRes, is_menu=True, order=7.0001)
class HostHandler(base.BaseHandler):

    @authenticated
    def get(self, template_variables={}):
        return self.post() 

    @authenticated
    def post(self, template_variables={}):
        group_name = self.get_argument("group_name",None)
        groups = self.nagapi.list_hostgroup()
        all_hosts = self.nagapi.list_host(group_name)
        self.render('host_status.html',
            curr_group=group_name,
            groups=groups,
            hosts=all_hosts,
            STATUS=STATUS,

# Path: toughnms/console/forms/host_form.py
# def host_add_form(groups=[]):
# def host_update_form(groups=[]):
# 
# Path: toughnms/console/handlers/base.py
# class BaseHandler(cyclone.web.RequestHandler):
#     def __init__(self, *argc, **argkw):
#     def initialize(self):
#     def on_finish(self):
#     def get_error_html(self, status_code=500, **kwargs):
#     def render(self, template_name, **template_vars):
#     def render_error(self, **template_vars):
#     def _write(self, resp):
#     def render_json(self, **template_vars):
#     def render_string(self, template_name, **template_vars):
#     def render_from_string(self, template_string, **template_vars):
#     def make_sign(self, secret, params=[]):
#     def check_sign(self, secret, msg):
#     def get_page_data(self, query):
#     def get_mdb_page_data(self, query):
#     def get_page_url(self, page, form_id=None):
#     def get_current_user(self):
#     def get_params(self):
#     def get_params_obj(self, obj):
#     def get_param_value(self, name, defval=None):
#     def export_file(self, filename, data):
# 
# Path: toughnms/common/nagutils.py
# STATUS = {0: u"正常", 1: u"警告", 2:u"严重", 3: u"未知", 255: u"未知"}
# 
# STYLE = {0: u"status_ok", 1: u"status_warn", 2: u"status_fail", 3: u"status_unknow", 255: u'status_unknow'}


# Path: toughnms/console/handlers/host_status.py
import base
from toughnms.console.forms import host_form
from toughlib.permit import permit
from toughlib import utils,logger
from toughnms.console.handlers.base import MenuRes
from cyclone.web import authenticated
from toughnms.common.nagutils import STATUS,STYLE
from cyclone.web import authenticated

#!/usr/bin/env python
#coding=utf-8


@permit.route('/status/hosts', u"主机状态", MenuRes, is_menu=True, order=7.0001)
class HostHandler(base.BaseHandler):

    @authenticated
    def get(self, template_variables={}):
        return self.post() 

    @authenticated
    def post(self, template_variables={}):
        group_name = self.get_argument("group_name",None)
        groups = self.nagapi.list_hostgroup()
        all_hosts = self.nagapi.list_host(group_name)
        self.render('host_status.html',
            curr_group=group_name,
            groups=groups,
            hosts=all_hosts,
            STATUS=STATUS,

            STYLE=STYLE