监控开发之用munin来自定义插件监控redis和mongodb

监控mongodb的脚本:

#xiaorui.ccif[“$1″=”autoconf”];thenechoyesexit0fiif[“$1″=”config”];thenecho’graph_titlemongodbcountmail’echo’graph_args–base1000-l0’echo’graph_vlabelmailqueue’echo’graph_scaleno’echo’graph_categorysystem’echo’load.labelload’echo’graph_infoTheloadaverageofthemachinedescribeshowmanyprocessesareintherun-queue(scheduledtorun”immediately”).’echo’load.info5minuteloadaverage’exit0fiecho-n”load.value”mongoreportops–eval”db.reportops_log_mail.count()”|tail-n1

原文:

监控redis队列的脚本:

#xiaorui.ccif[“$1″=”config”];then#Thehostnamethispluginisfor.(Canbeoverriddentohave#onemachineanswerforseveral)#Thetitleofthegraphecho’graph_titleredismail’#Argumentsto”rrdtoolgraph”.Inthiscase,tellitthatthe#lowerlimitofthegraphis’0′,andthat1k=1000(not1024)echo’graph_args–base1000-l0’#TheY-axislabelecho’graph_vlabelload’#WewantCur/Min/Avg/Maxunscaled(i.e.0.42loadinsteadof#420milliload)echo’graph_scaleno’#Graphcategory.Defaultsto’other’echo’graph_categorysystem’#Thefields.”label”isusedinthelegend.”label”istheonly#requiredsubfield.echo’load.labelload’#Thesetworeadtheenvironmentforwarningvaluesforthefield#”load”.If”load_warning”or”warning”aren’tsetinthe#environment,nowarninglevelsareset.Likewisefor”load_critical”#and”critical”.print_warningloadprint_criticalload#Thisoneispurelytoaddanexplanationtothewebpage.Thefirst#oneisforthegraphitself,whilethesecondoneisforthefield#”load”.echo’graph_infoTheloadaverageofthemachinedescribeshowmanyprocessesareintherun-queue(scheduledtorun”immediately”).’echo’load.info5minuteloadaverage’#Last,ifrunwiththe”config”-parameter,quithere(don’t#displayanydata)exit0fi#Ifnotrunwithanyparametersatall(oronlyunknownones),dothe#realwork-i.e.displaythedata.Almostalwaysthiswillbe#”value”subfieldforeverydatafield.echo-n”load.value”redis-cliLLENsendmaillist|cut-d”-f2

写完了后,/etc/init.d/munin-node restart 就可以了。等一会刷新下页面就出来了。

关键就是最后那两行。。

echo-n”load.value”redis-cliLLENsendmaillist|cut-d”-f2

网上有人做了python的munin操作模块,有兴趣的朋友可以试试。

你的选择是做或不做,但不做就永远不会有机会

监控开发之用munin来自定义插件监控redis和mongodb

相关文章:

你感兴趣的文章:

标签云: