S小魚仔S 網誌搜尋

顯示具有 Influxdb 標籤的文章。 顯示所有文章
顯示具有 Influxdb 標籤的文章。 顯示所有文章

2017年10月26日 星期四

S小魚仔S Influxdb 搭配 Grafana 完成簡易 Web UI Admin 管理

首先「本篇」不會講解「Influxdb」和「Grafana」搭建,這是最基本的知識基礎,在一個巧合之下發現「Grafana Influx Admin」Panel,開發公司為「Natel Energy」。

「Influxdb」和「Grafana」需要搭建在「相同服務器」因為使用「localhost:8088」連線。

1. 安裝「nodes」相關「套件」

yum install nodejs -y
yum install openssl -y
npm install -g yarn
npm install -g grunt-cli

2.安裝「Grafana - influx admin」 Plugins

grafana-cli plugins install natel-influx-admin-panel

sudo systemctl restart grafana-server


3. 設定「Data Sources」


點選「+Add data Source」

1. 輸入「名稱」
2. 選擇「InfluxDB」
3. 輸入「http://localhost:8086」(Default)
4. 選擇「Proxy」
5. 輸入 InfluxDB「資料庫」
6. 輸入 InfluxDB「帳戶」、「密碼」

點選「Save & Test」

成功連結「InfluxDB」


4. 配置「DashBoard」套用「Influx Admin」插件

點選「Home」

點選「+ New DashBoard」

選擇「Influx Admin」插件

編輯「Influx Admin」插件

移動 畫面 最下面
1. 點選「Options」
2. 選擇「Query Windows」

點選「紅色圖形」就會有「UI」功能

點選「Show Databases」就可以查詢「資料庫」

2017年9月25日 星期一

S小魚仔S Influxdb 設定 Https 證書加密

1. 下載「Win32OpenSSL」產生「Private Key」(私鑰) 和「Ceritficate」(證書) 接著合併「Private Key」與「Ceritficate」。



切換「Bin」目錄夾
CD C:\OpenSSL-Win64\bin


使用「openssl.exe」產生「Private Key」
openssl genrsa -out D:\influxdb_key.pem 2048

使用「openssl.exe」導入「Private Key」 產生「csr」
openssl req -new -key D:\influxdb_key.pem -out D:\influxdb_cert.csr



合併「Private Key」 與「Ceritficate」
openssl x509 -req -days 3650 -in D:\influxdb_cert.csr -signkey D:\influxdb_key.pem -out D:\influxdb_cert_key.pem




2. 編輯「influxdb.conf」配置「加密」

編輯「vi /etc/influxdb/influxdb.conf」

啟用「加密」
https-enabled = true

載入「influxdb_cert_key.pem」( 合併 Ceritficate 與 Private Key )
https-certificate = "/opt/influxdb_cert_key.pem"

載入「Private Key」
https-private-key = "/opt/influxdb_key.pem"




#重新啟動「InfluxDB」
systemctl restart influxd

#檢查「InfluxDB」狀態
systemctl status influxd


3. 設定「Telegraf (客戶端)」使用「Https」加密傳輸

編輯「vi /etc/telegraf/telegraf.conf」

urls = ["https://192.168.8.26:8086"]

insecure_skip_verify = true

#重啟「telegraf」客戶端
systemctl restart telegraf

#檢查「telegraf」狀態
systemctl status telegraf


參考資料
「RiCo技術農場」-「Enable https for influxdb」
「RiCo技術農場」-「How to set up HTTPS with Telegraf」

2017年9月14日 星期四

S小魚仔S Centos 7 安裝 Influxdb

最近剛好在測試日誌服務器,搭建了「Influxdb」,InfluxDB是一個由 InfluxData 開發的開源時序型資料庫,它由 Go語言寫成,著力於高性能地查詢與存儲時序型數據。InfluxDB被廣泛應用於存儲系統的監控數據,IoT行業的實時數據等場景。


==修改「電腦」名稱====

hostnamectl set-hostname Influxdb

==關閉「selinux 」======
開機 不「啟用」selinux 才不會阻擋「服務連線」服務
vi /etc/sysconfig/selinux
SELINUX=disabled
reboot

==Influxdb- Firewall========

Influxdb Web 8083/TCP

#加入「防火牆」規則
sudo firewall-cmd --add-port=8083/tcp --permanent

Influxdb API 8086/TCP

#加入「防火牆」規則
sudo firewall-cmd --add-port=8086/tcp --permanent 

#重新啟動「防火牆」
sudo firewall-cmd --reload

#檢查「Firewall」設定「規則」
firewall-cmd --list-all --permanent


======InfluxDB v1.3.5 (Server)==========

#更新「yum」資料庫來源
yum install epel-release -y

#加入「influxdb」yum 資料庫來源
vi /etc/yum.repos.d/influxdb.repo

[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key

#安裝「influxdb」
sudo yum install influxdb -y

#啟動「InfluxDB」
systemctl start influxd

#開機自動啟動「InfluxDB」
systemctl enable influxdb.service


#進入「influx」設定「資料庫」
/usr/bin/influx

#建立「帳號」(admin) 和「密碼」(admin) 允許最高權限
CREATE USER "admin" WITH PASSWORD 'admin' WITH ALL PRIVILEGES

#建立「資料庫」為「collections」
CREATE DATABASE "collections"

#編輯「influxdb.conf」允許「透過」Web API 獲取數據。
PS. 可搭配「Grafana」下載「Grafana Dashboard」套用。

vi  /etc/influxdb/influxdb.conf

[http]
  enabled = true
  bind-address = ":8086"
  auth-enabled = true
  log-enabled = true
  write-tracing = false
  pprof-enabled = false
  https-enabled = false
  https-certificate = "/etc/ssl/influxdb.pem"

#重新啟動「InfluxDB」
systemctl restart influxd

#檢查「端口」服務
netstat -ltunp | grep -e 8086

參考資料