[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 05/14: check_mongodb: Updating to 60b639ef4c
Jan Wagner
waja at moszumanska.debian.org
Mon Sep 29 13:54:56 UTC 2014
This is an automated email from the git hooks/post-receive script.
waja pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.
commit b8a8f6fe9a80ec96019229d155fc11e5d1d874eb
Author: Jan Wagner <waja at cyconet.org>
Date: Mon Sep 29 14:01:13 2014 +0200
check_mongodb: Updating to 60b639ef4c
---
check_mongodb/check_mongodb.py | 26 +++++++++++++++++++++++++-
check_mongodb/control | 2 +-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/check_mongodb/check_mongodb.py b/check_mongodb/check_mongodb.py
index 3af4685..807847f 100644
--- a/check_mongodb/check_mongodb.py
+++ b/check_mongodb/check_mongodb.py
@@ -130,7 +130,7 @@ def main(argv):
p.add_option('-C', '--critical', action='store', dest='critical', default=None, help='The critical threshold we want to set')
p.add_option('-A', '--action', action='store', type='choice', dest='action', default='connect', help='The action you want to take',
choices=['connect', 'connections', 'replication_lag', 'replication_lag_percent', 'replset_state', 'memory', 'memory_mapped', 'lock',
- 'flushing', 'last_flush_time', 'index_miss_ratio', 'databases', 'collections', 'database_size', 'database_indexes', 'collection_indexes',
+ 'flushing', 'last_flush_time', 'index_miss_ratio', 'databases', 'collections', 'database_size', 'database_indexes', 'collection_indexes', 'collection_size',
'queues', 'oplog', 'journal_commits_in_wl', 'write_data_files', 'journaled', 'opcounters', 'current_lock', 'replica_primary', 'page_faults',
'asserts', 'queries_per_second', 'page_faults', 'chunks_balance', 'connect_primary', 'collection_state', 'row_count', 'replset_quorum'])
p.add_option('--max-lag', action='store_true', dest='max_lag', default=False, help='Get max replication lag (for replication_lag action only)')
@@ -223,6 +223,8 @@ def main(argv):
return check_database_indexes(con, database, warning, critical, perf_data)
elif action == "collection_indexes":
return check_collection_indexes(con, database, collection, warning, critical, perf_data)
+ elif action == "collection_size":
+ return check_collection_size(con, database, collection, warning, critical, perf_data)
elif action == "journaled":
return check_journaled(con, warning, critical, perf_data)
elif action == "write_data_files":
@@ -888,6 +890,28 @@ def check_queues(con, warning, critical, perf_data):
except Exception, e:
return exit_with_general_critical(e)
+def check_collection_size(con, database, collection, warning, critical, perf_data):
+ warning = warning or 100
+ critical = critical or 1000
+ perfdata = ""
+ try:
+ set_read_preference(con.admin)
+ data = con[database].command('collstats', collection)
+ size = data['size'] / 1024 / 1024
+ if perf_data:
+ perfdata += " | collection_size=%i;%i;%i" % (size, warning, critical)
+
+ if size >= critical:
+ print "CRITICAL - %s.%s size: %.0f MB %s" % (database, collection, size, perfdata)
+ return 2
+ elif size >= warning:
+ print "WARNING - %s.%s size: %.0f MB %s" % (database, collection, size, perfdata)
+ return 1
+ else:
+ print "OK - %s.%s size: %.0f MB %s" % (database, collection, size, perfdata)
+ return 0
+ except Exception, e:
+ return exit_with_general_critical(e)
def check_queries_per_second(con, query_type, warning, critical, perf_data):
warning = warning or 250
diff --git a/check_mongodb/control b/check_mongodb/control
index 02bc910..2efd95e 100644
--- a/check_mongodb/control
+++ b/check_mongodb/control
@@ -1,6 +1,6 @@
Uploaders: Jan Wagner <waja at cyconet.org>
Recommends: python-pymongo
-Version: 66c42f93cc
+Version: 60b639ef4c
Homepage: https://github.com/mzupan/nagios-plugin-mongodb
Watch: https://github.com/mzupan/nagios-plugin-mongodb <span class="sha">([0-9a-f]+)</span>
Description: Plugin script to monitor your MongoDB server(s)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git
More information about the Pkg-nagios-changes
mailing list