Ad Widget

Collapse

Another way to monitor mongodb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sturi
    Junior Member
    • Mar 2016
    • 10

    #1

    Another way to monitor mongodb

    Hi everyone.

    We were looking for a simple and fast way to monitor MongoDB stats. Mikoomi tool was a bit outdated so we decided to make up our own.

    Basically it's a python script which collects output from db.serverStatus() command and sends it to Zabbix. On a Zabbix server side you need to create trappers for the stats you are going to monitor. The script itself is run by cron (every minute in our case) and according to our data it doesn't significantly affect db server health.

    The stats are listed in zbx_var.txt file, so feel free to remove unneeded.

    The script was intended to be for internal use only, could be optimized.

    PS: Our programmer doesn't really speak English, be warned

    Zabbix version: 2.4.7
    MongoDB version: 3.2.4
    Attached Files
    Last edited by sturi; 21-03-2016, 11:05.
  • mholttech
    Junior Member
    • Mar 2016
    • 3

    #2
    could you also share the zabbix template as an example of how to receive the data in zabbix?

    Comment

    • sturi
      Junior Member
      • Mar 2016
      • 10

      #3
      Yes, sure, I've updated the first post.

      It's very basic in terms of triggers (just a couple of examples), but has trappers for almost all of the items you would be able to export.

      Comment

      • mholttech
        Junior Member
        • Mar 2016
        • 3

        #4
        Thanks! I'll work on it today and let you know how it goes for me

        Comment

        • yngvith
          Member
          • Nov 2015
          • 34

          #5
          HI, have you tested this for Zabbix 3 ?

          best regards
          Yngvi

          Comment

          • sturi
            Junior Member
            • Mar 2016
            • 10

            #6
            if trappers work the same way like in 2.4, then you wouldn't have problems with it. Though there are might be problems with the template itself.

            Comment

            • mholttech
              Junior Member
              • Mar 2016
              • 3

              #7
              I'm running Zabbix 3 and it worked perfectly

              Comment

              • yogi
                Junior Member
                • Mar 2016
                • 26

                #8
                monitoring mongodb as a docker contianer

                i got mongodb running as docker-container, do you thinnk it will work on it to? if so how?

                Comment

                • mbarthelemy2
                  Junior Member
                  • Apr 2016
                  • 1

                  #9
                  Native plugin

                  Hi,

                  I'm currently writing a native agent plugin for Mongodb monitoring.

                  Currently it's very basic and lacks documentation (compile, install, usage), but I hope to improve it quickly.

                  The Github project is there: https://github.com/m-barthelemy/zabbix-mongo

                  Comment

                  • cjj0596
                    Junior Member
                    • Jun 2016
                    • 1

                    #10
                    Originally posted by sturi
                    if trappers work the same way like in 2.4, then you wouldn't have problems with it. Though there are might be problems with the template itself.

                    hi sturi,

                    I import your the zabbix template you upload, but it shows some error in the website.

                    Import failed
                    Details
                    Created: Application "mongodb" on "Template App mongodb".
                    Error in query [INSERT INTO items (name,type,snmp_community,multiplier,snmp_oid,dela y,history,trends,status,value_type,units,delta,snm pv3_contextname,snmpv3_securityname,snmpv3_securit ylevel,snmpv3_authprotocol,snmpv3_authpassphrase,s nmpv3_privprotocol,snmpv3_privpassphrase,formula,d elay_flex,params,ipmi_sensor,data_type,authtype,us ername,password,publickey,privatekey,port,descript ion,inventory_link,logtimefmt,key_,trapper_hosts,h ostid,interfaceid,flags,itemid) VALUES ('mongodb.locks.Database.acquireCount.R','2','','0 ','','0','90','365','0','3','','0','','','0','0',' ','0','','1','','','','0','0','','','','','','','0 ','','mongodb.locks.Database.acquireCount.R','','1 0105',NULL,'0','23715')] [Duplicate entry '10105-mongodb.locks.Database.acquireCount.R' for key 'items_1']
                    SQL statement execution has failed "INSERT INTO items (name,type,snmp_community,multiplier,snmp_oid,dela y,history,trends,status,value_type,units,delta,snm pv3_contextname,snmpv3_securityname,snmpv3_securit ylevel,snmpv3_authprotocol,snmpv3_authpassphrase,s nmpv3_privprotocol,snmpv3_privpassphrase,formula,d elay_flex,params,ipmi_sensor,data_type,authtype,us ername,password,publickey,privatekey,port,descript ion,inventory_link,logtimefmt,key_,trapper_hosts,h ostid,interfaceid,flags,itemid) VALUES ('mongodb.locks.Database.acquireCount.R','2','','0 ','','0','90','365','0','3','','0','','','0','0',' ','0','','1','','','','0','0','','','','','','','0 ','','mongodb.locks.Database.acquireCount.R','','1 0105',NULL,'0','23715')".

                    Is it any changes in mysql?

                    Comment

                    • sturi
                      Junior Member
                      • Mar 2016
                      • 10

                      #11
                      Hi cjj0596,

                      If you check xml manually you would see that it happens there only once. More than that, it has lowercase "r" in the end - check if you have any similar item already there.

                      Anyway you can create it manually - just add as many trapper items as you need. Names could be taken from zbx_vars.txt (just add mongodb prefix for compatibility). Most are Numeric unsigned, though some are text.

                      Comment

                      • pixelbradley
                        Junior Member
                        • Oct 2016
                        • 4

                        #12
                        newbie help

                        Can anyone provide any help on setting this up for a zabbix newbie? I get the template, but the .py and .sh files are confusing. Should one go in external scripts and the other be used in cron to run the external? TIA for any assistance.

                        Comment

                        • pixelbradley
                          Junior Member
                          • Oct 2016
                          • 4

                          #13
                          zabbix_sender?

                          I actually think I have this going now - I realized that the bash script was actually an example of usage (thanks ).

                          however, I don't seem to have the "zabbix_sender" command installed on my system (on server or agents). Is this possibly a script I can find elsewhere?

                          Comment

                          • pixelbradley
                            Junior Member
                            • Oct 2016
                            • 4

                            #14
                            working!

                            None of my posts have been approved yet, so I guess it's good that I was able to figure this out on my own :P


                            Got this working by:
                            a) working out how to install the "zabbix_sender" command (on ubuntu it has its own package now, which is pretty gross)
                            b) taking the shell script apart to learn what arguments need to be fed into things
                            c) hacking the python script to allow a hostname to be passed in, which makes this much more useful for me

                            REALLY excited to have graphable, triggerable data for mongodb now. Thanks for much for putting me on the right track

                            Comment

                            • sturi
                              Junior Member
                              • Mar 2016
                              • 10

                              #15
                              Sorry fo the delay, big project ongoing. Fortunately you've managed to get it by your own.

                              Comment

                              Working...