Debian Codegraph @

debian/patches/check_mongodb/python2to3

raw
1 Index: pkg-nagios-plugins-contrib/check_mongodb/check_mongodb.py
2 ===================================================================
3 --- pkg-nagios-plugins-contrib.orig/check_mongodb/check_mongodb.py
4 +++ pkg-nagios-plugins-contrib/check_mongodb/check_mongodb.py
5 @@ -1,4 +1,4 @@
6 -#!/usr/bin/env python
7 +#!/usr/bin/env python3
8
9 #
10 # A MongoDB Nagios check script
11 @@ -26,8 +26,8 @@
12 # See the README.md
13 #
14
15 -from __future__ import print_function
16 -from __future__ import division
17 +
18 +
19 import sys
20 import time
21 import optparse
22 @@ -1137,9 +1137,9 @@ def check_queries_per_second(con, query_
23
24 # update the count now
25 if mongo_version == 2:
26 - db.nagios_check.update({u'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
27 + db.nagios_check.update({'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
28 else:
29 - db.nagios_check.update_one({u'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
30 + db.nagios_check.update_one({'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
31
32 message = "Queries / Sec: %f" % query_per_sec
33 message += performance_data(perf_data, [(query_per_sec, "%s_per_sec" % query_type, warning, critical, message)])
34 @@ -1149,9 +1149,9 @@ def check_queries_per_second(con, query_
35 query_per_sec = 0
36 message = "First run of check.. no data"
37 if mongo_version == 2:
38 - db.nagios_check.update({u'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
39 + db.nagios_check.update({'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
40 else:
41 - db.nagios_check.update_one({u'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
42 + db.nagios_check.update_one({'_id': last_count['_id']}, {'$set': {"data.%s" % query_type: {'count': num, 'ts': int(time.time())}}})
43
44 except TypeError:
45 #