Módosítások

FederationStats

1 389 bájt hozzáadva, 2022. október 24., 15:27
Federation usage statistics
{{TODO_EN|I am a stub, please fix me!}}
Federation visualization project- discountinued.
* source (ruby on rails) https://repo.niif.hu/gitweb/gitweb.cgi?p=federation-stats.git;a=summary
* live demo https://papigw.aai.niif.hu/fedstats
== 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 Schober's audit_r7.py, and good for run from daily cronjob:
<source lang="bash">
#!/bin/bash
FILES#Config sectionPARSER_COMMAND="/opt/shibboleth-idp/bin/audit_r7.py"SOURCEDIR="/opt/shibboleth-idp/logs"TARGETDIR="/tmp" ENTITYID="idp-entity-id"APIKEY="aaa..."LOCATION2PUT="loghttps://fedstats.example.org/import_stats" DATE=`date -d "yesterday" +"%Y-%m-directory%d"`SOURCEFILE="$SOURCEDIR/idp-audit-*$DATE.log" #Should not edit below this if [ -f $SOURCEFILE ]then LOGINS=`$PARSER_COMMAND -l $SOURCEFILE` UNIQUE_LOGINS=`$PARSER_COMMAND -u $SOURCEFILE` SERVICES=`$PARSER_COMMAND -p $SOURCEFILE | sed '/^[0-9]/p' -n`  TARGETFILE="stat-$DATE.log" echo "ENTITYID $ENTITYIDAPIKEY $APIKEYDATE $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/$TARGETFILEfi </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 sectionPARSER_COMMAND="/opt/shibboleth-idp/bin/audit_r7.py"SOURCEDIR="/opt/shibboleth-idp/logs"TARGETDIR="/tmp/stats
ENTITYID="idp-entity-id"
APIKEY="aaa....."AUDITLOCATION2PUT="https:/path/tofedstats.example.org/audit_r7.pyimport_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=`$AUDIT PARSER_COMMAND -l $f` USERS UNIQUE_LOGINS=`$AUDIT PARSER_COMMAND -u $f` SERVICES=`$AUDIT PARSER_COMMAND -p $f | sed '/^[0-9]/p' -n` FILENAME="stat-$f"
TARGETFILE="stat-$DATE.log"  echo "ENTITYID $ENTITYID
APIKEY $APIKEY
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>
== 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]]

Navigációs menü