顯示文章

這裡允許您檢視這個會員的所有文章。請注意, 您只能看見您有權限閱讀的文章。


文章 - TWASA

頁: [1] 2 3 ... 9
1
幫忙補充關於 Prometheus

有人問到 scrape_interval 的設定如下最上面的是global設定,然後每個scrape_configs job也可以設定
藍色的是全域,綠色的就是只針對這個 job

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets: ['localhost:9090']

另外在 Production 環境用 Docker 起 Prometheus 與 Grafana 因為他們都有資料要儲存,所以都要用到 Volume
Prometheus 官方預設的 Docker Image後端資料是存在 /prometheus,因為他參數是 --storage.tsdb.path=/prometheus
因為需要經常改設定檔不想每次用 docker exec 進去容器,所以也會把 Prometheus 的 YAML 也都用成 Volume
這樣可以在外面改 prometheus.yml 設定,然後要讓 Prometheus 重新載入設定可以送 HUP Signal

代碼: [選擇]
docker exec <CONTAINER_ID_OR_NAME> kill -HUP 1

另一個讓Prometheus 重新讀去設定檔的做法是可以向prometheus發送 HTTP POST,不過因為官方 Docker Image 預設沒有加參數 --web.enable-lifecycle
所以要自己 Build Image 加上該參數才能這樣用

代碼: [選擇]
curl -XPOST http://<Prometheus_IP_OR_FQDN>/-/reload


今天HaWay教的是基本用的是static_configs
對於監控數量多的公司要使用支援的服務發現機制來做 dynamically discovered 監控
目前支援的服務發現機制有 DNS, kubernetes, GCE, ec2, Azure, consul, openstack .....還蠻多的可以參考

https://prometheus.io/docs/prometheus/latest/configuration/configuration/


另外 Exporter 除了用限制 IP以外,因為我們公司的架構有 API gateway 所以比如 RD開發的程式有 Exporter功能
Prometheus 也支援類似的設定如下,要給 API key 才可以 Scrape 的到資料

代碼: [選擇]
  - job_name: 'my-prod-app'
    scrape_interval: 30s
    metrics_path: /app/v1/_metrics
    params:
      apikey: ['<KEY>']
    scheme: https
    static_configs:
         - targets: ['api.example.com']

Prometheus 資料儲存,如果不給參數的話預設是15天,參數是 --storage.tsdb.retention,參考官方文件如下
https://prometheus.io/docs/prometheus/latest/storage/

另外提到的 Prometheus 做 HA 跟資料集中的三方架構的設計可以參考這裡,只不過我也還沒實作沒辦法介紹就是
https://github.com/improbable-eng/thanos/blob/master/docs/design.md

Grafana的話支援多種儲存,存放路徑在 /var/lib/grafana
其實主要是存一些設定資料 json 檔跟plugin,資料部分預設好像是SQLite ,其實量不大也可以把資料存到資料庫比如Postgresql
Grafana 的話就有帳號密碼的驗證機制了,也支援Oauth等,直接用環境變數帶入來設定很方便可以參考官方文件
http://docs.grafana.org/installation/docker/

2
之前也有查過跨 multi cloud 要怎麼集中管理 Docker container
用過最方便的方案就是Rancher了吧,k8s 也有Kubernetes Federation 不過用起來相當麻煩而且算是非常新的東西,要用到Production感覺還很遠

4
好不容易又有感興趣的活動,結果居然不是在假日 :o
要去上班得請假了

5
肉腳版 / Re: linux怎么共享笔记本的无线网
« 於: 2016-12-16 16:47 »
install and man the iwlist and iwconfig

6
慢了幾天才看到,這次活動怎麼這麼快就報名額滿了 @_@"

7
Network 討論版 / Re: 網段IP設置問題
« 於: 2015-11-17 16:14 »
你應該先把你家Network Topology畫出來搞清楚DHCP server是誰,有沒有用設備當DHCP Relay,有沒有切VLAN 設備誰跟誰串接 ;D

8
Python程式設計討論區 / Re: 費式數列
« 於: 2015-10-26 09:09 »
數學不熟,不過參考python 2.x的官方文件,就這麼幾行而已
代碼: [選擇]
n = int(raw_input("Please enter an integer: "))

a, b = 0, 1
while b < n:
    print b,
    a, b = b, a+b

9
The number of days (since January 1, 1970) since the password was last changed.

10
應該是在HP要設定Authorization才對吧,看原廠手冊有沒有寫

11
我也對這份工作有興趣,因為沒看到聯絡方式,只好用論壇的簡訊功能傳送給threeseconds

12
檢查IIS的IP and Domain Restrictions有沒有裝用這個來限制看看

13
12/14 openstack 簡介
12/21 淺談虛擬化與虛擬化雲端相關

連續兩場都是虛擬化與雲端的應用,還都是台北場 太棒了!

14
這次的活動議題很有興趣,小弟會一定會去參加

16
之前自己用的,看process記憶體用量從小排到大
ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS

17
活動/聚會區 / Re: Study-area 活動預告
« 於: 2014-04-25 23:17 »
看來是談三子自身的經驗 ;D

18
search bootsplash

19
try using mynetworks_style or mynetworks

20
整個訊息看下來就正常啟動等待連線 哪裡有錯誤 ???

21
加油~~~上就對了~

22
活動報名網址的連結好像需要修改
http://samc.study-area.org/registry/add/142

23
Network 討論版 / Re: 拜請網路高手解惑!
« 於: 2013-11-15 13:03 »
我選IIS,雖然我對他很不熟悉 ;D

24
已報名,期待精彩的分享 ;D

25
若有powershell可使用Start-Job Cmdlet

26
我的無腦寫法
ps acuxk -%cpu | head -n 11

27
因為uid跟gid一樣
更正因為/etc/passwd中的gid與oinstall的gid一樣

28
以/*   */為例
sed -si '/\/\*/,/\*\//g' filename

30
雜七雜八 / Re: 紀念一下,第8666篇文章!
« 於: 2013-06-14 13:11 »
我比較好奇當初四個6的那篇是啥 ;D

頁: [1] 2 3 ... 9