From: Ulrich Dangel Date: Thu, 24 Nov 2011 21:01:09 +0000 (+0100) Subject: Collect statistic information about this boot X-Git-Tag: v0.9.37~4 X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=df29c9febe86bbc6bfcd8fd20da28b7bad86307e Collect statistic information about this boot [ch: squashed, reworded] --- diff --git a/autoconfig b/autoconfig index 88ee853..29a6d67 100644 --- a/autoconfig +++ b/autoconfig @@ -87,6 +87,7 @@ CONFIG_PASSWD='yes' # set password via bootparam passwd CONFIG_SCRIPTS='yes' # execute scripts from the scripts option CONFIG_SERVICES='yes' # check for services to run, provided via bootparam CONFIG_SMALL='yes' # use a less "bloat" /etc/inittab for small computer with less RAM +CONFIG_STATS='yes' # Report stats to stats server CONFIG_SSH='yes' # check for bootparam ssh CONFIG_SWRAID='yes' # check for software raid devices [only in live-mode] CONFIG_TESTCD='yes' # CD checker diff --git a/autoconfig.functions b/autoconfig.functions index 0215837..61f4266 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -1346,6 +1346,34 @@ config_netscript() { } # }}} +# {{{ stats +config_stats() { + if ! checkbootparam 'nostats' ; then + BASE_URL="http://stats.grml.org/report/" + ACTION_NAME=Boot + + HOST_ID=$(cat /proc/sys/kernel/random/boot_id) + + grep -q " lm " /proc/cpuinfo && HAS_64BIT="1" || HAS_64BIT="0" + DATE_STRING=$(date +'h=%H&m=%M&s=%S') + [ -e /etc/grml_version ] && VERSION=$(cat /etc/grml_version) || \ + VERSION=$(lsb_release -d | awk -F: '{gsub(/^[ \t]+/, "", $2); print $2}') + + PARAMS="$( echo "$CMDLINE" | sed -e 's/=[^ ]*/=VALUE/g' | tr " " "\n"|sort|tr "\n" " " )" + + echo "$CMDLINE" | grep -q -e "fetch|nfsroot" && BOOT="remote" + [ -z "$BOOT" ] && BOOT="local" + + ADDITIONAL_PARAMS="" + ( [ -n "$COLUMNS" ] && [ -n "$LINES" ] ) && \ + ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS&res=$((COLUMNS * 8))x$((LINES * 16))" + + URI='$BASE_URL?action=${ACTION_NAME}\&$DATE_STRING\&unique_id=${HOST_ID}\&support_64bit=$HAS_64BIT\&version=$version\&bootup=$BOOT\¶ms=$PARAMS$ADDITIONAL_PARAMS' + + get_remote_file "$URI" "/dev/null" >/dev/null 2>&1 &! + fi +} +# }}} # {{{ fix/workaround for unionfs fix_unionfs(){ if [ -z "$INSTALLED" ]; then diff --git a/grml-autoconfig b/grml-autoconfig index 30f496d..70eef3c 100755 --- a/grml-autoconfig +++ b/grml-autoconfig @@ -170,6 +170,8 @@ checkvalue $CONFIG_NETCONFIG && config_netconfig checkvalue $CONFIG_NETSCRIPT && config_netscript +checkvalue $CONFIG_STATS && config_stats + checkvalue $CONFIG_SERVICES && config_services checkvalue $CONFIG_NETIPV6 && config_ipv6