Módosítások

FederationStats

986 bájt hozzáadva, 2010. november 30., 16:20
Creating IdPs
Federation visualization project
* source (ruby on rails) https://repo.niif.hu/gitweb/gitweb.cgi?p=federation-stats.git;a=summary
* live demo httpshttp://papigw.aai.niifeduid.hu/fedstatsstats
== Running the sample project ==
#Config section
PARSER_COMMAND="/usr/localopt/shibboleth-vhoidp/bin/audit_r7.py"SOURCEDIR="/usr/localopt/shibboleth-vhoidp/logs"
TARGETDIR="/tmp"
ENTITYID="idp-entity-id""
APIKEY="aaa..."
LOCATION2PUT="https://fedstats.example.org/import_stats"
#Should not edit below this
DATE=`date -d "yesterday" +"%Y-%m-%d"`
SOURCEFILE="$SOURCEDIR/idp-audit-$DATE.log"
 
#Should not edit below this
if [ -f $SOURCEFILE ]
fi
</source>
 
The script below can be used the collect statistics from all the idp audit logs placed in a folder.
 
<source lang="bash">
#!/bin/bash
 
#Config section
PARSER_COMMAND="/opt/shibboleth-idp/bin/audit_r7.py"
SOURCEDIR="/opt/shibboleth-idp/logs"
TARGETDIR="/tmp"
 
ENTITYID="idp-entity-id"
APIKEY="aaa..."
LOCATION2PUT="https://fedstats.example.org/import_stats"
 
FILES="idp-audit-*.log"
 
#Should not edit below this
cd $SOURCEDIR
for f in $FILES
do
if [ -f $f ]
then
echo "Processing $f file..."
DATE=${f:10:10}
LOGINS=`$PARSER_COMMAND -l $f`
UNIQUE_LOGINS=`$PARSER_COMMAND -u $f`
SERVICES=`$PARSER_COMMAND -p $f | sed '/^[0-9]/p' -n`
 
TARGETFILE="stat-$DATE.log"
 
echo "ENTITYID $ENTITYID
APIKEY $APIKEY
DATE $DATE
 
STAT AUTH
$LOGINS
 
STAT USER_COUNT
$UNIQUE_LOGINS
 
STAT SSO_TO_SERVICE
$SERVICES
" > $TARGETDIR/$TARGETFILE
 
wget -q --no-check-certificate --post-file=$TARGETDIR/$TARGETFILE $LOCATION2PUT -O /dev/null
rm $TARGETDIR/$TARGETFILE
fi
done
</source>
== Creating IdPs ==
You must Use the rails console to create records for the IdPs from which the application accepts statistics. This could be done via the <code>/entities/new</code> URL. The name of the entity must be the entityID, the type must be 'idp'.idps:
$ RAILS_ENV=production script/console >> Entity.create :name => 'foo', :entity_type = API keys > 'idp' ===Every IdP record in the database will contain a > #<Entity id: 1, name: "foo", entity_type: "idp", created_at: "2010-11-29 14:55:40", updated_at: "2010-11-29 14:55:40 character length API key.", api_key: "da9l233a45698fa5c4a252e301e3da2sf5ece24e">
[[Category:Csonkok]]
565
szerkesztés

Navigációs menü