Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_mongodb_write.pl (Advanced Nagios Plugins Collection)
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
- Nagios XI
27153
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
Part of the Advanced Nagios Plugins Collection.
Download it here:
https://github.com/harisekhon/nagios-plugins
check_mongodb_write.pl
Nagios Plugin to check MongoDB is working by writing a unique document and then reading it back
It will find and connect to the Primary from the given list of Mongod / Mongos nodes. Failing to find a viable Primary will result in the whole check aborting as the replica set / cluster is non-writable in that scenario.
Once it connects to the Primary, it will perform the following checks:
1. write a new unique document to the nagios collection with dynamically generated value
2. read the same document back, checking the value is identical to the value generated and written
3. delete the just created document
4. records the write/read/delete timings to a given precision and outputs perfdata for graphing
5. compares each operation's time taken against the warning/critical thresholds if given
Tested on MongoDB 2.4.8, standalone mongod, mongod Replica Sets, mongos with Sharded Replica Sets, with and without authentication
Write concern and Read concern take the following options with --write-concern and --read-concern:
'1' = primary only
'2' = primary + 1 secondary replica
'N' = N number of Mongod instances must acknowledge including Primary
'majority'
The query timeout for each write => read => delete operation is one quarter of the global --timeout
usage: check_mongodb_write.pl [ options ]
-H --host MongoDB host(s) to connect to (should be from same replica set), comma separated, with optional : suffixes. Tries hosts in given order from left to right to find Primary for write. Specifying any one host is sufficient as the rest will be auto-determined to find the primary ($MONGODB_HOST, $HOST)
-d --database Database to use (default: nagios)
-C --collection Collection to write test document to (default: check_mongodb_write)
-u --user MongoDB user ($MONGODB_USERNAME, $MONGODB_USER, $USERNAME, $USER)
-p --password MongoDB password ($MONGODB_PASSWORD, $PASSWORD)
--write-concern MongoDB write concern (defaults to '1' for a single node or 'majority'. See --help for details in header description)
--read-concern MongoDB read concern (defaults to '1' for a single node or 'majority'. See --help for details in header description)
--ssl Enable SSL, MongDB libraries must have been compiled with SSL and server must support it. Experimental
--sasl Enable SASL authentication, must be compiled in to the MongoDB perl driver to work. Experimental
--sasl-mechanism SASL mechanism (default: GSSAPI eg Kerberos on MongoDB Enterprise 2.4+ in which case this should be run from a valid kinit session, alternative PLAIN for LDAP using user/password against MongoDB Enterprise 2.6+ which is sent in plaintext so should be used over SSL). Experimental
-w --warning Warning threshold in seconds for each read/write/delete operation (use float for milliseconds)
-c --critical Critical threshold in seconds for each read/write/delete operation (use float for milliseconds)
--precision Number of decimal places for timings (default: 4)
-t --timeout Timeout in secs (default: 10)
-v --verbose Verbose mode (-v, -vv, -vvv ...)
-h --help Print description and usage options
-V --version Print version and exit
Download it here:
https://github.com/harisekhon/nagios-plugins
check_mongodb_write.pl
Nagios Plugin to check MongoDB is working by writing a unique document and then reading it back
It will find and connect to the Primary from the given list of Mongod / Mongos nodes. Failing to find a viable Primary will result in the whole check aborting as the replica set / cluster is non-writable in that scenario.
Once it connects to the Primary, it will perform the following checks:
1. write a new unique document to the nagios collection with dynamically generated value
2. read the same document back, checking the value is identical to the value generated and written
3. delete the just created document
4. records the write/read/delete timings to a given precision and outputs perfdata for graphing
5. compares each operation's time taken against the warning/critical thresholds if given
Tested on MongoDB 2.4.8, standalone mongod, mongod Replica Sets, mongos with Sharded Replica Sets, with and without authentication
Write concern and Read concern take the following options with --write-concern and --read-concern:
'1' = primary only
'2' = primary + 1 secondary replica
'N' = N number of Mongod instances must acknowledge including Primary
'majority'
The query timeout for each write => read => delete operation is one quarter of the global --timeout
usage: check_mongodb_write.pl [ options ]
-H --host MongoDB host(s) to connect to (should be from same replica set), comma separated, with optional :
-d --database Database to use (default: nagios)
-C --collection Collection to write test document to (default: check_mongodb_write)
-u --user MongoDB user ($MONGODB_USERNAME, $MONGODB_USER, $USERNAME, $USER)
-p --password MongoDB password ($MONGODB_PASSWORD, $PASSWORD)
--write-concern MongoDB write concern (defaults to '1' for a single node or 'majority'. See --help for details in header description)
--read-concern MongoDB read concern (defaults to '1' for a single node or 'majority'. See --help for details in header description)
--ssl Enable SSL, MongDB libraries must have been compiled with SSL and server must support it. Experimental
--sasl Enable SASL authentication, must be compiled in to the MongoDB perl driver to work. Experimental
--sasl-mechanism SASL mechanism (default: GSSAPI eg Kerberos on MongoDB Enterprise 2.4+ in which case this should be run from a valid kinit session, alternative PLAIN for LDAP using user/password against MongoDB Enterprise 2.6+ which is sent in plaintext so should be used over SSL). Experimental
-w --warning Warning threshold in seconds for each read/write/delete operation (use float for milliseconds)
-c --critical Critical threshold in seconds for each read/write/delete operation (use float for milliseconds)
--precision Number of decimal places for timings (default: 4)
-t --timeout Timeout in secs (default: 10)
-v --verbose Verbose mode (-v, -vv, -vvv ...)
-h --help Print description and usage options
-V --version Print version and exit
Reviews (0)
Be the first to review this listing!