2018-06-13

目前truesight的部署环境


truesight-deploy.png

truesight11接口文档地址

一 、truesight 11提供的ps接口restful api 获取性能数据

1. 获取token

curl -X POST 
  https://tsps11.eoitek.com/tsws/api/v10.1/token 
  -H 'Content-Type: application/json' 
  -d '{
    "username":"admin",
    "password":"admin12345",
    "tenantName":"*"
}'

返回值

{
    "responseTimeStamp": "2018-06-12T10:43:29",
    "statusCode": "200",
    "statusMsg": "OK",
    "response": {
        "authToken": "_3f727f18-2bf5-484c-8aa5-fc7347f7a013",
        "authPassed": true,
        "status": "OK"
    }
}

Token:_3f727f18-2bf5-484c-8aa5-fc7347f7a013, Token默认生命期限是24h

2. device list 获取

curl -X GET \
'https://tsps11.eoitek.com/tsws/10.0/api/omprovider/devices?tenantId=%2A&deviceEntityType=all&parentDeviceId=-1' 
  -H 'Authorization: authToken _3f727f18-2bf5-484c-8aa5-fc7347f7a013' 
  -H 'Content-Type: application/json' `
返回值
`{
    "requestTimeStamp": "2018-06-12T10:48:09",
    "responseTimeStamp": "2018-06-12T10:48:09",
    "statusCode": "200",
    "statusMsg": "OK",
    "responseMsg": "Success",
    "responseContent": {
        "deviceList": [
            {
                "deviceId": "3",
                "dnsName": "tsps107",
                "dispName": "tsps107",
                "ipAddress": "192.168.31.65",
                "deviceEntityType": "Default",
                "deviceType": "0",
                "parentDeviceId": "0",
                "isMarkedForDelete": false,
                "tokenList": [
                    {
                        "tokenId": "",
                        "serverId": 1,
                        "hostId": 12
                    }
                ]
            },
            {
                "deviceId": "2",
                "dnsName": "tsps11.eoitek.com",
                "dispName": "tsps11.eoitek.com",
                "ipAddress": "192.168.31.225",
                "deviceEntityType": "Default",
                "deviceType": "0",
                "parentDeviceId": "0",
                "isMarkedForDelete": false,
                "tokenList": [
                    {
                        "tokenId": "",
                        "serverId": 1,
                        "hostId": 2
                    }
                ]
            },
            {
                "deviceId": "1",
                "dnsName": "tsim11.eoitek.com",
                "dispName": "tsim11.eoitek.com",
                "ipAddress": "192.168.31.226",
                "deviceEntityType": "Default",
                "deviceType": "0",
                "parentDeviceId": "0",
                "isMarkedForDelete": false,
                "tokenList": [
                    {
                        "tokenId": "",
                        "serverId": 1,
                        "hostId": 1
                    }
                ]
            }
        ]
    }
}

得到三台 device,有ipadressDNSName,但没有Associated Group(s)数据

3. Monitor types

获取所有的可以使用的监控项

curl -X GET 
'https://tsps11.eoitek.com/tsws/10.0/api/omprovider/monitortypes?tenantId=%2A&monitorCategory=all' 
  -H 'Authorization: authToken _b4637d4d-431e-4dc6-8bef-db4e31a25eda' 
  -H 'Content-Type: application/json' 

返回值

{
    "requestTimeStamp": "2018-06-12T10:52:18",
    "responseTimeStamp": "2018-06-12T10:52:18",
    "statusCode": "200",
    "statusMsg": "OK",
    "responseMsg": "Success",
    "responseContent": {
        "monitorTypeList": [
            {
                "name": "Sybase ASA Intelliscope",
                "monUniqueName": "SybaseASAsvr",
                "monitorCategory": "instance"
            },
            {
                "name": "PVDC-Compute",
                "monUniqueName": "PVDC_CPU",
                "monitorCategory": "instance"
            },
            {
                "name": "Resource Pool-Storage",
                "monUniqueName": "RP_STORAGE",
                "monitorCategory": "instance"
            },
            -----------------------..
        ]
    }
}

4. Monitor Instance

获取实际配置的监控项实例

curl -X GET 
'https://tsps11.eoitek.com/tsws/10.0/api/omprovider/instances?tenantId=%2A&deviceId=1&monUniqName=NTProcessInfo' 
  -H 'Authorization: authToken _b4637d4d-431e-4dc6-8bef-db4e31a25eda' 
  -H 'Content-Type: application/json'

返回值

{
    "requestTimeStamp": "2018-06-12T10:56:45",
    "responseTimeStamp": "2018-06-12T10:56:45",
    "statusCode": "200",
    "statusMsg": "OK",
    "responseMsg": "Success",
    "responseContent": {
        "instanceList": [
            {
                "deviceId": "1",
                "monUniqName": "NTProcessInfo",
                "monInstName": "rate",
                "isMarkedForDelete": false,
                "monInstKey": {
                    "serverId": "1",
                    "monTypeId": "21023",
                    "monInstId": "6"
                }
            },
            {
                "deviceId": "1",
                "monUniqName": "NTProcessInfo",
                "monInstName": "pronet_cntl",
                "isMarkedForDelete": false,
                "monInstKey": {
                    "serverId": "1",
                    "monTypeId": "21023",
                    "monInstId": "5"
                }
            },
            {
                "deviceId": "1",
                "monUniqName": "NTProcessInfo",
                "monInstName": "services",
                "isMarkedForDelete": false,
                "monInstKey": {
                    "serverId": "1",
                    "monTypeId": "21023",
                    "monInstId": "8"
                }
            },
            --------------
        ]
    }
}

5. Monitor Type configdata

curl -X POST 
  https://tsps11.eoitek.com/tsws/10.0/api/omprovider/configdata 
  -H 'Authorization: authToken _b4637d4d-431e-4dc6-8bef-db4e31a25eda' 
  -H 'Content-Type: application/json' 
  -d '{
    "tenantId":"*",
    "monUniqName":"SybaseASAsvr",
    "instKeyList":[{
                    "serverId": "1",
                    "monTypeId": "40003",
                    "monInstId": "15"
                }]
}'

返回值

{
    "requestTimeStamp": "2018-06-12T11:02:31",
    "responseTimeStamp": "2018-06-12T11:02:31",
    "statusCode": "200",
    "statusMsg": "OK",
    "responseMsg": "Success",
    "responseContent": [
        {
            "monUniqName": "SybaseASAsvr",
            "monInstName": "Sybase ASA",
            "monInstKey": {
                "serverId": "1",
                "monTypeId": "40003",
                "monInstId": "15"
            },
            "attributeMap": {
                "INSTANCE_NAME": "Sybase ASA",
                "PORT": "2638",
                "CI_ID": "",
                "Product Name": "SQL Anywhere",
                "MaxCacheSize": "4095 MB",
                "MinCacheSize": "1024 MB",
                "_MON_VERSION": "2.0",
                "Product Version": "16.0.0.2322",
                "DNSIP": "192.168.31.226",
                "CI_TOKEN_ID": "",
                "SRCIP": "ProactiveServer",
                "CI_ALIAS": "",
                "DB": "storm_tsim11"
            }
        }
    ]
}

6. perfdata

curl -X POST 
  https://tsps11.eoitek.com/tsws/10.0/api/omprovider/perfdata 
  -H 'Authorization: authToken  _b88f09a6-0a8d-4bde-9e30-33539f80361b' 
  -H 'Content-Type: application/json' 
  -d '{
    "tenantId":"*",
    "monUniqName":"NTProcessInfo",
    "instKeyList":[{
                "serverId": "1",
                "monTypeId": "21023",
                "monInstId": "8"
            }],
    "startTime":"1528700358",
    "endTime":"1528711158",
    "type":"rate",
    "computation":"avg",
    "attribUniqNameList":["Windows Process"]
}'

返回值

{
    "requestTimeStamp": "2018-06-13T11:22:44",
    "responseTimeStamp": "2018-06-13T11:22:44",
    "statusCode": "400",
    "statusMsg": "Bad Request",
    "responseMsg": "Requested attribute list is not supported [Windows Process]",
    "responseContent": null
}

综上所述,由于无法拿到关联组信息和attribUniqNameList,无法拿到性能数据。另外 ,也么找到,Event的ps接口。

二、 truesight 11提供的im接口restful api 获取性能数据

1. token

curl -X POST 
  https://tsps11.eoitek.com/tsws/10.0/api/authenticate/login 
  -H 'Content-Type: application/json' 
  -d '{ "username"  : "admin", "password" : "admin12345" , "tenantName" : "*" }'

2. device List (hub接口)

connect to 192.168.31.226:1099

instId      IP Address  Device Type        DNS Name               Name  Time Recorded  Associated Agent  Device Description  Is Auto Sync  Parent HOST ID  Virtual Server Type  Parent Device Name  Parent Device IP Address    Device DNS Name  Device Source Mask  Unique Name 1  Unique Name 2  Unique Name 3  Unique Name 4  Unique Name 5  Unique Name 6                                 Alias  Mask  CMDB Parent Instance Id  Secondary IPs     MCUDID  MFD  MFD Timestamp                          OS Name                            OS Version                                           Serial Number  Associated Group(s)
     1  192.168.31.226       Server  192.168.31.226  tsim11.eoitek.com     1527567447             10001                                 1               0                    0                  -1                        -1  tsim11.eoitek.com                   0                                                                                            BMC_ComputerSystem:tsim11:eoitek.com     0                                           tsim11_1    0              0                                                                                                                                                   -
     2  192.168.31.225       Server  192.168.31.225  tsps11.eoitek.com     1527567024                 0                                 1               0                    0                  -1                        -1  tsps11.eoitek.com                   2                                                                                            BMC_ComputerSystem:tsps11:eoitek.com     0                                           tsim11_2    0              0  Windows Server 2008 R2 Standard                    6.1 Service Pack 1  VMware-42 33 84 ab e6 44 fe ef-3f aa 4a a1 d3 6d 9d d8                    -
    12   192.168.31.65       Server   192.168.31.65            tsps107     1527567024                 0                                 1               0                    0                  -1                        -1            tsps107                   2                                                                                                      BMC_ComputerSystem:tsps107     0                                          tsim11_12    0              0                            Linux  CentOS Linux release 7.0.1406 (Core)  VMware-42 33 be c3 d2 d0 66 08-a8 c3 42 85 63 3d 4c ef                    -
{"-":["tsim11.eoitek.com","tsps11.eoitek.com","tsps107"]}

3. metadata

curl -X GET 
  'https://tsim11.eoitek.com/bppmws/api/Device/tsps107/metadata?idType=name' 
  -H 'Authorization: authToken  _5a0b943d-0099-4d50-822a-fae1bea47cb4' 

{
    "response": [
        {
            "monitorTypeMetaData": [
                {
                    "attributes": [
                        {
                            "unit": "1 - OK, 2 - Failure",
                            "attributeName": "_CollectionStatus",
                            "precision": 2,
                            "kpi": false
                        }
                    ],
                    "statusCode": "200",
                    "monitorTypeName": "Network Container",
                    "statusMsg": "OK"
                },
                {
                    "attributes": [
                        {
                            "unit": "%",
                            "attributeName": "InErrorsInPercent",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "pkts",
                            "attributeName": "IncomingPackets",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "0 - Up, 1 - Down",
                            "attributeName": "Status",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "%",
                            "attributeName": "OutErrorsInPercent",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "pkts",
                            "attributeName": "PacketsOut",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "%",
                            "attributeName": "CollisionInPercent",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "%",
                            "attributeName": "BandwidthUtilization",
                            "precision": 2,
                            "kpi": true
                        },
                        {
                            "unit": "KB/sec",
                            "attributeName": "ReceiveRate",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "KB/sec",
                            "attributeName": "TransmissionRate",
                            "precision": 2,
                            "kpi": false
                        },
                        {
                            "unit": "KB/sec",
                            "attributeName": "TotalBytesPerSeconds",
                            "precision": 2,
                            "kpi": false
                        }
                    ],
                    "statusCode": "200",
                    "monitorTypeName": "Network",
                    "statusMsg": "OK"
                },
                -------------------
    ],
    "statusCode": "200",
    "statusMsg": "OK",
    "responseTimeStamp": "2018-06-12T03:14:34"
}

4. 性能数据

curl -X GET 
  'https://tsim11.eoitek.com/bppmws/api/Device/tsps107/stats?idType=Name&monitor=Kernel:FileSlotUsedPercent' 
  -H 'Authorization: authToken  _5a0b943d-0099-4d50-822a-fae1bea47cb4' 

Monitor 值用上一步的metadata获取

{
    "response": [
        {
            "monitorType": [
                {
                    "statusCode": "200",
                    "monitorTypeName": "Kernel",
                    "statusMsg": "OK",
                    "monitorInstances": [
                        {
                            "epochTime": [
                                1528773706
                            ],
                            "attributes": [
                                {
                                    "statusCode": "200",
                                    "statusMsg": "OK",
                                    "stats": [
                                        0.19
                                    ],
                                    "unit": "%",
                                    "attributeName": "FileSlotUsedPercent",
                                    "precision": 2,
                                    "kpi": false
                                }
                            ],
                            "monitorInstanceName": "Kernel"
                        }
                    ]
                }
            ],
            "statusCode": "200",
            "statusMsg": "OK",
            "resourceId": "tsps107",
            "resourceIdType": "Name",
            "resourceUniqueId": ""
        }
    ],
    "currentPageNumber": 1,
    "totalNumberOfPages": 1,
    "statusCode": "200",
    "statusMsg": "OK",
    "responseTimeStamp": "2018-06-12T03:30:13"
}

三、Im接口获取告警数据接口

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 2,731评论 0 3
  • 在iOS实际开发中常用的动画无非是以下四种:UIView动画,核心动画,帧动画,自定义转场动画。下面我们逐个介绍。...
    4b5cb36a2ee2阅读 371评论 0 0
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,027评论 19 139
  • Css动画: css3动画主要包括Transform、Transition、Animation 区别 transi...
    老头子_d0ec阅读 198评论 0 0
  • 昨日在公司做了一个经典的团队协作项目:Puzzle,实际上是一个由14块木板组成的一个体验项目。在公司把玩了之后,...
    祥祥布鲁斯阅读 469评论 0 0