#! /bin/bash

PORT=${1:-4242}
shift
HOST=${1:-localhost}

if printf "request=monitoring\n\n" | nc -q 1 ${HOST} ${PORT} 2>&1 | grep -q 'status OK'; then
    echo "OK"
    exit 0
else
    echo "CRITICAL - Received an unexpected response from spoofguard on ${HOST}:${PORT}"
    exit 2
fi

