閱讀666 返回首頁    go 阿裏雲 go 技術社區[雲棲]


阿裏雲ECS部署Grafana接入zabbix

Grafana接入zabbix部署

阿裏雲ECS部署Grafana接入zabbix
Grafana 是 Graphite 和 InfluxDB 儀表盤和圖形編輯器。Grafana 是開源的,功能齊全的度量儀表盤和圖形編輯器,支持 Graphite,InfluxDB 和 OpenTSDB。

關於zabbix及相關服務軟件版本:

Linux: ECS_CentOS 7.2

nginx: 1.9.15

一、購買ECS

購買一台ECS

二、安裝nginx

安裝依賴包:

yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel

創建nginx用戶:

useradd nginx -s /sbin/nologin -M

下載nginx軟件包並進入到目錄中:

wget https://nginx.org/download/nginx-1.9.15.tar.gz && tar xvf nginx-1.9.15.tar.gz && cd nginx-1.9.15

編譯:

./configure --prefix=/usr/local/product/nginx1.9.14 --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre

make && make install

ln -s /usr/local/product/nginx1.9.14 /usr/local/nginx    ==>創建軟鏈接

參數解釋:

--with-http_stub_status_module:支持nginx狀態查詢
--with-http_ssl_module:支持https
--with-http_spdy_module:支持google的spdy,想了解請百度spdy,這個必須有ssl的支持
--with-pcre:為了支持rewrite重寫功能,必須製定pcre

三、安裝Grafana

wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.3.2.linux-x64.tar.gz 
tar -zxvf grafana-4.3.2.linux-x64.tar.gz
mv grafana-4.3.2 grafana
cd grafana/bin/
#查看可以安裝的插件
./grafana-cli plugins list-remote
#安裝zabbix插件
./grafana-cli plugins install alexanderzobnin-zabbix-app
#安裝餅圖插件
./grafana-cli plugins install grafana-piechart-panel
#啟動,並後台運行
./grafana-server -homepath /opt/grafana/grafana &

四、Grafana管理網站配置(nginx):

編輯nginx虛擬主機:

[root@grafana conf]# mkdir extra
[root@grafana conf]# cd extra/
[root@grafana extra]# vim grafana.conf
server {
    listen       80;
    server_name  grafana.dtstack.com;
    access_log /data/logs/zabbix/grafana.dtstack.com.access.log main;

    location / {
        index  index.html;
    proxy_pass https://127.0.0.1:3000;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

    }
 }

編輯nginx.conf配置文件:

[root@grafana conf]# cat nginx.conf

user  nginx;
worker_processes  1;

#error_log  logs/error.log warning;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    include extra/*.conf;

}

添加/etc/hosts文件:

192.168.119.140 grafana.dtstack.com

訪問Grafana

訪問https://grafana.dtstack.com  admin/admin

五、添加數據源:

啟用zabbix插件
數據源配置 - 數據源
    Name:      zabbix
    Default:   ️
    Type:      Zabbix

    ## Http settings
    URL:     https://zabbix.dtstack.com/api_jsonrpc.php
    Access:  proxy

    ## Zabbix API details
    Username: xxxxxx
    Password: xxxxxx

最後更新:2017-06-06 13:31:23

  上一篇:go  阿裏內核月報2014年5月-06月
  下一篇:go  深入淺出 spring-data-elasticsearch 之 ElasticSearch 架構初探(一)