SG Accounting Client Installation
From EGEE-see WIki
The goal of the accounting client is to transmit aggregated accounting information to the web service at gserv1.ipp.acad.bg, with the aim to be able to produce usage summaries, which include information about the applications and/or institutes for the users. Thus only aggregated information about DNs is transferred, the individual DNs of the users are kept locally.
This guide assumes that you have already properly working MON box, which reports accounting information either to the EGEE or to the SEE-GRID registry. You can follow:
http://wiki.egee-see.org/index.php/SG_RGMA_Installation_Guide
for the R-GMA/APEL configuration.
In order to install the accounting, one needs to use a non-root account at some node
that has at least read-only access to the database accounting at the site's MON box, and has access to a valid proxy.
The easiest setup is achieved by using user tomcat4 at the MON box.
The latest version of the accounting publisher client requires also that the database user USERNAME can create temporary tables. In mysql the setting of permissions for temporary tables is not organized in the best way, and we have to use a workaround. You need to login to mysql as root:
mysql -u root -pmysqlrootpasswrd
(password is in most cases in site-info.def).
and perform the following commands:
CREATE DATABASE tmp; GRANT CREATE TEMPORARY TABLES, SELECT, INSERT, UPDATE, DELETE, DROP, ALTER ON tmp.* TO 'USERNAME'@'HOSTNAME'
where USERNAME is the database user (not necessarily equal to the unix user), hostname is usually your MONBOX hostname.
If you had previous version of accounting publisher, use the same database username for that. If you decide to use the database user accounting, there is the disadvantage that it has write access to the real data, although the publisher only needs read access. If you decide to create a new database user, say 'tomcat4', you can do the following at mysql root prompt (replace STRONGPASSWORD with a strong password of choice):
GRANT SELECT on accounting.* to 'tomcat4'@'MONBOXHOSTNAME' identified by 'STRONGPASSWORD'; CREATE DATABASE tmp; GRANT SELECT, INSERT, UPDATE, DELETE, DROP, ALTER, CREATE TEMPORARY TABLES ON tmp.* TO 'tomcat4'@'MONBOXHOSTNAME';
After that you can proceed with the deployment.
Download the accounting bundle with this lfn:
lfn:/grid/seegrid/seegrid_acct-0.4
which corresponds to
srm://se03.grid.acad.bg/pnfs/grid.acad.bg/data/seegrid/generated/2008-02-14/file4e261ea7-58a7-4072-b982-f8829ace2442
with a command like:
globus-url-copy gsiftp://se03.grid.acad.bg/pnfs/grid.acad.bg/data/seegrid/generated/2008-02-14/file4e261ea7-58a7-4072-b982-f8829ace2442
file://`pwd`/seegrid_acct-0.4.tar.gz
(You need to be a member of seegrid VO to do that.) Check its sha1sum:
sha1sum seegrid_acct-0.4.tar.gz 0367c403c659989e5dd32c3b1a7dbe4fa6e63212 seegrid_acct-0.4.tar.gz
which MUST be as shown above, and transfer it to the home directory of the user you are going to use, e.g., via scp.
Login to this user account. Supposing it is tomcat4 on MON:
su - tomcat4
Untar the bundle, creating a directory seegrid_apps_acct:
tar zxvf seegrid_acct-0.4.tar.gz
Change to this directory.
cd seegrid_apps_acct
Edit jvr.sh to fill in the details about SITENAME (do not use the variable $SITENAME! Replace with the name of your site in HGSM, e.g. BA-01-ETFBL), database name (accounting), etc. In most cases DBUSERNAME will be either 'tomcat4' (if you follow the advice above) or 'accounting'. DBPASSWORD should be the mysql password of the database user $DBUSERNAME.
The default way to obtain a proxy is from the hostcert and key copies available to user tomcat4:
grid-proxy-init -cert /etc/tomcat5/hostcert.pem -key /etc/tomcat5/hostkey.pem -out tmpproxy
If you are using different user, change accordingly.
Run jvr.sh by hand
./jvr.sh
until you get it to publish something (look at the output, it should complete within a few minutes at most).
Check which is the path to a working java interpreter - which java should give you something like /usr/java/j2sdk1.4.2_12/bin/java, so the path is /usr/java/j2sdk1.4.2_12/bin
Now choose random time and make it publish the accounting data once per day - as user tomcat4 do
crontab -e
and add the following (one line):
42 10 * * * cd seegrid_apps_acct; export PATH=/usr/java/j2sdk1.4.2_12/bin:$PATH:/usr/bin:/opt/globus/bin ; ./jvr.sh >> accounting_log 2>&1
Please change at least the minutes, otherwise everybody will try to publish at the same time! Also use the right path to java for your system instead of /usr/java/j2sdk1.4.2_12/bin.
The addition of /opt/globus/bin and /usr/java/j2sdk1.4.2_12/bin to the PATH is done in order for grid-proxy-init and java to be succesful. If you have upgraded your JDK to higher version, change the path accordingly.
Look for errors in the console or accounting.log in the same directory where you deployed. With this version data is published in two ways - first for all VOs, then with some additional application specific information for SEE-GRID VO.
For any question or problems, contact me - Emanouil Atanassov
Good luck
