aboutsummaryrefslogtreecommitdiff
path: root/modules/private/monitoring/plugins
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-02-13 13:06:37 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-02-13 13:06:37 +0100
commit6191bdeb78947a3590b9c3cfeeacd9c9168367c4 (patch)
tree7d6a6bef14087a93627e85bfec35173e578618ef /modules/private/monitoring/plugins
parentea9c6fe8041faab128391a0c03ec3bde25e29fa3 (diff)
downloadNix-6191bdeb78947a3590b9c3cfeeacd9c9168367c4.tar.gz
Nix-6191bdeb78947a3590b9c3cfeeacd9c9168367c4.tar.zst
Nix-6191bdeb78947a3590b9c3cfeeacd9c9168367c4.zip
Add sms check to monitoring
Diffstat (limited to 'modules/private/monitoring/plugins')
-rwxr-xr-xmodules/private/monitoring/plugins/check_ovh_sms25
1 files changed, 25 insertions, 0 deletions
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 @@
1#!/usr/bin/env python
2
3import sys
4try:
5 import ovh
6
7 [endpoint, application_key, application_secret, consumer_key, account] = sys.argv[1].split(",")
8 client = ovh.Client(
9 endpoint=endpoint,
10 application_key=application_key,
11 application_secret=application_secret,
12 consumer_key=consumer_key,
13 )
14
15 result = client.get('/sms/{}'.format(account))["creditsLeft"]
16
17 if result < 20:
18 print("SMS OVH Critical - Not enough sms left ({})|SMS {}".format(result, result))
19 sys.exit(2)
20 else:
21 print("SMS OVH Ok - Enough sms left ({})|SMS {}".format(result, result))
22 sys.exit(0)
23except Exception:
24 print("SMS OVH UNKNOWN - Error during script")
25 sys.exit(3)