Zabbix3.0.2監控Mongodb效能狀態

來源:互聯網
上載者:User

標籤:command   設定檔   version   伺服器   insert   

一.原理

Zabbix監控mongodb的原理是通過echo "db.serverStatus()" | mongo admin 來查看mongodb的狀態

二.伺服器配置

1)添加mongo的全域變數

# vim /etc/profile.d/mongo.sh

export PATH=/usr/local/mongodb/bin:$PATH

# . /etc/profile.d/mongo.sh

2)執行之後可以看到mongodb一些狀態資訊

# echo "db.serverStatus().opcounters" | mongo admin

MongoDB shell version: 3.2.7

connecting to: admin

{

    "insert" : 0,

    "query" : 0,

    "update" : 0,

    "delete" : 0,

    "getmore" : 0,

    "command" : 594338669

}

Bye

3)在zabbix 用戶端的設定檔中添加以下內容:

# vim zabbix_agentd.conf

UserParameter=MongoDB.Status[*],/bin/echo "db.serverStatus().$1" | /usr/local/mongodb/bin/mongo admin | grep "\<$2\>"| awk -F : ‘{print $$2}‘|awk -F , ‘{print $$1}‘

4)重啟agent服務,在web端建立監控項

# /etc/init.d/zabbix-agent  restart

三.web端配置

1)匯入Mongodb的模版(模版下載:650) this.width=650;" class="alignnone wp-image-219 size-full" src="http://www.mrliangqi.com/wp-content/uploads/2015/01/Download.png" width="85" height="29" style="border:5px solid rgb(235,235,235);height:auto;padding:0px;" />)

650) this.width=650;" class="aligncenter size-full wp-image-1383" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032701.png" width="493" height="507" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />650) this.width=650;" class="aligncenter size-full wp-image-1384" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032702.png" width="904" height="364" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />

2)添加到主機並連結模版

650) this.width=650;" class="aligncenter size-full wp-image-1386" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032703.png" width="819" height="368" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />

3)修改模版監控項中的詳細資料,把之前28018改成現在mongodb的連接埠即可~ 否則會一直警示。因為模版中預設監控的的連接埠是28018.

650) this.width=650;" class="aligncenter size-full wp-image-1387" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032704.png" width="791" height="649" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />

4)在模版中,選擇Template MongoDB模版,然後批次更新,改成zabbix用戶端監控~

650) this.width=650;" class="aligncenter size-full wp-image-1388" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032705.png" width="565" height="504" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />

650) this.width=650;" class="aligncenter size-full wp-image-1389" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032706.png" width="674" height="487" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />

5)修改成功之後,可以在最新資料中查看狀態為1,就是運行中~

650) this.width=650;" class="aligncenter size-full wp-image-1390" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032707.png" width="1200" height="282" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />

6)完成

查看監控情況:

650) this.width=650;" class="aligncenter size-full wp-image-1391" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032708.png" width="1200" height="649" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />650) this.width=650;" class="aligncenter size-full wp-image-1392" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032709.png" width="1200" height="575" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />650) this.width=650;" class="aligncenter size-full wp-image-1393" src="http://www.mrliangqi.com/wp-content/uploads/2017/03/2017032710.png" width="1200" height="603" style="border:5px solid rgb(235,235,235);margin-left:auto;margin-right:auto;height:auto;padding:0px;" />

本文來自:控企鵝的‘Blog,永久連結:http://www.mrliangqi.com/1382.html


本文出自 “Internet&Linux” 部落格,請務必保留此出處http://linuxsec.blog.51cto.com/10240211/1910879

Zabbix3.0.2監控Mongodb效能狀態

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.