From 1a64deeb894dc95e2645a75771732c6cc53a79ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 4 Oct 2023 01:35:06 +0200 Subject: Squash changes containing private information There were a lot of changes since the previous commit, but a lot of them contained personnal information about users. All thos changes got stashed into a single commit (history is kept in a different place) and private information was moved in a separate private repository --- flakes/private/monitoring/plugins/check_ovh_sms | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 flakes/private/monitoring/plugins/check_ovh_sms (limited to 'flakes/private/monitoring/plugins/check_ovh_sms') diff --git a/flakes/private/monitoring/plugins/check_ovh_sms b/flakes/private/monitoring/plugins/check_ovh_sms new file mode 100755 index 0000000..caf279c --- /dev/null +++ b/flakes/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