Example #1
0
def Main():
    cgiEnv = lib_common.ScriptEnvironment()
    pid_int = int(cgiEnv.GetId())

    grph = cgiEnv.GetGraph()

    node_process = lib_uris.gUriGen.PidUri(pid_int)

    jmx_data = survol_java.GetJavaDataFromJmx(pid_int)
    try:
        jmx_data_m_beans = jmx_data["allMBeans"]
    except KeyError:
        jmx_data_m_beans = []

    prop_m_bean = lib_common.MakeProp("MBean")

    for jmx_m_bean in jmx_data_m_beans:
        cls_nam = jmx_m_bean["className"]
        obj_nam = jmx_m_bean["objectName"]

        # "=sun.management.ManagementFactoryHelper$1[java.nio:type=BufferPool,name=mapped]"
        logging.debug("jmx_m_bean=%s", jmx_m_bean)

        # Not sure about the file name
        node_class = survol_mbean.MakeUri(pid_int, obj_nam)
        grph.add((node_class, lib_common.MakeProp("Class name"),
                  lib_util.NodeLiteral(cls_nam)))

        grph.add((node_process, prop_m_bean, node_class))

    cgiEnv.OutCgiRdf("LAYOUT_RECT", [prop_m_bean])
Example #2
0
def Main():
    cgiEnv = lib_common.CgiEnv()
    pidInt = int(cgiEnv.GetId())

    grph = cgiEnv.GetGraph()

    node_process = lib_common.gUriGen.PidUri(pidInt)
    # proc_obj = psutil.Process(pidInt)

    jmxData = survol_java.GetJavaDataFromJmx(pidInt)
    try:
        jmxDataMBeans = jmxData["allMBeans"]
    except KeyError:
        jmxDataMBeans = []

    propMBean = lib_common.MakeProp("MBean")

    for jmxMBean in jmxDataMBeans:
        clsNam = jmxMBean["className"]
        objNam = jmxMBean["objectName"]

        # "=sun.management.ManagementFactoryHelper$1[java.nio:type=BufferPool,name=mapped]"
        DEBUG("jmxMBean=%s", jmxMBean)

        # Not sure about the file name
        nodeClass = survol_mbean.MakeUri(pidInt, objNam)
        grph.add((nodeClass, lib_common.MakeProp("Class name"),
                  lib_common.NodeLiteral(clsNam)))

        grph.add((node_process, propMBean, nodeClass))

    # sys.stderr.write("jmxData=%s\n"%jmxData)
    # cgiEnv.OutCgiRdf()
    cgiEnv.OutCgiRdf("LAYOUT_RECT", [propMBean])
def Main():
    cgiEnv = lib_common.CgiEnv()
    pidInt = int(cgiEnv.GetId())

    pidMBean = cgiEnv.m_entity_id_dict["Handle"]

    # TODO: Not convenient.
    # mbeanObjNam = cgiEnv.m_entity_id_dict["Name"].replace("*",",").replace("-","=")
    mbeanObjNam = cgiEnv.m_entity_id_dict["Name"]
    mbeanObjNam = mbeanObjNam.replace("*", ",").replace("-", "=")
    # mbeanObjNam = cgi.unescape(mbeanObjNam)

    grph = cgiEnv.GetGraph()

    node_process = lib_common.gUriGen.PidUri(pidInt)
    # proc_obj = psutil.Process(pidInt)

    jmxData = survol_java.GetJavaDataFromJmx(pidInt, mbeanObjNam)

    jmxDataMBeans = jmxData["allMBeans"]

    propMBean = lib_common.MakeProp("MBean")

    # There should be only one.
    for jmxMBean in jmxDataMBeans:
        clsNam = jmxMBean["className"]
        objNam = jmxMBean["objectName"]

        if objNam != mbeanObjNam:
            sys.stderr.write("THIS SHOULD NOT HAPPEN: %s != %s\n" %
                             (objNam, mbeanObjNam))

        # "=sun.management.ManagementFactoryHelper$1[java.nio:type=BufferPool,name=mapped]"
        sys.stderr.write("jmxMBean=%s\n" % jmxMBean)

        # Not sure about the file name
        nodeClass = survol_mbean.MakeUri(pidInt, clsNam)
        grph.add((nodeClass, lib_common.MakeProp("Object name"),
                  lib_common.NodeLiteral(objNam)))

        dictMBeanInfo = jmxMBean["info"]
        for keyInfo in dictMBeanInfo:
            valInfo = dictMBeanInfo[keyInfo]
            grph.add((nodeClass, lib_common.MakeProp(keyInfo),
                      lib_common.NodeLiteral(valInfo)))

        grph.add((nodeClass, lib_common.MakeProp("Attributes"),
                  lib_common.NodeLiteral(jmxMBean["attrs"])))

        grph.add((node_process, propMBean, nodeClass))

    # sys.stderr.write("jmxData=%s\n"%jmxData)
    cgiEnv.OutCgiRdf()
def Main():
    cgiEnv = lib_common.ScriptEnvironment()
    pid_int = int(cgiEnv.GetId())

    pid_m_bean = cgiEnv.m_entity_id_dict["Handle"]

    # TODO: Not convenient.
    mbean_obj_nam = cgiEnv.m_entity_id_dict["Name"]
    mbean_obj_nam = mbean_obj_nam.replace("*", ",").replace("-", "=")

    grph = cgiEnv.GetGraph()

    node_process = lib_uris.gUriGen.PidUri(pid_int)

    jmx_data = survol_java.GetJavaDataFromJmx(pid_int, mbean_obj_nam)

    jmx_data_m_beans = jmx_data["allMBeans"]

    prop_m_bean = lib_common.MakeProp("MBean")

    # There should be only one.
    for jmx_m_bean in jmx_data_m_beans:
        cls_nam = jmx_m_bean["className"]
        obj_nam = jmx_m_bean["objectName"]

        if obj_nam != mbean_obj_nam:
            logging.error("THIS SHOULD NOT HAPPEN: %s != %s", obj_nam,
                          mbean_obj_nam)

        # "=sun.management.ManagementFactoryHelper$1[java.nio:type=BufferPool,name=mapped]"
        logging.debug("jmx_m_bean=%s", jmx_m_bean)

        # Not sure about the file name
        node_class = survol_mbean.MakeUri(pid_int, cls_nam)
        grph.add((node_class, lib_common.MakeProp("Object name"),
                  lib_util.NodeLiteral(obj_nam)))

        dict_m_bean_info = jmx_m_bean["info"]
        for keyInfo in dict_m_bean_info:
            val_info = dict_m_bean_info[keyInfo]
            grph.add((node_class, lib_common.MakeProp(keyInfo),
                      lib_util.NodeLiteral(val_info)))

        grph.add((node_class, lib_common.MakeProp("Attributes"),
                  lib_util.NodeLiteral(jmx_m_bean["attrs"])))

        grph.add((node_process, prop_m_bean, node_class))

    cgiEnv.OutCgiRdf()