日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
在Ubuntu16.04上如何安裝和使用服務(wù)器監(jiān)控報(bào)警系統(tǒng)Shinken
Shinken是一個(gè)用Python實(shí)現(xiàn)的開源的主機(jī)和網(wǎng)絡(luò)監(jiān)控框架,并與Nagios like兼容,它可以運(yùn)行在所有支持Python程序的操作系統(tǒng)上,比如說(shuō)Linux、Unix和Windows。 ,,以下是在Ubuntu 16.04上安裝和使用服務(wù)器監(jiān)控報(bào)警系統(tǒng)Shinken的步驟: ,1. 安裝Shinken服務(wù)器,2. 安裝Shinken客戶端,3. 配置Shinken客戶端

在Ubuntu 16.04上安裝和使用服務(wù)器監(jiān)控報(bào)警系統(tǒng)Shinken

你所需要的網(wǎng)站建設(shè)服務(wù),我們均能行業(yè)靠前的水平為你提供.標(biāo)準(zhǔn)是產(chǎn)品質(zhì)量的保證,主要從事成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、企業(yè)網(wǎng)站建設(shè)、成都手機(jī)網(wǎng)站制作、網(wǎng)頁(yè)設(shè)計(jì)、成都品牌網(wǎng)站建設(shè)、網(wǎng)頁(yè)制作、做網(wǎng)站、建網(wǎng)站。創(chuàng)新互聯(lián)擁有實(shí)力堅(jiān)強(qiáng)的技術(shù)研發(fā)團(tuán)隊(duì)及素養(yǎng)的視覺設(shè)計(jì)專才。

Shinken是一個(gè)開源的服務(wù)器監(jiān)控報(bào)警系統(tǒng),它可以幫助您實(shí)時(shí)監(jiān)控服務(wù)器的性能指標(biāo),并在出現(xiàn)異常時(shí)發(fā)送通知,本文將介紹如何在Ubuntu 16.04上安裝和使用Shinken。

安裝依賴

在使用Shinken之前,我們需要先安裝一些依賴庫(kù),打開終端,輸入以下命令:

sudo apt-get update
sudo apt-get install -y python3-pip python3-dev librsvg2-bin libcairo2-dev libffi-dev python3-setuptools

安裝Shinken

接下來(lái),我們將安裝Shinken,使用pip安裝Shinken的Python客戶端:

pip3 install git+https://github.com/shinken-monitoring/shinken.git@masteregg=shinken

創(chuàng)建一個(gè)名為shinken.conf的配置文件,并添加以下內(nèi)容:

[DEFAULT]
host = localhost
port = 8080
user = admin
password = my_password
ssl = False
auth = True
token = my_token
fromemail = my_email@example.com
toemail = my_email@example.com
smtpserver = smtp.example.com:587
smtpusername = my_username
smtppassword = my_password

請(qǐng)根據(jù)您的實(shí)際情況修改配置文件中的相關(guān)參數(shù),保存文件后,啟動(dòng)Shinken服務(wù):

python3 -m shinken.Shinken --config=shinken.conf --daemonize=no --reload=yes --debug=no --loglevel=info --pidfile=/var/run/shinken.pid --logfile=/var/log/shinken.log --dbtype=sqlite3 --dbpath=/var/lib/shinken.sqlite3 --cachepath=/var/lib/shinken.cache --workername=my_worker --workermodule=my_worker_module --workerinterval=30s --workertimeout=30s --workerconcurrency=100 --workerpoolsize=100 --workerpooltimeout=5s --workerpoolttl=1h --workerpoolmaxjobs=100000 --workerpoolminjobs=1000 --workerpoolmaxqueuesize=10000 --workerpoolminqueuesize=1000 --workerpoolpriority=10 --workerpoolprefetchcount=1 --workerpoolprefetchperiod=1s --routername=my_router --routermodule=my_router_module --routerinterval=30s --routertimeout=30s --routerconcurrency=100 --routerpoolsize=100 --routerpooltimeout=5s --routerpoolttl=1h --routerpoolmaxjobs=100000 --routerpoolminjobs=1000 --routerpoolmaxqueuesize=10000 --routerpoolminqueuesize=1000 --routerpoolpriority=10 --routerpoolprefetchcount=1 --routerpoolprefetchperiod=1s --schedulername=my_scheduler --schedulermodule=my_scheduler_module --scheduleridletimeout=3s --scheduleridlethreshold=5s --schedulerretryinterval=3s --schedulerretrycountdown=5s --schedulerretrymaxattempts=5s --schedulerretrydelaysecs=5s --schedulerretryjitterfactor=2.0 --scheduleridletimeout=3s --scheduleridlethreshold=5s --schedulerretryinterval=3s --schedulerretrycountdown=5s --schedulerretrymaxattempts=5s --schedulerretrydelaysecs=5s --schedulerretryjitterfactor=2.0
三、配置報(bào)警規(guī)則
在Shinken中,您可以設(shè)置各種報(bào)警規(guī)則,以便在出現(xiàn)異常時(shí)及時(shí)收到通知,編輯shinken.conf文件,添加以下內(nèi)容:

[DEFAULT]

…其他配置項(xiàng)保持不變…

alerting = enabled

alerting_method = webhook 可以是webhook、email、telegram等,具體取決于您選擇的報(bào)警方式

alerting_webhook = https://your-webhook-url.com 請(qǐng)?zhí)鎿Q為您自己的Webhook URL

alerting_email = your@email.com 請(qǐng)?zhí)鎿Q為您自己的郵箱地址

alerting_telegram = 請(qǐng)?zhí)鎿Q為您自己的Telegram機(jī)器人令牌(可選)

alerting_options = {} 根據(jù)需要添加其他選項(xiàng)(可選)

四、測(cè)試報(bào)警功能
現(xiàn)在,我們已經(jīng)完成了Shinken的安裝和配置,可以開始測(cè)試報(bào)警功能了,啟動(dòng)Shinken服務(wù):

python3 -m shinken.Shinken –config=shinken.conf –daemonize=no –reload=yes –debug=no –loglevel=info –pidfile=/var/run/shinken.pid –logfile=/var/log/shinken.log –dbtype=sqlite3 –dbpath=/var/lib/shinken.sqlite3 –cachepath=/var/lib/shinken.cache

接下來(lái),創(chuàng)建一個(gè)名為test_metric的監(jiān)控指標(biāo):

curl -X POST -d ‘{"module": "test", "action": "set", "params": {"value": 42}}’ http://localhost:8080/api/v1/metrics?format=’json’&auth_token=’my_token’&auth_user=’admin’&auth_pass=’my_password’&prettyprint=’false’&verify=’true’ &headers={‘Accept’: ‘*/*’,’Connection’: ‘keep-alive’,’Content-Length’: ‘9’,’Content-Type’: ‘application/json’,’Host’: ‘localhost’,’Origin’: ‘http://localhost:8080′,’Referer’: ‘http://localhost:8080′,’User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36’}

現(xiàn)在,我們可以查看監(jiān)控指標(biāo)的值是否正確更新:

curl -X GET http://localhost:8080/api/v1/metrics?auth_token=’my_token’&auth_user=’admin’&auth_pass=’my_password’&prettyprint=’false’&verify=’true’ &headers={‘Accept’: ‘*/*’,’Connection’: ‘keep-alive’,’Content-Length’: ‘9’,’Content-Type’: ‘application/json’,’Host’: ‘localhost’,’Origin’: ‘http://localhost:8080′,’Referer’: ‘http://localhost:8080′,’User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36’} | jq ‘.[] | select(.module == "test") | .value’ | tr -d ‘"’ | echo "監(jiān)控指標(biāo)值:$(cat)" && curl -X GET http://localhost:8080/api/v1/metrics?auth_token=’my_token’&auth_user=’admin’&auth_pass=’my_password’&prettyprint=’false’&verify=’true’ &headers={‘Accept’: ‘*/*’,’Connection’: ‘keep-alive’,’Content-Length’: ‘9’,’Content-Type’: ‘application/json’,’Host’: ‘localhost’,’Origin’: ‘http://localhost:8080′,’Referer’: ‘http://localhost:8080′,’User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36’} | jq ‘.[] | select(.module == "test") | .value’ | tr -d ‘"’ | echo "監(jiān)控指標(biāo)值:$(cat)" && curl -X POST -d ‘{"module": "test", "action": "set", "params": {"value": 43}}’ http://localhost:8080/api/v1/metrics?format=’json’&auth_token=’my_token’&auth_user=’admin’&auth_pass=’my_password’&prettyprint=’false’&verify=’true’ &headers={‘Accept’: ‘*/*’,’Connection’: ‘keep-alive’,’Content-Length’: ‘9’,’Content-Type’: ‘application/json’,’Host’: ‘


新聞標(biāo)題:在Ubuntu16.04上如何安裝和使用服務(wù)器監(jiān)控報(bào)警系統(tǒng)Shinken
本文URL:http://www.dlmjj.cn/article/dhhdjss.html