Nagios Monitoring MongoDB

Source: Internet
Author: User

Nagios itself does not provide a service to monitor MongoDB and needs to install plugins

has been written by the Great God plugin Nagios_plugin-mongodb

Address Https://github.com/mzupan/nagios-plugin-mongodb

Record how to use the

First switch to the directory where the script is located on the monitor machine

Cd/usr/local/nagios/libexec

git clone git://github.com/mzupan/nagios-plugin-mongodb.git

CD Nagios-plugin-mongodb

PIP Isntall Requirements

This installs the script, mainly the check_mongodb.py

The script is written in Python and requires the installation of the Pymongo library in Python, and the previous requirements has Pymongo so it's installed.

Next up is the play configuration file

Edit Command.cfg File

Vim/usr/local/nagios/etc/objects/command.cfg

In the end, add the following specific instructions what meaning can be switched to the script file under execution./check_mongodb.py--help to view

#'Check_mongodb'Command definitiondefine command {command_name check_mongodb command_line $USER 1$/nagios-plugin-mongodb/check_mongodb.py-h $HOSTADDRESS $-A $ARG 1$-P $ARG 2$-W $ARG 3$ c $ARG 4$-u $ARG 5$-P $ARG 6$-d}define Command {command_name check_mongodb_database command_line $USER 1$/nagios-plugin-mongodb/check_mongodb.py-h $HOSTADDRESS $-A $ARG 1$-P $ARG 2$-W $ARG 3$-C $ARG 4$-D $ARG 5$-u $ARG 6$-P $A rg7$-d}define Command {command_name check_mongodb_collection command_line $USER 1$/nagios-plugin-mongodb/check_mongodb.py-h $HOSTADDRESS $-A $ARG 1$-P $ARG 2$-W $ARG 3$-C $ARG 4$-D $ARG 5$-C $ARG 6$-u $A rg7$-P $ARG 8$-d}define Command {command_name check_mongodb_replicaset command_line $USER 1$/nagios-plugin-mongodb/check_mongodb.py-h $HOSTADDRESS $-A $ARG 1$-P $ARG 2$-W $ARG 3$-C $ARG 4$-R $ARG 5$-u $ARG 6$-P $A rg7$-d}define Command {command_name check_mongodb_query command_line $USER 1$/nagios-plugin-mongodb/check_mongodb.py-h $HOSTADDRESS $-A $ARG 1$-P $ARG 2$-W $ARG 3$-C $ARG 4$-Q $ARG 5$-u $ARG 6$-P $A rg7$-D}

-H is the host address-A is the operation-P is the port-u user name-p password

Then edit the configuration file of your monitored machine

Join

Define a service to check Mongodb in the Remvoe machinedefine service{use generic -service host_name vm_test service_description check_mongodb_connect_99 Check_command Check_mongodb!10.0.0.99!connect!27017!2!4!username!password}define service{Use generic-Service; Name of service template to use host_name vm_test service_description chec k_mongodb_connections_99 Check_command Check_mongodb!10.0.0.99!connections!27017! -! the!username!password}define service{Use generic-Service; Name of service template to use host_name vm_test service_description chec k_mongodb_memory_99 Check_command Check_mongodb!10.0.0.99!memory!27017! -! -!username!password}define service{Use generic-Service; Name of service template to use host_name vm_test service_description chec k_mongodb_rep_state_99 Check_command Check_mongodb!10.0.0.99!replset_state!27017!0!0!username!password}define service{Use generic-Service; Name of service template to use host_name vm_test service_description chec k_mongodb_database_exam_99 Check_command check_mongodb_database!10.0.0.99!database_size!27017! -! -!test!username!password

Basically, it's all configured.

The most important step is to check that the configuration file is correct

/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg

If correct, restart Nagios and Nrpe, and remember to monitor the firewall to open port 27017.

The above is done directly by executing a script to manipulate MongoDB

You can also use the Nrpe to monitor

Change the configuration file for the monitoring machine.

Define a service to check Mongodb in the Remvoe machinedefine service{        use                             generic-service        Host _name                       vm_test        service_description             check_mongodb_connect        check_command                   check_nrpe!check_ Mongodb_connect        }

Modify the nrep.cfg file on the monitored machine

10.0. 0.99 27017 4 2 -u username-p password

Restart Nrpe and Nagios

Using the second method of Nrpe is successful, the first is not successful and does not know why.

Nagios Monitoring MongoDB

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.