Skip to content
javalove93 edited this page Sep 11, 2014 · 1 revision

Graphite 테스트 환경 API 예제

Pilot 형태로 구축한 CollectD 및 Graphite 모니터링 정보를 가져오는 API 이다.

렌더링된 그래프 이미지 가져오기

호출 예제

http://192.168.0.3:8000/render/?width=786&height=508&_salt=1409028000.87&target=vyos.cpu.0.cpu.user.value&from=-2minutes

    이미지의 크기: width=768, height=508
    모니터링 하고자하는 항목: target=vyos.cpu.0.cpu.user.value (vyos 서버의 0번 CPU 코더의 user 사용율)
    기간: from=-2minutes (최근 2분 간). minutes, days, hours, seoncds 등을 지정할 수 있음. 제사한 내용은 쿼리 파라미터 참고

다음과 같은 렌더링된 이미지가 리턴되며 태그를 통해 화면에 표시할 수 있다.

Raw Data 가져오기

호출 예제

http://192.168.0.3:8000/render/?width=786&height=508&_salt=1409028000.87&target=vyos.cpu.0.cpu.user.value&from=-2minutes&rawData=true&format=json

    다음 부분은 이미지 가져오기 부분과 동일
    Raw Data 가져오기 활성화: rawData=true
    Raw Data의 형식: format=json (또는 csv)

위 URL을 호출하면 다음과 같은 결과가 반환된다.

[
  {
    "target": "vyos.cpu.0.cpu.user.value",
    "datapoints": [
      [
        1,
        1409720677
      ],
      [
        0,
        1409720678
      ],
      [
        0,
        1409720679
      ],
...

Clone this wiki locally