def m_host_jk_ht():
    sql="select id,ip,jk_type from jk_host where jk_bz='Y'  order by add_time;"
    jk_list=config.dbw.query(sql).list()
    for i in range(len(jk_list)):
        if jk_list[i]['jk_type']=='ping':
            host_ping(jk_list[i]['ip'],jk_list[i]['id'])
        else:
            host_port_jk(jk_list[i]['ip'],int(jk_list[i]['jk_type']),jk_list[i]['id'])

    m_host_jk_ht()
示例#2
0
def m_host_edit_2(ip,type,hostinfo,id):
    t_time=nowtime()
    ip=ip
    type=type
    id=id
    sql="update jk_host set ip='%s',host_info='%s',jk_type='%s' where id=%s" % (ip,hostinfo,type,int(id))
    if config.dbw.query(sql):
        if type=='ping':
            host_ping(ip,id)
        else:
            host_port_jk(ip,int(type),id)
        return "主机修改成功!"
    else:
        return "主机未做修改"
示例#3
0
def m_add_host(ip,type,hostinfo):
    t_time=nowtime()
    ip=ip
    type=type
    sql="insert into jk_host(ip,host_info,add_time,en_time,jk_status,jk_type) values('"+ip+"','"+hostinfo+"','"+t_time+"','"+t_time+"','Y','"+type+"')"
    sql2="select id,ip,jk_type from jk_host where jk_bz='Y'  order by add_time desc limit 1;"

    if config.dbw.query(sql):
        nowres=config.dbw.query(sql2).list()
        if type=='ping':
            host_ping(ip,nowres[0]['id'])
        else:
             host_port_jk(ip,int(type),nowres[0]['id'])
        return "主机添加成功!"
    else:
        return "主机添加失败!请重新添加"