Created
October 2, 2017 16:47
-
-
Save tuklusan/61dc7b210b411123091f5a0b48d23b45 to your computer and use it in GitHub Desktop.
Solaris 11.3 (SunOS 5.11) bash shell script to fetch darkstat host lists from various servers SANYALnet labs and generates html index file linking the gathered darkstat data files; Results are at http://sanyal.duckdns.org:81/darkstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# -- | |
# darkstat-cron.sh | |
# | |
# Solaris 11.3 (SunOS 5.11) | |
# | |
# Simple script that fetches darkstat host lists from various servers around my | |
# lab and generates a html index file linking to the gathered darkstat data files | |
# | |
# Results are at http://sanyal.duckdns.org:81/darkstats | |
# | |
# (C) Supratim Sanyal - https://goo.gl/FqzyBW | |
# -- | |
DARKSTAT_DIR="/media/USB-Storage/sanyalnet-shared/[FTP-SERVER-XLIGHT-FILES]/html/darkstats" | |
INDEX_HTML="$DARKSTAT_DIR/index.html" | |
HREF_BASE="/darkstats" | |
declare -a SOURCE_HOSTS=("dell-dimension-2400.sanyalnet.lan" "dell-dimension-e510.sanyalnet.lan" "dellpoweredge2950.sanyalnet.lan" "fedach.sanyalnet.lan" "fomfor.sanyalnet.lan" "moksha.sanyalnet.lan") | |
echo "<!DOCTYPE html>" > $INDEX_HTML | |
echo "<HTML lang=\"en\">">> $INDEX_HTML | |
echo "<HEAD><TITLE>SANYALnet DARKSTAT NETWORK STATISTICS</TITLE><meta name=\"description\" content=\"Network traffic and bandwidth usage reports from Windows,Linux,Solaris,Ultrix,OpenVMS and other hobbyist servers maintained by Supratim Sanyal.\">" >> $INDEX_HTML | |
echo "<meta charset=\"utf-8\">" >> $INDEX_HTML | |
echo "</HEAD><BODY>" >> $INDEX_HTML | |
echo "<H1>SANYALnet Labs Network Analytics: DARKSTAT</H1>" >> $INDEX_HTML | |
# Google CSE via Sanyalnet OpenVMS-VAX ([email protected] h-n) | |
echo "<script> (function() { var cx = '015567988034387983255:yma9szs-odc'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> <gcse:search></gcse:search><br>" >> $INDEX_HTML | |
echo "<P>Network traffic, hostnames and bandwidth stats from various hobbyist systems around my lab, collected by Emil Mikulic's cute <A HREF=\"https://unix4lyfe.org/darkstat/\" TARGET=\"_blank\">darkstat</A> tool.</P>" >> $INDEX_HTML | |
echo "<PRE>`psrinfo -v`</PRE>" >> $INDEX_HTML | |
echo "<HR>" >> $INDEX_HTML | |
echo "<UL>" >> $INDEX_HTML | |
for srchost in "${SOURCE_HOSTS[@]}" | |
do | |
mkdir -p "$DARKSTAT_DIR/$srchost" | |
cd "$DARKSTAT_DIR/$srchost" | |
w3m -dump -cols 200 -o display_charset=UTF-8 "http://$srchost:667/hosts/?full=yes&sort=total" > darkstat-$srchost.txt | |
echo "<LI><A HREF=\"$HREF_BASE/$srchost/darkstat-$srchost.txt\" TARGET=\"_blank\"><H3>$srchost »</H3></A></LI>" >> $INDEX_HTML | |
done | |
echo "</UL>" >> $INDEX_HTML | |
echo "<HR><P>Generated at `date` by $0 on `hostname` (`uname -a`) on a `isalist`.</P>" >> $INDEX_HTML | |
echo "<HR><PRE>`top -b 0 | head -5`</PRE><HR>" >> $INDEX_HTML | |
echo "<PRE>`psrinfo -pv`</PRE>" >> $INDEX_HTML | |
echo "<PRE>`prtconf`</PRE>" >> $INDEX_HTML | |
echo "<PRE>`cat /etc/release`</PRE>" >> $INDEX_HTML | |
echo "<P><A HREF=\"/\"><STRONG>HOME »</STRONG></A></P><HR>" >> $INDEX_HTML | |
echo "<P>© Supratim Sanyal (<A HREF=\"https://goo.gl/FqzyBW\" TARGET=\"_blank\">e-mail</A>)</P>" >> $INDEX_HTML | |
echo "</BODY></HTML>" >> $INDEX_HTML |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment