[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 01/01: check_mongodb: Update to latest git version
Jan Wagner
waja at moszumanska.debian.org
Mon Jun 30 12:56:03 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 7e7d34f63907092b82e85accc255a290cbae026b
Author: Jan Wagner <waja at cyconet.org>
Date: Mon Jun 30 14:43:38 2014 +0200
check_mongodb: Update to latest git version
---
check_mongodb/check_mongodb.py | 33 ++++++++++++++++++++++++++++++---
check_mongodb/control | 2 +-
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/check_mongodb/check_mongodb.py b/check_mongodb/check_mongodb.py
index e4e11f6..3af4685 100644
--- a/check_mongodb/check_mongodb.py
+++ b/check_mongodb/check_mongodb.py
@@ -69,9 +69,9 @@ def performance_data(perf_data, params):
warning = warning or 0
critical = critical or 0
data += ";%s;%s" % (warning, critical)
-
+
data += " "
-
+
return data
@@ -132,7 +132,7 @@ def main(argv):
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',
'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'])
+ '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)')
p.add_option('--mapped-memory', action='store_true', dest='mapped_memory', default=False, help='Get mapped memory instead of resident (if resident memory can not be read)')
p.add_option('-D', '--perf-data', action='store_true', dest='perf_data', default=False, help='Enable output of Nagios performance data')
@@ -245,6 +245,8 @@ def main(argv):
return check_collection_state(con, database, collection)
elif action == "row_count":
return check_row_count(con, database, collection, warning, critical, perf_data)
+ elif action == "replset_quorum":
+ return check_replset_quorum(con, perf_data)
else:
return check_connect(host, port, warning, critical, perf_data, user, passwd, conn_time)
@@ -652,6 +654,31 @@ def index_miss_ratio(con, warning, critical, perf_data):
except Exception, e:
return exit_with_general_critical(e)
+def check_replset_quorum(con, perf_data):
+ db = con['admin']
+ warning = 1
+ critical = 2
+ primary = 0
+
+ try:
+ rs_members = db.command("replSetGetStatus")['members']
+
+ for member in rs_members:
+ if member['state'] == 1:
+ primary += 1
+
+ if primary == 1:
+ state = 0
+ message = "Cluster is quorate"
+ else:
+ state = 2
+ message = "Cluster is not quorate and cannot operate"
+
+ return check_levels(state, warning, critical, message)
+ except Exception, e:
+ return exit_with_general_critical(e)
+
+
def check_replset_state(con, perf_data, warning="", critical=""):
try:
diff --git a/check_mongodb/control b/check_mongodb/control
index 2137a6c..02bc910 100644
--- a/check_mongodb/control
+++ b/check_mongodb/control
@@ -1,6 +1,6 @@
Uploaders: Jan Wagner <waja at cyconet.org>
Recommends: python-pymongo
-Version: 9d17373c6a
+Version: 66c42f93cc
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
More information about the Pkg-nagios-changes
mailing list