Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Aug 2006 19:34:51 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        "Marc G. Fournier" <scrappy@freebsd.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: BSDstats Project v2.0 ...
Message-ID:  <44D8D94B.6050208@infracaninophile.co.uk>
In-Reply-To: <20060808111631.V7522@ganymede.hub.org>
References:  <20060807003815.C7522@ganymede.hub.org> <810a540e0608071342h70a717cdxb8a1d9e077c354c9@mail.gmail.com> <20060807170521.09ce4122.wmoran@collaborativefusion.com> <44D7B1FC.5040406@infracaninophile.co.uk> <20060807231345.E7522@ganymede.hub.org> <44D839A4.8070904@infracaninophile.co.uk> <20060808111631.V7522@ganymede.hub.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig29143109D29F91C87D46792B
Content-Type: multipart/mixed; boundary="------------070807030208070108070808"

This is a multi-part message in MIME format.
--------------070807030208070108070808
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Marc G. Fournier wrote:
> On Tue, 8 Aug 2006, Matthew Seaman wrote:
>=20
>> Marc G. Fournier wrote:
>>> On Mon, 7 Aug 2006, Matthew Seaman wrote:
>>>
>>>> I think it would help uptake if when the bsdstats job is first run, =
it
>>>> issues you with a 'registered system number' -- then all of the folk=
s
>>>> with low numbered systems get bragging rights...
>>>
>>> Actually, there is no "registered system number", as there is no
>>> "registration process" ... that was the key requirement for doing thi=
s,
>>> was that it was as "hands off" as possible, and having to go to a web=

>>> site to register each and every host was just too onerous of a task .=
=2E.
>>
>> Yeah.  You've leapt on the word 'register' there, and not addressed th=
e
>> salient point.  'Register' as in 'become cognisant of', and distinguis=
hed
>> from 'signed up to.'  Even though the process is simplified and
>> automatic,
>> you're still registering systems.
>>
>> Having some sort of return from the central stats machine when the
>> periodic
>> script runs, (rather than nothing at all, as at the moment) would be a=

>> good
>> idea.  Giving each system an index number shouldn't cost too much.
>=20
> But, there is no such ting as an 'index number' ... when everyone
> reports in next month, for instance, there is no 'number' that will be
> re-used for them that matches something used this month ...

You use the hostname as the identifying key for the data that's sent to y=
ou.
Presumably you've got to add that hostname to a table somewhere, so that
re-running the 300.statistics script doesn't spam the database with multi=
ples
of the same set of data.  i.e. it's the key to a unique index.  Suggests =
that
row number in that table of host names is your unique index number...

Anyhow, how about the following little enhancement.  This lists the CPUs =
on the
system pretending they are CPU0, CPU1, ... devices.  The URI escape stuff=
 should
be automatically decoded by PHP without any extra coding required.

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                      Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW

--------------070807030208070108070808
Content-Type: text/plain;
 name="300.statistics.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="300.statistics.diff"

--- /usr/ports/sysutils/bsdstats/files/300.statistics	Tue Aug  8 09:21:34=
 2006
+++ 300.statistics	Tue Aug  8 19:30:08 2006
@@ -14,25 +14,57 @@
 oldmask=3D$(umask)
 umask 066
=20
+# RFC 2396
+uri_escape () {
+    echo ${1+$@} | sed -e '
+        s/%/%25/g
+        s/;/%3b/g
+        s,/,%2f,g
+        s/?/%3f/g
+        s/:/%3a/g
+        s/@/%40/g
+        s/&/%26/g
+        s/=3D/%3d/g
+        s/+/%2b/g
+        s/\$/%24/g
+        s/,/%2c/g
+        s/ /%20/g
+        '
+}
+
+do_fetch () {
+    /usr/bin/fetch -qo /dev/null "http://bsdstats.hub.org/scripts/$1"
+}
+
 case "$monthly_statistics_enable" in
     [Yy][Ee][Ss])
       HN=3D`/bin/hostname`
       SYS=3D`/usr/bin/uname -r`
       ARCH=3D`/usr/bin/uname -m`
       OS=3D`/usr/bin/uname -s`
-      /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/getid=
=2Ephp?hn=3D$HN\&sys=3D$SYS\&arch=3D$ARCH\&opsys=3D$OS
+      do_fetch getid.php?hn=3D$HN\&sys=3D$SYS\&arch=3D$ARCH\&opsys=3D$OS=

       case "$monthly_statistics_report_devices" in
          [Yy][Ee][Ss])
 IFS=3D"
 "
           =20
-            /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts=
/clear_devices.php?hn=3D$HN
+            do_fetch clear_devices.php?hn=3D$HN
             for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none`
             do
                 DRIVER=3D`echo $line | awk -F\@ '{print $1}'`
                 VEN=3D`echo $line | awk '{print $4}' | cut -c12-15`
                 DEV=3D`echo $line | awk '{print $4}' | cut -c8-11`
-                /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scr=
ipts/report_device.php?driver=3D$DRIVER\&vendor=3D$VEN\&device=3D$DEV\&hn=
=3D$HN
+                do_fetch report_device.php?driver=3D$DRIVER\&vendor=3D$V=
EN\&device=3D$DEV\&hn=3D$HN
+            done
+            line=3D$( sysctl -n hw.model )
+            VEN=3D$( echo $line | cut -d ' ' -f 1 )
+            DEV=3D$( uri_escape $( echo $line | cut -d ' ' -f 2- ) )
+            n=3D0
+            count=3D$( sysctl -n hw.ncpu )
+            while [ $n -lt $count ]
+            do
+                do_fetch report_device.php?driver=3DCPU$n\&vendor=3D$VEN=
\&device=3D$DEV\&hn=3D$HN
+                n=3D$(( $n + 1 ))
             done
          ;;
          esac

--------------070807030208070108070808--

--------------enig29143109D29F91C87D46792B
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE2NlS8Mjk52CukIwRCFklAJsEn+g2VyuM4iKUMWV0m+4iEgAwWACeKnmm
6154L2yGdPMeWqRDgNCKoNI=
=Zx4r
-----END PGP SIGNATURE-----

--------------enig29143109D29F91C87D46792B--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44D8D94B.6050208>