From 6191bdeb78947a3590b9c3cfeeacd9c9168367c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 13 Feb 2020 13:06:37 +0100 Subject: Add sms check to monitoring --- modules/private/monitoring/plugins/check_ovh_sms | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 modules/private/monitoring/plugins/check_ovh_sms (limited to 'modules/private/monitoring/plugins') diff --git a/modules/private/monitoring/plugins/check_ovh_sms b/modules/private/monitoring/plugins/check_ovh_sms new file mode 100755 index 0000000..141f82d --- /dev/null +++ b/modules/private/monitoring/plugins/check_ovh_sms @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import sys +try: + import ovh + + [endpoint, application_key, application_secret, consumer_key, account] = sys.argv[1].split(",") + client = ovh.Client( + endpoint=endpoint, + application_key=application_key, + application_secret=application_secret, + consumer_key=consumer_key, + ) + + result = client.get('/sms/{}'.format(account))["creditsLeft"] + + if result < 20: + print("SMS OVH Critical - Not enough sms left ({})|SMS {}".format(result, result)) + sys.exit(2) + else: + print("SMS OVH Ok - Enough sms left ({})|SMS {}".format(result, result)) + sys.exit(0) +except Exception: + print("SMS OVH UNKNOWN - Error during script") + sys.exit(3) -- cgit v1.2.3