Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To create such a notification, you need to create a specialized notification type (via an external script):Image Removed

...

And make sure that this type is allowed:Image Removed

...

Use a special script:
vutlan_sms_send

#!/bin/bash
# Script for sending SMS notifications via GSM-modem
 
HOSTIP=192.168.0.193
USERNAME=guest
PASSWORD=guest
TOPHONE=${1}
MESSAGE=${2}
  
# 1) hash
HASH=

`echo

`echo -n ${PASSWORD} | openssl dgst -sha1 |

 awk

 awk '{print $NF}'`
# 2) autorisation
RESPONSE=`curl -s -d "querytype=auth&name=${USERNAME}&h=${HASH}" "${HOSTIP}/engine.htm"`
# 3) session key
KEY=

`echo

`echo -n  ${RESPONSE} |

 awk

 awk -F"\"" '{print $4}'`
# 4) send SMS
curl -d "querytype=send_sms_message&k=${KEY}" --data-urlencode "to_phone=${TOPHONE}" --data-urlencode "message=${MESSAGE}" ${HOSTIP}/engine.htm > /dev/null 2>&1

The input parameters of the script $ {1}, $ {2}, and $ {3} in Zabbix are bound to the address of the recipient, the subject, and the text of the message, respectively.

The script file should be located in accordance with the parameter AlertScriptsPath(for example, /usr/lib/zabbix/alertscripts) in zabbix_server.conf and should have execution permissions for the zabbix Zabbix user (or installed in the configuration file)

...

In this sample, when an incident occurs, a message will be sent to the Zabbix administrators group. To send SMS it is enough to use only one subject field (it will be sent to the script in $ {2}), therefore the event field is empty.

...

In the Recovery operations Operations tab, you must specify the fields for the subject, the content of the message, and so on. (Similar to Operations), which will be sent when the incident is fixed.

...