Open API (Application)
제목 : Open API
작성자 : WhaTap Support
이메일 : support@whatap.io
날짜 : 2018-11-12
버전 : 1.0.0
설명 : 본 문서는 WhaTap 모니터링에서 제공하는 Application Monitoring의 Open API 가이드 입니다.
수집중인 모니터링 정보를 추출하여 별도로 활용하고자 하는 경우 Open API 를 통해 해당 정보를 추출할 수 있는 기능을 제공합니다. 계정 API토큰 및 프로젝트 API토큰 및 프로젝트 코드를 파라메타로 전달하여 수집된 정보를 획득할 수 있습니다.
1. Open API Token 확인
토큰은 계정 API토큰과 프로젝트 API토큰으로 구분됩니다. 계정 API 토큰은 프로젝트의 목록 정보를 취득하기 위한 용도로, 프로젝트 API 토큰은 프로젝트의 모니터링 정보를 취득하기 위한 용도로 활용됩니다.
프로젝트 코드는 프로젝트 진입 시, 화면 상단의 윈도우 또는 탭 제목에 "[{프로젝트 코드}] Cloud Application Monitoring"와 같이 표시되는 정보를 통해 확인하실 수 있습니다. API토큰을 변경하고자 하는 경우, 각 화면의 재발급 또는 토큰 재발급 버튼을 통하여 토큰을 갱신 합니다.
계정 토큰은 화면 우측 상단의 계정 이메일을 클릭하여 표시되는 계정 수정
버튼을 클릭한 후 API토큰에서 확인합니다.


프로젝트 토큰은 프로젝트 진입 후 관리 | 프로젝트 관리
메뉴를 통해 확인할 수 있습니다.

2. Open API Spec
2.1. 계정 API
프로젝트 목록 조회 등, 프로젝트의 권한 범위를 넘는 Open API의 경우 계정 API토큰을 사용하여 호출합니다.
Open API 호출 시 헤더에 포함될 내용은 다음과 같습니다.
구분 | 키 | 설정 값 | 비고 |
---|---|---|---|
헤더 |
x-whatap-token |
API토큰 |
계정 API토큰: 계정 수정 메뉴 프로젝트 API토큰: 관리 > 프로젝트 관리 메뉴 |
메타성 정보 조회용 Open API 호출 URL 입니다.
구분 | URL |
---|---|
프로젝트 목록 조회 |
|
프로젝트 맴버 목록 조회 |
https://service.whatap.io/open/api/json/project/{pcode}/members |
사용자의 그룹 목록 조회 |
|
그룹 맴버 목록 조회 |
https://service.whatap.io/open/api/json/group/{groupId}/members |
2.2. 프로젝트 API
프로젝트 권한 범위 내의 Open API의 경우 프로젝트 코드와 함께 프로젝트 API토큰을 사용하여 호출합니다.
Open API 호출 시 헤더에 포함될 내용은 다음과 같습니다.
구분 | 키 | 설정 값 | 비고 |
---|---|---|---|
헤더 |
x-whatap-token |
API토큰 |
계정 API토큰: 계정 수정 메뉴 프로젝트 API토큰: 관리 > 프로젝트 관리 메뉴 |
x-whatap-pcode |
프로젝트 코드 |
화면 윈도우 또는 탭 타이틀에서 확인 "[{프로젝트 코드}] Cloud Application Monitoring" |
2.2.2. Spot 정보 조회 URL
Spot 정보 조회용 Open API 호출 URL 입니다.
구분 | URL |
---|---|
활성화 상태의 에이전트 수 |
|
비활성화 상태의 에이전트 수 |
|
호스트 수 |
|
호스트의 CPU 코어 합 |
|
트랜잭션 수 |
|
초당 트랜잭션 수 |
|
5분간 집계된 고유 사용자 수 |
|
액티브 트랜잭션 수 |
|
평균 응답 시간 |
|
CPU 사용률 |
|
쓰레드풀 활성 쓰레드 수 |
|
쓰레드풀 큐잉 쓰레드 수 |
|
전체 DB Connection 수 |
|
활성(Active) DB Connection 수 |
|
비활성(Idle) DB Connection 수 |
|
액티브 Method 수 |
|
액티브 SQL 수 |
|
액티브 HTTP Call 수 |
|
액티브 DB Connection 수 |
|
액티브 Socket 수 |
2.2.3. 통계 정보 조회 URL
통계 정보 조회용 Open API는 시간 범위를 지정하여 호출하며, URL에 다음 항목이 포함된 경우 각 항목의 동작 방식은 다음과 같습니다.
-
시간 범위 미지정 시 최근 5분간의 정보를 조회
-
stime: 조회 시작 시간 (UNIX epoch time, millisecond)
-
etime: 조회 종료 시간 (UNIX epoch time, millisecond)
etime은 stime을 기준으로 1일을 초과할 수 없음 |
-
oids: agent 식별 ID (콤마 구분자로 복수 지정 가능)
-
URL에 "/avg"가 포함된 경우 에이전트 단위의 평균치 도출을 의미함
통계 정보 조회용 Open API 호출 URL 입니다.
2.2.4. 장기 통계 조회 URL
장기 통계 조회용 Open API의 경우 유형에 따른 시간 지정 범위를 가집니다. 시간 범위를 지정하여 호출하며, URL에 다음 항목이 포함된 경우 각 항목의 동작 방식은 다음과 같습니다.
-
stime: 조회 시작 시간 (UNIX epoch time, millisecond)
-
etime: 조회 종료 시간 (UNIX epoch time, millisecond)
구분 | 내역 |
---|---|
액티브 사용자 (1일 단위) |
https://service.whatap.io/open/api/json/visitor_d/{stime}/{etime} |
1일간 집계된 고유 사용자 통계, etime은 stime을 기준으로 31일을 초과할 수 없음 |
|
액티브 사용자 (1개월 단위) |
https://service.whatap.io/open/api/json/visitor_m/{stime}/{etime} |
1개월간 집계된 고유 사용자 통계, etime은 stime을 기준으로 365일을 초과할 수 없음 |
2.2.5. 로그 조회 URL
로그 조회용 Open API를 제공합니다. 시간 범위를 지정하여 호출하며, URL에 다음 항목이 포함된 경우 각 항목의 동작 방식은 다음과 같습니다.
-
시간 범위 미지정 시 최근 5분간의 정보를 조회
-
stime: 조회 시작 시간 (UNIX epoch time, millisecond)
-
etime: 조회 종료 시간 (UNIX epoch time, millisecond)
etime은 stime을 기준으로 1일을 초과할 수 없음 |
구분 | URL |
---|---|
Full GC 로그 |
https://service.whatap.io/open/api/json/fullgclog/{stime}/{etime} |
3. Open API 호출
Open API 호출 시에는 계정 API토큰 또는 프로젝트 코드와 프로젝트 API토큰을 헤더로 전송합니다. 본 문서에서는 curl을 통한 호출 예시를 제시합니다.
3.1. 프로젝트 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://service.whatap.io/open/api/json/projects"
- response
{
"data": [ {
"groupName": "",
"projectCode": 35,
"projectName": "APM_TEST2",
"createTime": "2018-10-19 07:17:03.774",
"lastUpdatedTime": "2018-10-19 07:46:05.167",
"status": "subscribe",
"productType": "APM",
"platform": "JAVA",
"gatewayName": "LOCAL",
"apiToken": "5**********************R"
}, {
}, (중략)
],
"accountEmail": "xxx@whatap.io",
"total": 6
}
3.2. 프로젝트 정보 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/project"
- response
{
"platform": "JAVA",
"createTime": "Tue Sep 18 08:34:27 GMT 2018", "gatewayName": "Office-OTE",
"projectCode": 1**1,
"status": "Subscribe",
"lastUpdatedTime": "Tue Sep 18 08:34:34 GMT 2018", "name": "SEO_APM",
"productType": "APM"
}
3.3. 프로젝트 맴버 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://service.whatap.io/open/api/json/project/1**1/members"
- response
{
"data": [ {
"email": "honggildong@whatap.io",
"name": "홍길동",
"typeKey": "super_admin",
"typeName": "Super Admin"
}, {
}, (중략)
],
"total": 6
}
3.4. 그룹 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://service.whatap.io/open/api/json/groups"
- response
{
"data": [ {
"groupName": "WHATAP APM",
"groupKey": "AB123KSKD*****2uasQ",
"description": "APM Group"
}, {
}, (중략)
],
"total": 3
}
3.5. 그룹 맴버 목록 조회
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" "https://service.whatap.io/open/api/json/group/AB123KSKD*****2uasQ/members"
- response
{
"data": [ {
"email": "honggildong@whatap.io",
"name": "홍길동",
"typeKey": "super_admin",
"typeName": "Super Admin"
}, {
}, (중략)
],
"total": 1
}
3.6. Spot 정보 조회
3.6.1. Active Agent
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/act_agent"
- response
5
3.6.2. Inactive Agent
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/inact_agent"
- response
1
3.6.3. Host
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/host"
- response
2
3.6.4. CPU Core
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/cpucore"
- response
16
3.6.5. 트랜잭션 수
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/txcount"
- response
469
3.6.6. TPS
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/tps"
- response
92.03
3.6.7. 액티브 사용자(5분)
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/user"
- response
1007
3.6.8. 액티브 트랜잭션
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/actx"
- response
171
3.7. 통계 데이터 조회
3.7.1. Exception
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/exception/1535554800000/1535641200000"
- response
{
"records": [
{
"oids": "[-1459620666]",
"time": 1535557500000,
"classHash": -1811136020,
"count": 14,
"service": "/account/delete/dept/daegu",
"class": "java.sql.SQLException(0)",
"serviceHash": 1900616259,
"snapSeq": "6068699991557528332",
"msg": "Sql Exception"
},
(중략)
],
"total": 2063
}
3.7.2. HTTP 외부 호출
- command
curl -w -L "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/httpc/1535554800000/1535641200000"
- response
{
"records": [
{
"Sum": 22628,
"Port": 10002,
"Url": "/remote/account/save/employee/kwangju",
"Host": "127.0.0.1",
"Max": 1815,
"Stdev": "247.95",
"Actived": 0,
"Avg": 1131,
"HostHash": -675813464,
"Min": 1002,
"Error": 0,
"Total": 20,
"UrlHash": -243814510
},
(중략)
],
"total": 4923
}
- command
curl -w -L "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/httpc/1543219200000/1543478400000/filter/host/127.0.0.1/port/10007"
- response
{
"records": [
{
"Service": "/sales/remove/unit/kwangju",
"Host": "127.0.0.1",
"HostHash": -675813464,
"Avg": 1080,
"Error": 0,
"Sum": 2411644,
"Port": 10007,
"Service_hash": -1003301916,
"Url": "/remote/account/save/employee/seoul",
"Max": 2442,
"Stdev": "159.01",
"UrlHash": 180997672,
"Total": 2233,
"Min": 1001
},
{
"Service": "/product/delete/employee/daejun",
"Host": "127.0.0.1",
"HostHash": -675813464,
"Avg": 1085,
"Error": 0,
"Sum": 2075036,
"Port": 10007,
"Service_hash": 2100205994,
"Url": "/remote/account/save/employee/pusan",
"Max": 2462,
"Stdev": "173.06",
"UrlHash": -924053750,
"Total": 1911,
"Min": 1001
},
(중략)
],
"total": 1080
}
3.7.3. SQL
- command
curl -w -L "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/sql/1535554800000/1535641200000"
- response
{
"records": [
{
"time_max": 4164,
"dbcHash": 450678784,
"db": "jdbc:mysql://localhost:3306,localhost:3310/fake", "time_min": 0,
"fetch_count": 0,
"hash": 796628118,
"fetch_time": 0,
"sql_crud": 0,
"count_total": 5224,
"count_error": 0,
"sql": "update table set x=# where key=#",
"time_sum": 581391,
"time_avg": 111,
"time_std": "240.79",
"count_actived": 0
},
(중략)
],
"total": 130
}
3.7.4. Client IP
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/remote/1535554800000/1535641200000"
- response
{
"records": [
{
"count": 86,
"city": "Winnipeg",
"country": "CA (CANADA)",
"ip": "140.193.83.68"
},
(중략)
],
"total": 1000
}
3.7.5. 트랜잭션
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/transaction/1535554800000/1535641200000"
- response
{
"records": [
{
"time_max": 44735,
"sql_fetch_time": 363,
"sql_time": 2628663,
"count": 10743,
"error": 29,
"sql_count": 22635,
"hash": -1485863373,
"sql_fetch": 6741607,
"httpc_avg": 1084,
"cpu_avg": 0,
"time_sum": 19911778,
"time_avg": 1853,
"httpc_count": 7072,
"service": "/account/save/employee/seoul",
"mem_avg": 0
},
(중략)
],
"total": 1080
}
3.7.6. Thread Count / Thread Daemon Count / Thread Peak Count / Thread Pool Count / Thread Pool Queue Count
에이전트 개별 데이터 조회 예시
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/thread_count/1536050100000/1536050700000"
- response
{
"pcode": 1234570141,
"type": "thread_count",
"stime": 1536050100000,
"etime": 1536050700000,
"interval": 300, <= data point 간격 "
data": [
{
"oname": "8080",
"oid": -1234257485,
"data": [
[
1536050100000, <= 시계열 timestamp
95.2
],
[
1536050400000,
85.3
],
[
1536050700000,
91.43
]
]
},
(중략)
{
"oname": "TC-29-96-8082",
"oid": 1482741919,
"data": [
[
1536050100000,
98.11
],
[
1536050400000,
81.44
],
[
1536050700000,
90.05
]
]
}
]
}
에이전트 평균 데이터 조회 예시
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/thread_count/1536050100000/1536050700000/avg"
- response
{
"pcode": 1234570141,
"type": "thread_count",
"stime": 1536050100000,
"etime": 1536050700000,
"interval": 300, <= data point 간격
"op": "avg",
"data": [
[
1536050100000, <= 시계열 timestamp
122.86 <= 전체 에이전트의 평균 데이터
],
[
1536050400000,
99.26
],
[
1536050700000,
109.68
]
]
}
에이전트 지정 데이터 조회 예시
- command
$ curl -L -w "\n" -H "x-whatap-token: HN8ZCGB72CK1RQOI8PQBHKIC" -H "x-whatap-pcode: 1234570141" "http://apmote.whatap.io:8080/open/api/json/thread_count/1536050100000/1536050700000/-1050048219,- 1459620666"
- response
{
"pcode": 1234570141,
"type": "thread_count",
"stime": 1536050100000,
"etime": 1536050700000,
"interval": 300,
"data": [
{
"oname": "8081",
"oid": -1050048219, <= 지정한 에이전트의 정보가 조회됨
"data": [
[
1536050100000,
97.75
],
[
1536050400000,
98
]
]
},
{
"oname": "8073",
"oid": -1459620666, <= 지정한 에이전트의 정보가 조회됨
"data": [
[
1536050100000,
137.23
],
[
1536050400000
102.53
],
[
1536050700000,
120.2
]
]
}
]
}
에이전트 지정 평균 데이터 조회 예시
- command
$ curl -L -w "\n" -H "x-whatap-token: HN8ZCGB72CK1RQOI8PQBHKIC" -H "x-whatap-pcode: 1234570141" "http://apmote.whatap.io:8080/open/api/json/thread_count/1536050100000/1536050700000/avg/- 1050048219,-1459620666"
- response
{
"pcode": 1234570141,
"type": "thread_count",
"stime": 1536050100000,
"etime": 1536050700000,
"interval": 300,
"op": "avg",
"data": [
[
1536050100000,
117.49 <= 지정한 에이전트들의 평균 지표가 조회됨
],
[
1536050400000,
100.26
],
[
1536050700000,
120.2
]
]
}
3.7.7. 액티브 사용자 (5분 단위)
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/visitor_5m/1554444000000/1554076800000"
- response
{
"data": [
[
1554444005000, <== 1시간 단위 (5*60*1000)
12
],
[
1554444010000,
12
],
(중략)
],
"pcode": 3000000079,
"stime": 1554444000000,
"etime": 1554444300000,
"total": 59
}
3.7.8. 액티브 사용자 (1시간 딘위)
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/visitor_h/1554444000000/1554454800000"
- response
{
"data": [
[
1554444000000, <== 1시간 단위 (60*60*1000)
18
],
[
1554447600000,
16
],
(중략)
],
"pcode": 3000000079,
"stime": 1554444000000,
"etime": 1554454800000,
"total": 3
}
3.8. 장기 통계 조회
3.8.1. 액티브 사용자 (1일 단위)
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/visitor_d/1554163200000/1554422400000"
- response
{
"data": [
[
1554163200000, <== 1일 단위 (24*60*60*1000)
1007
],
[
1554249600000,
1007
],
[
1554336000000,
1007
]
],
"pcode": 3000000079,
"stime": 1554163200000,
"etime": 1554422400000,
"total": 3
}
3.8.2. 액티브 사용자 (1개월 단위)
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/visitor_m/1551398400000/1554076800000"
- response
{
"data": [
{
"stime": 1535760000000, <== 월 1일 시각 (24*60*60*1000)
"etime": 1538352000000,
"sdate": "Sat Sep 01 00:00:00 GMT 2018",
"edate": "Mon Oct 01 00:00:00 GMT 2018",
"mau": 1007
},
{
"stime": 1538352000000,
"etime": 1541030400000,
"sdate": "Mon Oct 01 00:00:00 GMT 2018",
"edate": "Thu Nov 01 00:00:00 GMT 2018",
"mau": 1007
}
],
"pcode": 1234570141,
"stime": 1535760000000,
"etime": 1541030400000,
"sdate": "Sat Sep 01 00:00:00 GMT 2018",
"edate": "Thu Nov 01 00:00:00 GMT 2018",
"total": 2
}
3.9. 로그 데이터 조회
3.9.1. Full GC Log
- command
$ curl -L -w "\n" -H "x-whatap-token: J************************A" -H "x-whatap-pcode: 1**1" "https://service.whatap.io/open/api/json/fullgclog/1538983800000/1539104400000"
- response
{
"pcode": 1,
"stime": 1538983800000,
"etime": 1539070200000,
"data": [
{
"oid": 832254513,
"oname": "SEO2",
"count": [
[
1538983800000,
1
]
], "logs": [
"2018-10-08T16:33:09.001-0900: 79.812: [Full GC (System.gc()) 47269K->14801K(448000K), 0.0537298 secs]"
] },
{
"oid": -1453518268,
"oname": "0-1-9780-seo",
"count": [
[
1538983800000,
2
]
],
"logs": [
"2018-10-08T16:32:57.009-0900: 32.382: [Full GC (System.gc()) 26874K->14816K(94720K), 0.0463841 secs]",
"2018-10-08T16:33:02.435-0900: 37.807: [Full GC (System.gc()) 15040K->13556K(94720K), 0.0557387 secs]"
]
}
]
}