
#!/bin/sh
# File	: get_cifs-sessions.sh
# By	: Maarten.deBoer@Atos.net, 120215
# Subject	: Script to collect CIFS sessions & send it to MAILTO
PGM="`basename $0|cut -d\. -f1`"
HOSTNAME="`hostname|cut -d\. -f1`"
TMP="/tmp/${PGM}.$$"
SSH="/usr/bin/ssh -n"
MAILTO="maarten.deboer@atos.net Martin.vandenHeuvel@atos.net"

FILER="nlnaf02"
VFILER="nlnafvslb01"
echo "vfiler ${VFILER} ..."
${SSH} ${FILER} vfiler run ${VFILER} cifs sessions >> ${TMP}

FILER="nlnaf03"
VFILER="nlnafvslb03"
echo "vfiler ${VFILER} ..."
${SSH} ${FILER} vfiler run ${VFILER} cifs sessions >> ${TMP}

FILER="nlnaf04"
VFILER="nlnafvslb04"
echo "vfiler ${VFILER} ..."
${SSH} ${FILER} vfiler run ${VFILER} cifs sessions >> ${TMP}

FILER="nlnaf25"
VFILER="nlnafvslb07"
echo "vfiler ${VFILER} ..."
${SSH} ${FILER} vfiler run ${VFILER} cifs sessions >> ${TMP}

FILER="nlnaf26"
VFILER="nlnafvslb08"
echo "vfiler ${VFILER} ..."
${SSH} ${FILER} vfiler run ${VFILER} cifs sessions >> ${TMP}

DATI="`date +%Y%m%d_%H%M`"
FILE="CIFS-sessions-${DATI}"
cat ${TMP}|uuencode ${FILE}.asc|mailx -s ":${HOSTNAME}: CIFS sessions (${DATI}) [${PGM}]" ${MAILTO}
echo "Info (${DATI}) mailed to ${MAILTO}"


rm ${TMP}
exit 0

