Difference between revisions of "Project:LHS Graphs and Visualizations"

From London Hackspace Wiki
Jump to navigation Jump to search
m (→‎Metrics: Babbage deprecation)
 
(32 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{Project|members=[[User:Teabot|Elliot]]}}
 
{{Project|members=[[User:Teabot|Elliot]]}}
===Overview===
+
==Overview==
I'd am supplementing [http://hack.rs/cacti/graph_view.php?action=tree&tree_id=1 the Cacti graphs] that we have for LHS bandwidth and power with metrics that provide insight to the growth of our community and organisation over time.
+
I have supplemented [http://hack.rs/cacti/graph_view.php?action=tree&tree_id=1 the Cacti graphs] that we have for LHS bandwidth and power with [http://hack.rs/cacti/graph_view.php?action=tree&tree_id=5 metrics] that provide insight to the growth of our community and organisation over time.
  
Phase 1 is complete and we now [http://hack.rs/cacti/graph_view.php?action=tree&tree_id=5 chart the following]:
+
To chart the metrics various bits of data are exposed in a Cacti friendly way.
* Number of members
 
* IRC activity
 
* Wiki activity
 
* Mailing list activity
 
  
Later I'd like to investigate:
+
==Metrics==
* Website visitors and/or page impressions
+
===Number of members===
* Space occupancy
 
  
==In progress==
+
We may have to wait 12 months before it becomes interesting.
 
 
====Space occupancy====
 
I have located two Laser Diode Retroreflective Sensors in our stores which I intend to use to monitor space occupancy by having the beams cross the main doorway. The beams will be staggered so that direction (arriving, leaving) can be determined by the order in which the beams are broken. I was thinking of mounting them at waist height.
 
 
 
* This will probably get caught out by clusters of people: --[[81.105.17.61]]
 
** We only need an approximate count
 
** The doorway is narrow so it's unlikely that the steps of more than one individual will overlap.
 
** Most of the time people won't arrive in clusters
 
* Can we detect some other event such as the door opening after a prolonged lights-out period to force the count to zero? --[[81.105.17.61]]
 
** Yes, using the door/lights data for reset would be good if  we get large amounts of drift - but I don't plan to just yet
 
** We could also use some kind of probabilistic model with the 'door-open' and 'bell' data
 
 
 
These sensors appear to be in working order. They'd should be safe to use below child-head height. They were manufactured in 1996 and use a Class II laser rated at 3mW with a wavelength of 655-670nm ([[Media:Banner-q45bb6ll.pdf|datasheet]]). The model number is: Q45BB6LL
 
 
 
A good signal can be obtained at 1.5m by using a reflector made of aluminium tape.
 
 
 
* [http://www.flickr.com/photos/travelbot/5267252288/ Simple harness]
 
 
 
==Desired==
 
 
 
====Website visitors and/or page impressions====
 
The main site and the Wiki use Google Analytics and this has an API. This [http://code.google.com/apis/analytics/docs/gdata/gdataCommonQueries.html documented method] looks promising:
 
  https://www.google.com/analytics/feeds/data?metrics=ga%3Avisits%2Cga%3Apageviews&start-date=2010-11-29&end-date=2010-12-13&max-results=50
 
 
 
==Done==
 
 
 
To chart the initial metrics various bits of data are exposed in a Cacti friendly way.
 
 
 
====Number of members====
 
 
 
'''COMPLETE''' - but may have to wait 12 months before it becomes interesting.
 
  
 
This data is stored in an Sqlite database on [[Turing]].  See the [https://github.com/londonhackspace/hackspace-foundation-sites/blob/master/etc/schema.sql Schema]. It can be queried like so:
 
This data is stored in an Sqlite database on [[Turing]].  See the [https://github.com/londonhackspace/hackspace-foundation-sites/blob/master/etc/schema.sql Schema]. It can be queried like so:
Line 52: Line 16:
 
   WHERE subscribed = true;
 
   WHERE subscribed = true;
  
Cacti runs on babbage but the members database is on Turing. There is a PHP script on Turing to expose the member numbers and then a script on babbage to pull this in with a HTTP request.
+
Cacti runs on chomsky but the members database is on Turing. There is a PHP script on Turing to expose the member numbers and then a script on chomsky to pull this in with a HTTP request.
 +
 
 +
''Code:'' https://github.com/londonhackspace/monitoring
  
'''Code:''' https://github.com/londonhackspace/monitoring
+
''URL:'' http://london.hackspace.org.uk/member_stats.php
  
====Wiki statistics====
+
===IRC statistics===
'''COMPLETE'''
+
''See project: [[Project:Ircensus|ircensus]]''
  
 +
===Wiki statistics===
 
* We get this using the MediaWiki API:
 
* We get this using the MediaWiki API:
  
Line 82: Line 49:
 
   </api>
 
   </api>
  
Perl to generate the following output for cacti: '''<tt>pages:759 articles:215 views:229656 edits:7368 images:186 users:166 activeusers:22 admins:61 jobs:13</tt>'''
 
  
  #!/usr/bin/perl
+
A Perl script generates the following output for cacti: '''<tt>pages:759 articles:215 views:229656 edits:7368 images:186 users:166 activeusers:22 admins:61 jobs:13</tt>'''
 
 
  use strict;
 
  use LWP::Simple;
 
  use XML::Simple;
 
 
 
  eval {
 
    my $file = get("http://wiki.hackspace.org.uk/w/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml");
 
    my $xs1 = XML::Simple->new();
 
    my $doc = $xs1->XMLin($file);
 
    my $first = 1;
 
 
 
    foreach my $key (keys (%{$doc->{query}->{statistics}})){
 
      if ($first eq 1) {
 
        $first = 0;
 
      } else {
 
        print " ";
 
      }
 
      print $key . ":" . $doc->{query}->{statistics}->{$key};
 
    }
 
    1;
 
  } or do {
 
    print "NaN";
 
  }
 
  
====IRC statistics====
+
''Code:'' https://github.com/londonhackspace/monitoring
  
'''COMPLETE'''
+
===Mailing list activity===
  
There is a bot ([https://github.com/londonhackspace/ircensus ircensus]) in the #london-hack-space channel that collects data on the following:
+
* My thanks to JamesG for his assistance and '78.86.160.161' for the original idea. We poll and scrape the groups page for members and and message count.
* Active users (/5min)
 
* Number of messages (/5min)
 
* Total users
 
  
This bot runs on [[Babbage]] and has an HTTP interface that outputs: '''<tt>london-hack-spaceMessages:5 london-hack-spaceActiveUsers:2 london-hack-spaceTotalUsers:102</tt>'''
+
   http://groups.google.com/group/london-hack-space
   http://localhost:42002/
 
 
 
====Mailing list activity====
 
  
'''COMPLETE'''
+
We have a script that outputs: '''<tt>members:693 messages:3123</tt>'''
  
* My thanks to JamesG for his assistance and '78.86.160.161' for the original idea. We poll and scrape the groups page for members and and message count.
+
''Code:'' https://github.com/londonhackspace/monitoring
  
  http://groups.google.com/group/london-hack-space
+
===Space occupancy===
 +
''See project: [[Project:Spacensus|spacensus]]''
  
This script yields: '''<tt>members:693 messages:3123</tt>'''
+
[[Category:Projects]]
<pre>
+
[[Category:Infrastructure]]
  #!/bin/sh
+
[[Category:Space_Infrastructure_Projects]]
 
 
  PAGE=`curl -s http://groups.google.com/group/london-hack-space`
 
  if [ $? -ne 0 ]; then
 
    echo "NaN"
 
    exit 1;
 
  fi;
 
 
 
  MEMBERS=`echo $PAGE | egrep '<b>Members:</b> [0-9]+' | perl -e '<STDIN>=~m/.*<b>Members:<\/b> ([0-9]+).*/; print "$1\n"'`
 
  if [ $? -ne 0 ]; then
 
    echo "NaN"
 
    exit 1;
 
  fi;
 
 
 
  MESSAGES=`echo $PAGE | egrep '>[0-9]+ of [0-9]+ messages<' | perl -e '<STDIN>=~m/.*>[0-9]+ of ([0-9]+) messages<.*/; print "$1\n"'`
 
  if [ $? -ne 0 ]; then
 
    echo "NaN"
 
    exit 1;
 
  fi;
 
 
 
  echo "members:"$MEMBERS" messages:"$MESSAGES
 
</pre>
 

Latest revision as of 11:52, 5 January 2016

LHS Graphs and Visualizations


Members Elliot
QR code

Overview

I have supplemented the Cacti graphs that we have for LHS bandwidth and power with metrics that provide insight to the growth of our community and organisation over time.

To chart the metrics various bits of data are exposed in a Cacti friendly way.

Metrics

Number of members

We may have to wait 12 months before it becomes interesting.

This data is stored in an Sqlite database on Turing. See the Schema. It can be queried like so:

 SELECT COUNT(id)
 FROM users
 WHERE subscribed = true;

Cacti runs on chomsky but the members database is on Turing. There is a PHP script on Turing to expose the member numbers and then a script on chomsky to pull this in with a HTTP request.

Code: https://github.com/londonhackspace/monitoring

URL: http://london.hackspace.org.uk/member_stats.php

IRC statistics

See project: ircensus

Wiki statistics

  • We get this using the MediaWiki API:
 http://wiki.hackspace.org.uk/w/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml

It returns:

 <?xml version="1.0"?>
 <api>
   <query>
     <statistics
       pages="759"
       articles="215"
       views="229656"
       edits="7368"
       images="186"
       users="166"
       activeusers="22"
       admins="61"
       jobs="13"
     />
   </query>
 </api>


A Perl script generates the following output for cacti: pages:759 articles:215 views:229656 edits:7368 images:186 users:166 activeusers:22 admins:61 jobs:13

Code: https://github.com/londonhackspace/monitoring

Mailing list activity

  • My thanks to JamesG for his assistance and '78.86.160.161' for the original idea. We poll and scrape the groups page for members and and message count.
 http://groups.google.com/group/london-hack-space

We have a script that outputs: members:693 messages:3123

Code: https://github.com/londonhackspace/monitoring

Space occupancy

See project: spacensus