Exemple #1
0
def uptime():
    try:
        hostUtil = HostUtil()
        message = hostUtil.get_uptime_stat()
    except Exception, e:
        message = "error get uptime, Ex:%s" % (str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #2
0
def getUname():
    try:
        hostUtil = HostUtil()
        message = hostUtil.uname()

    except Exception, e:
        message = "error get uname, Ex:%s" % str(e)
        return Response.make_json_response(message, success=False, code=-1)
Exemple #3
0
def execCommand():
    try:
        hostUtil = HostUtil()
        message = hostUtil.exec_command(request.values.get("cmd"))
    except Exception, e:
        message = "error get sys process list, cmd(%s) Ex:%s" % (
            request.values.get("cmd"), str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #4
0
def getProcessList():

    try:
        hostUtil = HostUtil()
        message = hostUtil.processList()
    except Exception, e:
        message = "error get sys process list, Ex:%s" % (str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #5
0
def memInfo():
    try:
        hostUtil = HostUtil()
        message = hostUtil.get_memory_stat()

    except Exception, e:
        message = "error get mem info, Ex:%s" % (str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #6
0
def diskPathDu():
    try:
        hostUtil = HostUtil()
        message = hostUtil.get_path_du(request.args.get("path"))

    except Exception, e:
        message = "error get disk device stat, Ex:%s" % (str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #7
0
def diskUsage():
    try:
        hostUtil = HostUtil()
        message = hostUtil.disk_usage(request.args.get("mountpoint"))

    except Exception, e:
        message = "error get disk device stat, Ex:%s" % (str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #8
0
def diskPartitions():
    try:
        hostUtil = HostUtil()
        message = hostUtil.disk_partitions()

    except Exception, e:
        message = "error get disk partitions, Ex:%s" % (str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #9
0
def loadavg():
    try:
        hostUtil = HostUtil()
        message = hostUtil.get_load_stat()

    except Exception, e:
        message = "error get cpu loadavg, Ex:%s" % (str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #10
0
def networkInfo(ifname):
    try:
        hostUtil = HostUtil()
        message = hostUtil.networkinfo(ifname)

    except Exception, e:
        message = "error get network %s info, Ex:%s" % (ifname, str(e))
        return Response.make_json_response(message, success=False, code=-1)
Exemple #11
0
def networkList():
    try:
        hostUtil = HostUtil()
        message = hostUtil.network_list()

    except Exception, e:
        message = "error get network list, Ex:%s" % str(e)
        return Response.make_json_response(message, success=False, code=-1)