User Tools

Site Tools


wiki:ostatni:zabbix:gsmbrana

Zabbix + GSM brána (RS232)

Nastroje v linuxu:

/etc/zabbix/alert.d/sms
#!/bin/sh
HOME=/etc
PATH=/bin:/sbin:/usr/bin:/usr/sbin
LOGFILE="/var/log/zabbix/zabbix-sms.log"
 
echo "Recipient='$1' Message='$3'" >> ${LOGFILE}
 
#MOBILE_NUMBER=`echo "$1" | sed s#\s##`
 
MOBILE_NUMBER="$1"
 
# Log it
echo "echo $3 | /usr/bin/sudo /usr/bin/gnokii --config /etc/gnokiirc --sendsms ${MOBILE_NUMBER} --validity 4320" >>${LOGFILE}
 
# Send it
echo "$3" | /usr/bin/sudo /usr/bin/gnokii --config /etc/gnokiirc --sendsms "${MOBILE_NUMBER}" --validity 4320 1>>${LOGFILE} 2>&1
 
echo "\n" >> ${LOGFILE}
# EOF
/etc/zabbix/alert.d/call
#!/bin/sh
HOME=/etc
PATH=/bin:/sbin:/usr/bin:/usr/sbin
LOGFILE="/var/log/zabbix/zabbix-call.log"
 
echo "$(date +'%Y.%m.%d-%H:%M:%S')" "Recipient='$1'" >> ${LOGFILE}
 
#MOBILE_NUMBER=`echo "$1" | sed s#\s##`
 
MOBILE_NUMBER="$1"
 
# Log it
echo /usr/bin/sudo /usr/bin/gnokii --config /etc/gnokiirc --dialvoice ${MOBILE_NUMBER} >>${LOGFILE}
 
# Call
/usr/bin/sudo /usr/bin/gnokii --config /etc/gnokiirc --hangup 0 1>>${LOGFILE} 2>&1
/usr/bin/sudo /usr/bin/gnokii --config /etc/gnokiirc --dialvoice "${MOBILE_NUMBER}" 1>>${LOGFILE} 2>&1
echo "\n" >> ${LOGFILE}
# EOF
wiki/ostatni/zabbix/gsmbrana.txt · Last modified: 2018/01/22 11:07 by root