Monitoring development with Munin customizing plugins monitoring Redis and MongoDB

Source: Internet
Author: User

It's not easy to ask the mobile phones of the monitoring group to do something!  You want to ask who they are? They are gods. Do not find them easily, because find is also white find.  


The last time because Python and Redis long brpop, the thread sleep hangs the situation, all notification alarm platform is offline. This is a perfect solution. And put him on the line. The alarms of these two companies have begun to start on my side of the interface still.


This side is changing the control of the Zabbix CMDB, so you cannot log in temporarily.   After doing well, let them engage in redis and mogodb monitoring, incredibly let me email and provide scripts and ideas what ... A think, but also to Zabbix, and write scripts, as well as the monitoring are set up on their own platform.


This time no use of the favorite ganglia, trouble.   There is no use for another graphite, but a munin. A performance monitoring page that can be accessed directly after Yum.



Official Redis monitoring and MongoDB looks like a hassle, forget it. Look directly at how they are written. The source code is written by Perl, and many of the plugins are written by the shell.



The notation is quite simple and only needs to indicate the y X axis of the slice, then echo will do it!


Below is the Redis token usage hotspot data, queue data, and MongoDB count data.


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/2E/AD/wKioL1OayeiSm67yAAZy_JZX3lI404.jpg "title=" 2014-06-13 17:48:35 screen. png "alt=" wkiol1oayeism67yaazy_jzx3li404.jpg "/>



Original: http://rfyiamcool.blog.51cto.com/1030776/1426130

location of the script: /etc/munin/plugins


To monitor MongoDB scripts:


#xiaorui .ccif [  "$"  =  "autoconf"  ]; then         echo yes        exit 0fiif [  "$"  =  "config"  ]; then        echo  ' graph_title  mongodb count mail '         echo  ' graph_args  --base 1000 -l 0 '         echo  ' graph_vlabel  Mail queue '         echo  ' graph_scale no '          echo  ' Graph_category system '          echo  ' load.label load '         echo  ' Graph_ info the load average of the machine describes how many  Processes are in the run-queue  (scheduled to run  "immediately"). '         echo  ' Load.info 5 minute load average '         exit 0fiecho -n  ' load.value  ' mongo  reportops --eval  "Db.reportops_log_mail.count ()" |tail -n1

Original: http://rfyiamcool.blog.51cto.com/1030776/1426130

Scripts to monitor Redis queues:


#xiaorui .ccif [  "$"  =  "config"  ]; then         # The host name this plugin is for.  (can be  overridden to have        # one machine  Answer for several)         # the title of  the graph        echo  ' graph_title redis  Mail '         # Arguments to  ' rrdtool graph ' .  in this case, tell it that the        #  lower limit of the graph is  ' 0 ', and that 1k=1000  (not  1024)         echo  ' graph_args --base 1000 -l  0 '         # the y-axis label        echo   ' Graph_vlabel load '         # we want cur/min /avg/max unscaled  (i.e. 0.42 load instead of         # 420 milliload)         echo  ' Graph_scale  no '         # graph category. defaults to   ' other '         echo  ' Graph_category system '          # The fields.  "Label"  is used in  the legend.  "Label"  is the only        #  required subfield.        echo  ' Load.label load '         # these two read the environment for warning  values for the field        #  "Load" .   if  "load_warning"  or  "Warning"  aren ' t set in the         # environment, no warning levels are set.   likewise for  "Load_critical"         # and  " Critical ".        print_warning load         print_critical load        # this  one is purely to add an explanation to the web page.  The first        # one is for the  graph itself, while the second one is for the field        #   "Load" .        echo  ' graph_info the load  average of the machine describes how many processes are in  the run-queue  (scheduled to run  "immediately"). '         echo  ' Load.info 5 minute load average '         # Last, if run with the  ' config "-parameter, quit here  (Don ' T        # display  any data)         exit 0fi# if not run  with any parameters at all  (Or only unknown ones), do  The# real work - i.e. display the data. almost always this will be#  "Value"  subfield for  every data field.echo -n  "load.value " redis-cli llen sendmaillist|cut  -d  '  -f2


After writing,/etc/init.d/munin-node Restart will be able to. Wait a while to refresh the next page will come out.


The key is the last two lines.

Echo-n "Load.value" redis-cli llen sendmaillist|cut-d "-f2


Someone online has done Python's munin operation module, interested friends can try.


Https://github.com/samuel/python-munin

#!/usr/bin/env pythonimport osfrom munin import muninpluginclass loadavgplugin ( Muninplugin):    title =  "Load average"     args =   "--base 1000 -l 0"     vlabel =  "Load"      scale = False    category =  "System"     @ Property    def fields (self):         warning  = os.environ.get (' Load_warn ',  10)         critical  = os.environ.get (' Load_crit ',  120)         return  [("Load",  dict (                 label =  "Load",                 info =  ' the load average of the machine describes how many  processes are in the run-queue  (scheduled to run  "immediately"). ',                 type =   "GAUGE",                 min =  "0",                 WARNING = STR (Warning),                 critical = str (Critical))]    def execute ( Self):         if os.path.exists ("/proc/loadavg"):             loadavg = open ("/proc/loadavg",  "R" ). Read (). strip (). Split ('   ')        else:             from subprocess import Popen, PIPE             output = popen (["Uptime"], stdout=pipe). Communicate () [0]             loadavg = output.rsplit (': ',  1) [1].strip (). Split ('   ') [: 3]        return dict (load= LOADAVG[1]) if __name__ ==  "__main__":     loadavgplugin (). Run ()

Original: http://rfyiamcool.blog.51cto.com/1030776/1426130


In conclusion, Munin is really simple enough, his simplicity also means that he is suitable for me such as the operation of the research and development personnel to do some statistical scenarios. Remember the previous use of Munin, at that time to do ZEROMQ statistics, more than dozens of units is no problem, of course, this is (Feihua), if dozens of have problems, then the level of monitoring is really bad enough. The limits of this thing are really big enough. Also on the temporary drawing is OK.


This article comes from "Feng Yun, on her." "blog, declined reprint!"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.