서버
Open API Spec
계정 API
프로젝트 목록 조회와 같이 프로젝트의 권한 범위를 넘는 Open API의 경우 계정 API 토큰을 사용하여 호출합니다.
Open API 호출 시 헤더에 포함될 내용은 다음과 같습니다.
구분 | 키 | 설정값 | 비고 |
---|---|---|---|
헤더 |
x-whatap-token |
API 토큰 |
계정 API 토큰: 계정 수정 메뉴 프로젝트 API 토큰: 관리 > 프로젝트 관리 메뉴 |
메타성 정보 조회용 Open API 호출 URL입니다.
구분 | URL |
---|---|
프로젝트 목록 조회 |
https://api.whatap.io/open/api/json/projects |
프로젝트 멤버 목록 조회 |
https://api.whatap.io/open/api/json/project/{pcode}/members |
사용자의 그룹 목록 조회 |
https://api.whatap.io/open/api/json/groups |
그룹 멤버 목록 조회 |
https://api.whatap.io/open/api/json/group/{groupId}/members |
프로젝트 API
프로젝트 권한 범위 내의 Open API의 경우 프로젝트 코드와 함께 프로젝트 API 토큰을 사용하여 호출합니다.
Open API 호출 시 헤더에 포함될 내용은 다음과 같습니다.
구분 | 키 | 설정값 | 비고 |
---|---|---|---|
헤더 |
x-whatap-token |
API 토큰 |
계정 API 토큰: 계정 수정 메뉴 프로젝트 API 토큰: 관리 > 프로젝트 관리 메뉴 |
x-whatap-pcode |
프로젝트 코드 |
화면 윈도우 또는 탭 타이틀에서 확인 "[{프로젝트 코드}] Cloud Application Monitoring" |
메타 정보 조회 URL
메타성 정보 조회용 Open API 호출 URL입니다.
구분 | URL |
---|---|
프로젝트 정보 및 상세 서버 조회 |
https://service.whatap.io/open/json/project |
Spot 정보 조회 URL
Spot 정보 조회용 Open API 호출 URL입니다.
구분 | URL |
---|---|
활성화 상태의 에이전트 수 |
https://service.whatap.io/open/json/act_agent |
비활성화 상태의 에이전트 수 |
https://service.whatap.io/open/json/inact_agent |
호스트 수 |
https://service.whatap.io/open/json/host |
호스트의 CPU 코어 합 |
https://service.whatap.io/open/json/cpucore |
CPU 사용률 |
https://service.whatap.io/open/json/infra_cpu |
디스크 IOPS 합계 |
https://service.whatap.io/open/json/infra_disk_iops |
네트워크 트래픽(IN/OUT) 합산 |
https://service.whatap.io/open/json/infra_net_traffic |
프로세스 현황 |
https://service.whatap.io/open/json/sm_proc |
서버 목록 |
https://service.whatap.io/open/json/sm_servers |
서버 모니터링 상세 |
https://service.whatap.io/open/json/sm |
서버 통계 상세 |
https://service.whatap.io/open/json/stat/sm_stat |
Open API 호출
Open API 호출 시에는 계정 API 토큰 또는 프로젝트 코드와 프로젝트 API 토큰을 헤더로 전송합니다. 본 문서에서는 curl을 통한 호출 예시를 제시합니다.
프로젝트 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://api.whatap.io/open/api/json/projects"
- response
{
"data": [ {
"groupName": "",
"projectCode": ****,
"projectName": "SERVER_TEST",
"createTime": "2018-10-19 07:17:03.774",
"lastUpdatedTime": "2018-10-19 07:46:05.167",
"status": "subscribe",
"productType": "SMS",
"platform": "INFRA",
"gatewayName": "LOCAL",
"apiToken": "5**********************R"
}, {
}, (중략)
],
"accountEmail": "xxx@whatap.io",
"total": 6
}
프로젝트 정보 및 상세 서버 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/json/project"
- response
{
"pname":"LOCAL_PC",
"timezone":9,
"regionName":"LOCAL",
"values":{
"servers":[
{
"public_ip":"192.168.1.0",
"os_cpuvendor":"Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz",
"agent_created":"1572406071216",
"ip":"192.168.1.0",
"os_arch":"amd64",
"actTime":1572406264112,
"cpu_cores":"8",
"oid":-1030311093,
"isActive":true,
"okind":"",
"version":"1.2.4",
"tags":[
"network:169.254.0.0/16",
"network:192.168.1.0/24",
"java",
"OpenVpn",
"oracle",
"ftp"
],
"inactTime":0,
"oname":"DESKTOP-KEIPLT5",
"os_name":"windows",
"startTime":1572406263602,
"os_memory":"17036419072",
"os_status":"warning"
},
(중략)
프로젝트 멤버 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://api.whatap.io/open/api/json/project/1**1/members"
- response
{
"data": [ {
"email": "honggildong@whatap.io",
"name": "홍길동",
"typeKey": "super_admin",
"typeName": "Super Admin"
}, {
}, (중략)
],
"total": 6
}
그룹 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://api.whatap.io/open/api/json/groups"
- response
{
"data": [ {
"groupName": "WHATAP APM",
"groupKey": "AB123KSKD*****2uasQ",
"description": "APM Group"
}, {
}, (중략)
],
"total": 3
}
그룹 멤버 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://api.whatap.io/open/api/json/group/AB123KSKD*****2uasQ/members"
- response
{
"data": [ {
"email": "honggildong@whatap.io",
"name": "홍길동",
"typeKey": "super_admin",
"typeName": "Super Admin"
}, {
}, (중략)
],
"total": 1
}
활성화 상태의 에이전트 수
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/act_agent"
- response
{"pname":"LOCAL_INFRA","values":"57.0"}
비활성화 상태의 에이전트 수
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/inact_agent"
- response
{"pname":"LOCAL_INFRA","values":"4.0"}
호스트 수
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/host"
- response
{"pname":"LOCAL_INFRA","values":"57.0"}
호스트의 CPU 코어 합
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/cpucore"
- response
{"pname":"LOCAL_INFRA","values":"108.0"}
CPU 사용률
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/infra_cpu"
- response
{
"pname": "LOCAL_INFRA",
"values": {
"s-p-gtw-03": 2.802803,
"t-a-yrd-01": 8.709015,
(중략)
}
}
디스크 IOPS 합계
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/infra_disk_iops"
- response
{
"pname":"LOCAL_INFRA",
"values":{
"s-a-yrd-01-1": {
"bps": 4447.892,
"iops": 0.77481234
},
"h-i-yrd-02": {
"bps": 6203241.5,
"iops": 396.4099
},
(중략)
}
}
네트워크 트래픽(IN/OUT) 합산
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/infra_net_traffic"
- response
{
"pname":"LOCAL_INFRA",
"values":{
"s-p-gtw-03": 4487137.014340188,
"t-a-yrd-01": 2500277.566511181,
(중략)
}
}
프로세스 현황
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/sm_proc"
- response
{
"pname":"LOCAL_INFRA",
"values":{
"s-p-gtw-03": [
{
"memoryBytes": 1274269696,
"bps": 819.2,
"cmd1": "java",
"cpu": 2.8507125
},
{
"memoryBytes": 2895872,
"bps": 0,
"cmd1": "rsyslogd",
"cpu": 0
},
(중략)
],
"t-a-yrd-01": [
{
"memoryBytes": 2583621632,
"bps": 1175961.5,
"cmd1": "java",
"cpu": 10.621243
},
(중략)
],
(중략)
}
}
서버 목록
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/sm_servers"
- response
{
"pname":"LOCAL_INFRA",
"values":[
{
"os.status": "ok",
"oname": "h-db-prx-01",
"os.name": "linux",
"oid": -1359816680,
"isActive": true
},
{
"os.status": "ok",
"oname": "h-db-prx-02",
"os.name": "linux",
"oid": 1745981315,
"isActive": true
},
(중략)
]
}
서버 모니터링 상세
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/sm"
- response
{
"pname":"LOCAL_INFRA",
"values":{
"servers": [
{
"public_ip": "192.168.0.1",
"os_cpuvendor": "Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz",
"agent_created": "49572130779",
"ip": "127.0.0.1,10.128.0.1",
"os_arch": "amd64",
"actTime": 1570672662216,
"cpu_cores": "1",
"oid": -1359816680,
"isActive": true,
"version": "1.2.5",
"tags": [
"gateway",
"python",
"network:10.0.0.0/8",
"@PRX"
],
"inactTime": 0,
"oname": "h-db-prx-01",
"os_name": "linux",
"startTime": 1570672662000,
"os_memory": "2088476672",
"os_status": "ok",
"snapshot": {
"disk": {
"/boot": {
"writeIops": 0,
"fileSystem": "ext4",
"mountPoint": "/boot",
"queueLength": 0,
"usedSpace": 58863616,
"blksize": 4096,
"freeSpace": 841175040,
"display": true,
"count": 1,
"readBps": 0,
"totalSpace": 966778880,
"ioPercent": 0,
"mountOption": "rw,relatime",
"deviceId": "/dev/sda1",
"usedPercent": 6.540122985839844,
"freePercent": 93.45987701416016,
"writeBps": 0,
"readIops": 0
},
"/home": {
"writeIops": 0,
"fileSystem": "ext4",
"mountPoint": "/home",
"queueLength": 0,
"usedSpace": 1670574080,
"blksize": 4096,
"freeSpace": 69533446144,
"display": true,
"count": 1,
"readBps": 0,
"totalSpace": 75039498240,
"ioPercent": 0,
"mountOption": "rw,relatime",
"deviceId": "/dev/sda3",
"usedPercent": 2.3461761474609375,
"freePercent": 97.65382385253906,
"writeBps": 0,
"readIops": 0
},
"/": {
"writeIops": 0,
"fileSystem": "ext4",
"mountPoint": "/",
"queueLength": 0,
"usedSpace": 5079060480,
"blksize": 4096,
"freeSpace": 22798901248,
"display": true,
"count": 1,
"readBps": 0,
"totalSpace": 29394726912,
"ioPercent": 0,
"mountOption": "rw,relatime",
"deviceId": "/dev/sda2",
"usedPercent": 18.218902587890625,
"freePercent": 81.78109741210938,
"writeBps": 0,
"readIops": 0
}
},
"memory": {
"shared": 21590016,
"swapused": 0,
"buffers": 182550528,
"available": 1746370560,
"swaptotal": 0,
"used": 342106112,
"pused": 16.380653381347656,
"slab": 85729280,
"total": 2088476672,
"sunreclaim": 23261184,
"cached": 521756672,
"pavailable": 83.61934661865234,
"pagefaults": 0,
"sreclaimable": 62468096,
"free": 1167208448,
"swappused": 0
},
"cpu": {
"softirq": 0,
"usr": 0,
"idle": 100,
"steal": 0,
"irq": 0,
"load5": 0,
"iowait": 0,
"sys": 0,
"nice": 0,
"load1": 0,
"load15": 0
},
"open_filedescriptors": 249,
"netstat": {
"established": 1,
"syn_sent": 1,
"syn_recv": 0,
"closing": 0,
"time_wait": 19,
"last_ack": 0,
"fin_wait1": 0,
"close_wait": 0,
"fin_wait2": 0,
"listen": 3,
"unknown": 0
},
"uptime": 16313689,
"network": {
"lo": {
"errorOut": 0,
"packetOut": 0.3991734786600438,
"trafficIn": 281.0181289766709,
"trafficOut": 281.0181289766709,
"hwAddr": "",
"errorIn": 0,
"ip": "127.0.0.1",
"count": 1,
"droppedIn": 0,
"droppedOut": 0,
"packetIn": 0.3991734786600438,
"desc": "lo"
},
"eth0": {
"errorOut": 0,
"packetOut": 8.1830563125309,
"trafficIn": 11314.173079140282,
"trafficOut": 19447.731880317337,
"hwAddr": "00:1d:d8:b7:87:18",
"errorIn": 0,
"ip": "10.128.112.133",
"count": 1,
"droppedIn": 0,
"droppedOut": 0,
"packetIn": 24.549168937592693,
"desc": "eth0"
}
}
}
},
(중략)
],
"max": {
"disk": {
"writeIops": 240.9893,
"usedPercent": 94.38699,
"freePercent": 100,
"usedSpace": 2.46495681E+12,
"freeSpace": 0,
"writeBps": 2917852,
"readBps": 118646.15,
"readIops": 75.80727,
"totalSpace": 9.223372E+18,
"ioPercent": 100,
"freespace": 1.58926471E+11
},
"nic": {
"errorOut": 0,
"packetOut": 2175.8743,
"trafficIn": 4856648,
"trafficOut": 2503208.8,
"errorIn": 1,
"droppedIn": 1,
"droppedOut": 0,
"packetIn": 2175.8743
},
"compound_eye_traffic": 1000000000
},
"count": {
"total": 14,
"paused": 0,
"inactive": 0,
"warning": 1,
"ok": 13,
"close": 0,
"fatal": 0
},
"tags": {
(생략)
}
}
}
서버 통계 상세
- command
$ curl -w "\n" -H "x-whatap-pcode: 1" -H "x-whatap-token: Y**********************U" "https://service.whatap.io/open/json/stat/sm_stat?stime=시작UTC&etime=종료UTC&filter=m5&oid=0" [parameter 설명] 1. oid : 특정 서버만 모니터링을 원할시에 추가 2. (*)stime : 시작 시간 UTC 3. (*)etime : 종료 시간 UTC 4. filter : 기본적으로 m5 가 지동으로 지정. 시간 범위 내에 5분 통계를 가지고 올때 m5 사용 5초 통계는 s5 , 1시간 통계는 h1 사용
- response
{
"servers":[
{
"oid":-1030311093 ,
"timeData":[
"
{
"usedPercent":69.1,
"trafficIn":12113.57,
"trafficOut":24781.08,
"cpu":4.08,
"memory_swappused":15.41,
"time":1572341400000,
"memory_pused":47.6,
"ioPercent":0.26
},
{
"usedPercent":69.1,
"trafficIn":12183.97,
"trafficOut":25600.59,
"cpu":7.89,
"memory_swappused":15.5,
"time":1572341700000,
"memory_pused":47.79,
"ioPercent":0.22
},
(생략)
],
} ,
(중략)
]
}