diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 01:35:06 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 02:11:48 +0200 |
commit | 1a64deeb894dc95e2645a75771732c6cc53a79ad (patch) | |
tree | 1b9df4838f894577a09b9b260151756272efeb53 /flakes/private/monitoring/plugins/check_ovh_sms | |
parent | fa25ffd4583cc362075cd5e1b4130f33306103f0 (diff) | |
download | Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip |
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
Diffstat (limited to 'flakes/private/monitoring/plugins/check_ovh_sms')
-rwxr-xr-x | flakes/private/monitoring/plugins/check_ovh_sms | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | import sys | ||
4 | try: | ||
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) | ||
23 | except Exception: | ||
24 | print("SMS OVH UNKNOWN - Error during script") | ||
25 | sys.exit(3) | ||