565
szerkesztés
Módosítások
→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 ==
== Running the log statistics collector ==
This following script can be used the collect statistics from the idp audit logs of Shibboleth 2 IdPgenerated on the day before running. It is based on Peter ScoberSchober's audit_r7.py, and good for run from daily cronjob:
<source lang="bash">
#!/bin/bash
ENTITYID="idp-entity-id"
wget -q --no-check-certificate --post-file=$TARGETDIR/$TARGETFILE $LOCATION2PUT -O /dev/null
rm $TARGETDIR/$TARGETFILE
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
DATE $DATE
STAT USER_COUNT
$USERSUNIQUE_LOGINS
STAT SSO_TO_SERVICE
$SERVICES
" > $TARGETDIR/$FILENAMETARGETFILE
wget -q --no-check-certificate --post-file=$TARGETDIR/$TARGETFILE $LOCATION2PUT -O /dev/null rm $TARGETDIR/$TARGETFILE fidone #for files
</source>
The federation statistics rails project contains the <code>script/stat_parser/file.rb</code> command which can process the statistics format and load the data to the database. Note that this script currently contains an absolute path for the <code>script/runner</code> script, so you must fix this before use.
== Using HTTP-Post to feed the database ==
When deployed, the rails project provides a <code>/import_stats</code> URL to which one could POST the generated statistics file.
== Creating IdPs ==
Use the rails console to create new idps:
$ RAILS_ENV=production script/console
>> Entity.create :name => 'foo', :entity_type => 'idp'
=> #<Entity id: 1, name: "foo", entity_type: "idp", created_at: "2010-11-29 14:55:40", updated_at: "2010-11-29 14:55:40", api_key: "da9l233a45698fa5c4a252e301e3da2sf5ece24e">
[[Category:Csonkok]]