#!/bin/bash

LASTHOSTCHECK="$1"
NOTIFICATIONTYPE="$2"
SERVICEDESC="$3"
HOSTALIAS="$4"
HOSTADDRESS="$5"
SERVICESTATE="$6"
LONGDATETIME="$7"
SERVICEOUTPUT="$8"

mail -s "json from nagios" screech-notify@tislabs.com << EOF
{
    "screech_event_type": "nagios-service",
    "LASTHOSTCHECK": "$LASTHOSTCHECK",
    "NOTIFICATIONTYPE": "$NOTIFICATIONTYPE",
    "SERVICEDESC": "$SERVICEDESC",
    "HOSTALIAS": "$HOSTALIAS",
    "HOSTADDRESS": "$HOSTADDRESS",
    "SERVICESTATE": "$SERVICESTATE",
    "LONGDATETIME": "$LONGDATETIME",
    "SERVICEOUTPUT": "$SERVICEOUTPUT"
}
EOF
