创建一个 .sh 脚本,写入下面的代码
#!/bin/bash
to=$1
subject=$2
body=$3
host=$4
date=$5
time=$6
he='{"to":"'$to'","subject":"'$subject'","body":"'$body'","host":"'$host'"}'
curl -X POST -H "Content-Type:application/json" -d "$he" https://localhost/api/monitor/alarm/insert
然后存放到 /usr/lib/zabbix/alertscripts 目录下