Category: Grafana

  • Grafana를 Reverse Proxy에서 사용하기

    grafana.ini 에서 다음 부분을 수정한다. root_url 에는 리버스 프록시로 제공될 주소를 적는다. 그리고 serve_from_sub_path 를 true로 변경한다. 서비스를 재시작하면 된다.

    # If you use reverse proxy and sub path specify full url (with sub path)
    ;root_url = %(protocol)s://%(domain)s:%(http_port)s/
    root_url = %(protocol)s://%(domain)s/grafana-vital/
    
    # Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
    ;serve_from_sub_path = false
    serve_from_sub_path = true

    리버스 프록시를 제공하는 nginx 에서 관련 설정을 추가한다.

    location /grafana-vital/ {
    	proxy_pass http://grafana.rcc:4000/;
    	proxy_set_header X-Real-IP $remote_addr;
    	proxy_set_header Host $host;
    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    index.html 을 수정한다.

    <p style="font-family":'Tahoma';"><a href="grafana-vital" target="_blank">Patient Monitoring System (Current)</a></p>
    
  • PostgreSQL 사용

    Grafana에서 PostgreSQL을 비롯한 여러 DB도 이용할 수 있다. 이 때 SQL 구문으로 작성하는데 Format에서 Time series를 선택하지 않으면 하나의 결과만 보일 수 있다. 시간은 오름차순으로 정렬 시켜 주어야 한다.

  • Contact point 추가

    Node-RED를 이용해서 webhook 으로 알림을 보내기 위해서는 다음과 같이 설정한다.

    Add contact point를 선택한다.

    URL은 Grafana 설치된 컨테이너에서 실행 가능한 그런 경로로 입력해야 하는 것 같다. HTTP Method에 POST를 선택한다.

  • Grafana & PostgreSQL

    Host 부분에 다른 DB와는 달리 http 같은 주소는 생략해야 한다. TLS/SSL을 이용하지 않으므로 disable 시켜준다.