Last active
April 19, 2024 15:20
-
-
Save K0rell/1d5e09b5688b9473fe8b37685e435fdb to your computer and use it in GitHub Desktop.
Zabbix SMS Alert with OVH SMS API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Requirement wget | |
# Create new script in nano /usr/lib/zabbix/alertscripts/media-sms-ovh.sh | |
# chmod +x media-sms-ovh.sh | |
# OVH SMS API | |
# Login into your ovh account create SMS user | |
ACCOUNT=MyOvhSmsAccountName(sms-xxxxxxxxx-x) | |
LOGIN=MyOvhSmsUserApiLogin | |
PASSWORD=MyOvhSmsUserApiPassword | |
FROM=MyOvhSenderName | |
# ZABBIX Administration > Media types > Create media type | |
# Name = SMS OVH | |
# Type = Script | |
# Script name = media-sms-ovh.sh | |
# Script parameters (one per line with {}) = {ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE} | |
# Administration > User > Media > Add | |
TO=$1 # {ALERT.SENDTO} | |
MESSAGE="$2%0d%0a$3" # {ALERT.SUBJECT} \r\n {ALERT.MESSAGE} | |
SMS_URL="https://www.ovh.com/cgi-bin/sms/http2sms.cgi?&account=${ACCOUNT}&login=${LOGIN}&password=${PASSWORD}&noStop=1&from=${FROM}&to=${TO}&message=${MESSAGE}" | |
wget "$SMS_URL" --https-only --quiet | |
# Exit status 0 returned because command executed successfully. | |
echo $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CURL Version :