
#!/bin/sh
# File	: get_IPSpaces_info.sh
# By	: Maarten.deBoer@atos.net, 120420
# Subject	: Scripts to collect get_IPSpaces info (for CMDB filling)
PGM="`basename $0|cut -d\. -f1`"
TMP="/tmp/${PGM}.$$"
CSV="${PGM}.csv"
MAILTO="maarten.deboer@atos.net"
SSH="/usr/bin/ssh -n"
FILERS=${HOME}/etc/filers_cmdb
LANDSCAPE="FSOD-Atos"
for FILER in `cat $FILERS|grep -v \#`
do
  ${SSH} ${FILER} ipspace list|grep -v default|grep -v Number|awk '{print $1}'|while read IPSP
  do
    echo "${LANDSCAPE}|${FILER};${IPSP};"|tee -a ${TMP}
  done

done

cat ${TMP} | uuencode ${CSV}|mailx -s ${CSV} ${MAILTO}
echo "Mailed to ${MAILTO}"
rm ${TMP}
exit 0

