vigilant分布式監(jiān)控系統(tǒng)
vigilant(原名 Watchy)是一個分布式的系統(tǒng),用于監(jiān)控應(yīng)用程序和服務(wù)器。該系統(tǒng)非常簡單和易于管理。Watchy 提供一個分布式的架構(gòu)和每個服務(wù)器之間守護(hù)進(jìn)程的通訊,通過 UDP 獲取不同服務(wù)器上的數(shù)據(jù)并在同一個面板上顯示。
工作原理
Watchy 使用應(yīng)用/事件驅(qū)動模型,如下圖所示:
而且整個系統(tǒng)是腳本化的,可通過 Python 或者 C/C++ 來進(jìn)行操作。但首先要啟動服務(wù)器:
$ /usr/local/bin/watchy.py --help Usage: watchy.py [options]Options: -h, --help show this help message and exit -v, --version Print version -c CONFIG, --config=CONFIG Config file location -F, --fork Fork as daemon
然后通過下列命令運(yùn)行服務(wù)器
$ /usr/local/bin/watchy.py -c /etc/watchy/example-watchy.cfg WATCHY INFO - Starting StatsAggregator on 0.0.0.0:7878 WATCHY INFO - Starting Async Backend handler WATCHY INFO - WSGIServer:[gevent] starting http://0.0.0.0:8787/ ...
現(xiàn)在可以啟動監(jiān)控成員
>>> import pywatchy
# hostname and port of watchy server
>>> daemon = pywatchy.WatchyDaemon ('localhost', 7878)
# Creates or attaches to existing daemon on the server
>>> daemon.watchHost ('hostname')
# tell the daemon to watch the host server for statistics and post under specified key ('hostname')
啟動和停止進(jìn)程:
>>> daemon.watchPid ('watchyserver', 14293) # watch the python web app
>>> daemon.postMessage ('test', 'Hello World')
>>> daemon.stopWatchPid (14293) # stop watching in
這些操作都是實(shí)時而動態(tài)的.
評論
圖片
表情
