I. Principle
The principle of Zabbix monitoring MongoDB is through echo "Db.serverstatus ()" | MONGO Admin to see the status of MongoDB
Two Server Configuration
1) Add global variables for MONGO
# vim/etc/profile.d/mongo.sh
Export Path=/usr/local/mongodb/bin: $PATH
# . /etc/profile.d/mongo.sh
2) After execution you can see some status information of 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) Add the following in the Zabbix client's configuration file:
# Vim Zabbix_agentd.conf
Userparameter=mongodb.status[*],/bin/echo "Db.serverstatus (). $" | /usr/local/mongodb/bin/mongo Admin | grep "\<$2\>" | Awk-f: ' {print $$2} ' |awk-f, ' {print $$1} '
4) Restart the agent service to create a monitoring item on the web side
#/etc/init.d/zabbix-agent Restart
Three. Web-side configuration
< Span style= "FONT-SIZE:8PT;" >1) Import mongodb template (template download: 650) this.width=650; "class=" Alignnone wp-image-219 size-full "src=" http://www.mrliangqi.com/ Wp-content/uploads/2015/01/download.png "width=" height= "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) Add to host and link templates
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) Modify the details of the template monitoring items, the previous 28018 changed to the current MongoDB port can ~ Otherwise it will always alarm. Because the default monitoring port in the template is 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) In the template, select Template MongoDB template, then batch update, change to Zabbix client monitoring ~
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) After the success of the modification, you can view the latest data in the status of 1, is running ~
650) this.width=650; "class=" AlignCenter size-full wp-image-1390 "src=" http://www.mrliangqi.com/wp-content/uploads/ 2017/03/2017032707.png "width=" "height=" 282 "style=" border:5px solid rgb (235,235,235); margin-left:auto; margin-right:auto;height:auto;padding:0px; "/>
6) Complete
To view the monitoring situation:
650 ) this.width=650; "class=" AlignCenter size-full wp-image-1391 "src=" http://www.mrliangqi.com/wp-content/uploads/ 2017/03/2017032708.png "width=" "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= "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=" "height=" 603 "style=" border:5px solid rgb (235,235,235); Margin-left:auto;margin-right:auto;height: auto;padding:0px; "/>
This article from: control Penguin's Blog, permanent link:http://www.mrliangqi.com/1382.html
This article is from the "Internet&linux" blog, make sure to keep this source http://linuxsec.blog.51cto.com/10240211/1910878
Zabbix3.0.2 Monitoring MongoDB Performance status