当前位置: 代码迷 >> Web前端 >> apm ui中数据源、datasources、policy的差异
  详细解决方案

apm ui中数据源、datasources、policy的差异

热度:505   发布时间:2012-11-23 00:03:43.0
apm ui中数据源、datasources、policy的区别
一、apm ui中数据源、datasources、policy的区别

先看一个groupwidget的定义:
{
    "id":"Bocom_DB_AllList_Widget",
    "title":"数据库服务器列表",
    "type":"HC_DB",
    "width":140,
    "height":380,
    "preventCache": false,
    "dataPrefetch": true,
    "help":"",
    "SourceToken":"",
"arg_service_code":"",
"arg_type":"",
"arg_code_ip":"",
"arg_app_code":"",
    "requestParams": [
    "$.definition.arg_service_code",
"$.definition.arg_type",
"$.definition.arg_code_ip",
"$.definition.arg_app_code",
"$.definition.datasets.parameters.arg_service_code",
"$.definition.datasets.parameters.arg_type",
"$.definition.datasets.parameters.arg_app_code",
"$.definition.datasets.parameters.arg_code_ip"
    ],
    "datasets":[
        {
            "id":"SERVER_LIST",
            "type":"NOWRAPPER",
            "columns":[
                "IP"
            ],
            "query":{
                "executePolicy":"true"
            },
            "parameters":{
            }
        }
    ],
    "widgets":[
        {
            "class":"ibm.apm.widgets.GridWidget",
            "wid":"w002",
            "params":{
                "label":"",
                "x":0,
                "y":0,
                "width":140,
                "height":610,
                "meta":[
                    {
                        "id":"SERVER_LIST.IP",
                        "alias":"服务器IP",
                        "align": "left",
                        "moveTo":"Bocom_Page_DBServer_Detail",
                        "moveToParams":{
                            "mixin":{
                                "$.definition.groupWidgets.arg_service_code":"$.definition.arg_service_code",
                        "$.definition.groupWidgets.arg_type":"$.definition.arg_type",
                        "$.definition.groupWidgets.arg_code_ip":"$.selectedData.properties[0].value",
                        "$.definition.groupWidgets.arg_app_code":"$.definition.arg_app_code",
                        "$..parameters.arg_service_code":"$.definition.arg_service_code",
                                "$..parameters.arg_type":"$.definition.arg_type",
                                "$..parameters.arg_code_ip":"$.selectedData.properties[0].value",
                                "$..parameters.arg_app_code":"$.definition.arg_app_code"

}
}
}
                ]
            }
        }
    ]
}

其中, "datasets"中的 "id":"SERVER_LIST",SERVER_LIST就是policy的名字,也是dataset的id号。加上IMPACT_POLICY_前缀后,变成IMPACT_POLICY_SERVER_LIST,就是datasource的名字

二、如何构造URL发给Impact DP测试数据:

http://localhost:8080/ibm/tivoli/apm/rest/widgets/Bocom_DB_List_Widget/data/?requestParams=%7B%22%24.definition.arg_service_code%22%3A%22E01_SEB%22%2C%22%24.definition.arg_type%22%3A%224%22%2C%22%24.definition.arg_code_ip%22%3A%22%22%2C%22%24.definition.arg_app_code%22%3A%22SEB%22%2C%22%24.definition.datasets.parameters.arg_service_code%22%3A%22E01_SEB%22%2C%22%24.definition.datasets.parameters.arg_type%22%3A%224%22%2C%22%24.definition.datasets.parameters.arg_app_code%22%3A%22SEB%22%7D&dojo.preventCache=1349846713903
这里的主要看有parameters的参数,它会传给DP来过滤数据。
%22%3A%224%22%2C%22%24 大概等于 ="4", 因为是些转移符,看%22 和%22之间的值就可以。这些过滤值在对应的group widget的json定义文件中也找得到。
从\apm\definitions\groupwidgets 找到group widget: Bocom_DB_List_Widget, 打开该文件,可以找到datasets的id:DB_STATUS_LIST

三、可以构造下面的URL,然后在浏览器里面直接测试DP是否返回正确数据:
http://192.168.1.2:16310/ibm/tivoli/rest/providers/Impact_NCICLUSTER/datasources/IMPACT_POLICY_DB_STATUS_LIST/datasets/DB_STATUS_LIST/items?properties=all&param_arg_service_code=E01_SEB&start=0&param_arg_type=4&param_arg_app_code=SEB&count=1000&executePolicy=true&param_refId=9dc2cd1b-d0b9-4ee5-b2f1-97ad858b1b11
红色的基本不变,只是对应的粗体字需要根据你的实际情况来更改,参数值和前面的请求URL(就是第二步中的URL)要对应(也就是和group widget中定义的要对应)。


四、几个工具url
How to test a group widget ?
http://192.168.1.2:16310/ibm/tivoli/apm/rest/apm/test.html?gwId=Bocom_DB_List_Widget

How to test a page?
http://192.168.1.2:16310/ibm/tivoli/apm/rest/apm/test.html?pageId=xxx

How to verify the Impact Data Provider whether it works fine?
https://192.168.1.2:16311/ibm/tivoli/test.html
https://192.168.1.2:16311/ibm/tivoli/rest/providers
https://192.168.1.2:16311/ibm/tivoli/rest/providers/Impact_NCICLUSTER/datasources
https://192.168.1.2:16311/ibm/tivoli/rest/providers/Impact_NCICLUSTER/datasources/IMPACT_POLICY_Biz_Chanel_SEB/datasets
https://192.168.1.2:16311/ibm/tivoli/rest/providers/Impact_NCICLUSTER/datasources/IMPACT_POLICY_Biz_Chanel_SEB/datasets/DSQLDT1/items?properties=all
http://192.168.1.2:16310/ibm/tivoli/rest/providers/Impact_NCICLUSTER/datasources/IMPACT_POLICY_DB_TABLESPACE_SUMMARY/datasets/DB_TABLESPACE_SUMMARY/items?properties=CODE_IP,DB_NAME,INSTANCE_NAME,TABLESPACE_TYPE,TABLESPACE_NAME,SPACE_USED_DMS_TABLE_PCT&param_arg_service_code=E01_SEB&start=0&param_arg_service_code_konder=E01_SEB_konder&param_arg_type=4&param_arg_app_code=SEB&param_arg_service_code_event=E01_SEB_event&count=1000&executePolicy=true&param_refId=0190b3f3-4021-4b9a-9c8c-ac1db72d8b73

五、
从DP取数据的,你需要把ip和端口换成你们的:
http://localhost:8080/ibm/tivoli/apm/rest/widgets/Bocom_DB_List_Widget/data/?requestParams=%7B%22%24.definition.arg_service_code%22%3A%22E01_SEB%22%2C%22%24.definition.arg_type%22%3A%224%22%2C%22%24.definition.arg_code_ip%22%3A%22%22%2C%22%24.definition.arg_app_code%22%3A%22SEB%22%2C%22%24.definition.datasets.parameters.arg_service_code%22%3A%22E01_SEB%22%2C%22%24.definition.datasets.parameters.arg_type%22%3A%224%22%2C%22%24.definition.datasets.parameters.arg_app_code%22%3A%22SEB%22%7D&dojo.preventCache=1349846713903

2.你把上面的取data的URL copy到浏览器中,你会看到如下的结果:

---------------2012/09/27-----------------------
"requestParams": [
    "$.definition.arg_service_code",
"$.definition.arg_type",
"$.definition.arg_code_ip",
"$.definition.arg_app_code",
"$.definition.arg_sys_flag",
"$.definition.datasets.parameters.arg_service_code",  ->"$.definition.datasets.query.arg_service_code",
"$.definition.datasets.parameters.arg_type", --> "$.definition.datasets.query.arg_type",
"$.definition.datasets.parameters.arg_app_code", --> "$.definition.datasets.query.arg_app_code",
"$.definition.datasets.parameters.arg_code_ip", --> "$.definition.datasets.query.arg_code_ip",
"$.definition.datasets.parameters.arg_sys_flag" --> "$.definition.datasets.query.arg_sys_flag"
    ]












  相关解决方案