Skip to content

Instantly share code, notes, and snippets.

@toodooleedoo
Last active August 29, 2015 14:14
Show Gist options
  • Save toodooleedoo/b34faa4539d5b79573ac to your computer and use it in GitHub Desktop.
Save toodooleedoo/b34faa4539d5b79573ac to your computer and use it in GitHub Desktop.
#MP #LINUX Get report of types of dashboard reports accessed

##On each Apache Server $ cat my.bestwestern.com.log |grep dashboard.cgi |awk '{print $4 " " $7}' |sed -e 's/:.* / /g;s/[//g;s//cgi-.id=//g;s/&p=/ /g;' > /tmp/hostname.poo.out $ zcat my.bestwestern.com.log- |grep dashboard.cgi |awk '{print $4 " " $7}' |sed -e 's/:.* / /g;s/[//g;s//cgi-.*id=//g;s/&p=/ /g;' >> /tmp/hostname.poo.out ##Then copy these to your local box ##Merge all logs by running this $ cat *.poo.out > master.poo.out

USER=""
PASS=""
MW_HOST=""
MP_HOST=""
curl --dump-header headers.txt --silent "https://${MW_HOST}/siteminderagent/forms/login.fcc" -H "Host: ${MW_HOST}" -d "USER=${USER}" -d "target=http%3A%2F%2F${MP_HOST}%2Fpublish%2F" -d "PASSWORD=${PASS}" -o /dev/null
SESSION=`grep SMSESSION headers.txt |sed -e 's/.*SMSESSION=//g;s/;.*//g;'`
cat master.poo.out |while read line; do
DATE=`echo "${line}" |awk '{print $1}'`
ID=`echo "${line}" |awk '{print $2}'`
PROP=`echo "${line}" |awk '{print $3}' |sed -e 's/p=//g;'`
curl --dump-header headers2.txt --silent -k -H "Cookie: SMSESSION=${SESSION}" "https://${MP_HOST}/cgi-bin/dashboard.cgi?id=${ID}&p=${PROP}" -o /dev/null
printf "${DATE},${PROP}," |tee -a dashboard_report.csv
cat headers2.txt |grep "Content-disposition: inline; filename" |awk -F\= '{print $2}' |sed -e 's/.*\.//g;s/"//g;' |tee -a dashboard_report.csv
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment