#!/bin/sh

#server to generate report for
SERVER=10.20.30.40
#user has to have read access to Global/Health
USERNAME=health
PASSWORD=foobarbaz
#mail server to use
MAIL_SERVER=mail.example.com
#SMTP authentication (leave empty to not use)
MAIL_USER=
MAIL_PASS=
#e-mail sender and recipient(s)
MAIL_SENDER=report@example.org
MAIL_RECIPIENT=admin@example.net
#send report only if the following level is reached: 0=always, 1=unknown readings, 2=warnings, 3=errors
MAIL_LEVEL=1

#workaround self-signed certificates
export PERL_LWP_SSL_VERIFY_HOSTNAME=0

/root/scripts/esxi_health_status.pl --server $SERVER --username $USERNAME --password $PASSWORD --mailserver $MAIL_SERVER --sender $MAIL_SENDER --recipient $MAIL_RECIPIENT --mailhtml --maillevel $MAIL_LEVEL ${MAIL_USER:+--mailuser $MAIL_USER} ${MAIL_PASS:+--mailpass $MAIL_PASS}
