#!/bin/bash

LASTHOSTCHECK="$1"
NOTIFICATIONTYPE="$2"
HOSTNAME="$3"
HOSTSTATE="$4"
HOSTATTEMPT="$5"
HOSTSTATETYPE="$6"
HOSTEXECUTIONTIME="$7"
HOSTOUTPUT="$8"
HOSTPERFDATA="$9"

mail -s "json from nagios" screech-notify@tislabs.com << EOF
{
    "screech_event_type": "nagios-host",
    "LASTHOSTCHECK": "$LASTHOSTCHECK",
    "NOTIFICATIONTYPE": "$NOTIFICATIONTYPE",
    "HOSTNAME": "$HOSTNAME",
    "HOSTSTATE": "$HOSTSTATE",
    "HOSTATTEMPT": "$HOSTATTEMPT",
    "HOSTSTATETYPE": "$HOSTSTATETYPE",
    "HOSTEXECUTIONTIME": "$HOSTEXECUTIONTIME",
    "HOSTOUTPUT": "$HOSTOUTPUT",
    "HOSTPERFDATA": "$HOSTPERFDATA"
}
EOF
