For those who do not want external command to send zabbix event from php scripts:
Code:
function zabbix_send($server,$port,$hostname,$key,$msg) {
$host64=base64_encode($hostname);
$key64=base64_encode($key);
$msg64=base64_encode($msg);
$req="<req><host>$host64</host><key>$key64</key><data>$msg64</data></req>\n";
$s=fsockopen($server,$port,$errnum,$errstr,15);
if (is_resource($s)) {
fputs($s,$req);
while (!feof($s)) {
$ret.= fgets($s, 1024);
}
return($ret);
} else {
return(false);
}
}
Comment