具體介紹就很少說了,一個分佈式的監控系統。能夠接收各類event上報,而後經過強大的腳本和插件,展現曲線,柱狀,餅圖等來對系統進行監控。html
1、riemann安裝java
這裏主要說ubuntu的安裝:
首先,須要java、ruby環境:
sudo apt-get -y install default-jre ruby-dev build-essential
而後下載riemann的包:python
wget https://aphyr.com/riemann/riemann_0.2.8_all.deb
而後直接安裝就OK了:
sudo dpkg -i riemann_0.2.8_all.deb
採用命令就能夠啓動服務了:
sudo service riemann start
2、riemann配置git
配置文件在github
/etc/riemann/riemann.configweb
默認配置以下django
; -*- mode: clojure; -*- ; vim: filetype=clojure (logging/init {:file "/var/log/riemann/riemann.log"}) ; Listen on the local interface over TCP (5555), UDP (5555), and websockets ; (5556) (let [host "127.0.0.1"] (tcp-server {:host host}) (udp-server {:host host}) (ws-server {:host host})) ; Expire old events from the index every 5 seconds. (periodically-expire 5) (let [index (index)] ; Inbound events will be passed to these streams: (streams (default :ttl 60 ; Index all events immediately. index ; Log expired events. (expired (fn [event] (info "expired" event))))))
可使用go的client進行event的發送:ubuntu
package main import ( "github.com/bigdatadev/goryman" //"fmt" "time" "math/rand" ) func main(){ c := goryman.NewGorymanClient("localhost:5555") err := c.Connect() if err != nil { panic(err) } defer c.Close() for { rd := rand.New(rand.NewSource(time.Now().UnixNano())) err = c.SendEvent(&goryman.Event{ Host : "box1", Service: "foo", Metric: rd.Intn(1000), Tags: []string{"meter","dev"}, }) if err != nil { panic(err) } rd = rand.New(rand.NewSource(time.Now().UnixNano())) err = c.SendEvent(&goryman.Event{ Host : "box2", Service: "bar", Metric: rd.Intn(1000), Tags: []string{"meter","dev"}, }) if err != nil { panic(err) } } }
3、把riemann數據使用graphite來進行畫圖vim
因爲riemann自己提供的數據圖形化比較難弄,可是它能夠方便的只想graphite進行處理。ruby
因此,咱們裝一下graphite。
#安裝啓動graphite pip install carbonpip install whisperpip install graphite-web pip install Django pip install django-tagging
#默認安裝路徑在 /opt/graphite/目錄下
#初始化配置 PYTHONPATH=`pwd`/webapp:`pwd`/whisper python ./webapp/graphite/manage.py syncdbecho DEBUG = True > webapp/graphite/local_settings.py
#啓動web服務,web訪問界面 PYTHONPATH=`pwd`/whisper ./bin/run-graphite-devel-server.py --libs=`pwd`/webapp/ /opt/graphite/
#啓動接收數據的後臺進程
puchd config cp carbon/conf/carbon.conf.example carbon/conf/carbon.confPYTHONPATH=`pwd`/whisper ./carbon/bin/carbon-cache.py --debug start
在riemann的配置中增長一行:
; -*- mode: clojure; -*- ; vim: filetype=clojure (logging/init {:file "/var/log/riemann/riemann.log"}) ; Listen on the local interface over TCP (5555), UDP (5555), and websockets ; (5556) (let [host "127.0.0.1"] (tcp-server {:host host}) (udp-server {:host host}) (ws-server {:host host})) ; Expire old events from the index every 5 seconds. (periodically-expire 5) (let [index (index)] ; Inbound events will be passed to these streams: (streams (default :ttl 60 ; Index all events immediately. index ; Log expired events. (expired (fn [event] (info "expired" event)))))) #定義graph繪圖的host,這裏是部署在一臺機器上面的 (def graph (graphite {:host "localhost"})) ;全部的event數據都發給graph進行繪圖 (streams graph)
而後啓動go的test程序進行發送數據,就能在graphite上面看到數據了:
總結:
riemann很是靈活,但靈活的同時是學習成本的增長。你必需要學會他的配置,並且要熟悉對應的配置語言的語法和函數(固然學會以後,就很是流弊了)。
具體能夠參考它官網的howto介紹。 這裏就淺嘗輒止了,後面項目有須要再好好研究。
參考鏈接:
http://kartar.net/2014/12/an-introduction-to-riemann/
#如何配置
http://labs.amara.org/2012-07-16-metrics.html#riemann
#streams配置最重要
http://riemann.io/howto.html#running-riemann