summaryrefslogtreecommitdiff
path: root/monitoring
diff options
context:
space:
mode:
Diffstat (limited to 'monitoring')
-rw-r--r--monitoring/boundary_meter.py10
-rw-r--r--monitoring/sensu_check.py14
-rw-r--r--monitoring/stackdriver.py10
-rw-r--r--monitoring/uptimerobot.py10
4 files changed, 35 insertions, 9 deletions
diff --git a/monitoring/boundary_meter.py b/monitoring/boundary_meter.py
index 99cb74f8..ef681704 100644
--- a/monitoring/boundary_meter.py
+++ b/monitoring/boundary_meter.py
@@ -22,7 +22,15 @@ You should have received a copy of the GNU General Public License
along with Ansible. If not, see <http://www.gnu.org/licenses/>.
"""
-import json
+try:
+ import json
+except ImportError:
+ try:
+ import simplejson as json
+ except ImportError:
+ # Let snippet from module_utils/basic.py return a proper error in this case
+ pass
+
import datetime
import base64
import os
diff --git a/monitoring/sensu_check.py b/monitoring/sensu_check.py
index 9a004d37..09edae63 100644
--- a/monitoring/sensu_check.py
+++ b/monitoring/sensu_check.py
@@ -174,16 +174,20 @@ EXAMPLES = '''
sensu_check: name=check_disk_capacity state=absent
'''
+try:
+ import json
+except ImportError:
+ try:
+ import simplejson as json
+ except ImportError:
+ # Let snippet from module_utils/basic.py return a proper error in this case
+ pass
+
def sensu_check(module, path, name, state='present', backup=False):
changed = False
reasons = []
- try:
- import json
- except ImportError:
- import simplejson as json
-
stream = None
try:
try:
diff --git a/monitoring/stackdriver.py b/monitoring/stackdriver.py
index 7b3688cb..25af77ec 100644
--- a/monitoring/stackdriver.py
+++ b/monitoring/stackdriver.py
@@ -92,10 +92,16 @@ EXAMPLES = '''
# ===========================================
# Stackdriver module specific support methods.
#
+
try:
- import json
+ import json
except ImportError:
- import simplejson as json
+ try:
+ import simplejson as json
+ except ImportError:
+ # Let snippet from module_utils/basic.py return a proper error in this case
+ pass
+
def send_deploy_event(module, key, revision_id, deployed_by='Ansible', deployed_to=None, repository=None):
"""Send a deploy event to Stackdriver"""
diff --git a/monitoring/uptimerobot.py b/monitoring/uptimerobot.py
index bdff8f1f..65d963cd 100644
--- a/monitoring/uptimerobot.py
+++ b/monitoring/uptimerobot.py
@@ -64,7 +64,15 @@ EXAMPLES = '''
'''
-import json
+try:
+ import json
+except ImportError:
+ try:
+ import simplejson as json
+ except ImportError:
+ # Let snippet from module_utils/basic.py return a proper error in this case
+ pass
+
import urllib
import time