Script to generate StAR format storage accounting records on Ceph systems, to be ingested by APEL. Tested with Python 3.7, but versions 3.x should also work.
Dependencies:
python_dateutil==2.8.2
Script usage:
Usage: python3 star_accounting_ceph.py [options]
Options:
-h, --help show this help message and exit
-v VALID_DURATION, --valid_duration=VALID_DURATION
how long the storage record will be valid for (in
seconds) [default: 3600]
-p PREFIX, --prefix=PREFIX
prefix of storage record filename [default: ceph-
storage-record]
-q QUEUE, --queue=QUEUE
location of message queue where storage record will be
stored [default: /var/spool/apel/outgoing]
Example storage record (see docs for info on properties):
<?xml version="1.0" ?>
<sr:StorageUsageRecords xmlns:sr="http://eu-emi.eu/namespaces/2011/02/storagerecord">
<sr:StorageUsageRecord>
<sr:RecordIdentity sr:createTime="2022-02-17T13:07:50Z" sr:recordId="ceph.host.org/sr/14423"/>
<sr:StorageSystem>ceph.host.org</sr:StorageSystem>
<sr:StorageShare>bobs-bucket</sr:StorageShare>
<sr:FileCount>3</sr:FileCount>
<sr:SubjectIdentity>
<sr:LocalUser>bob</sr:LocalUser>
</sr:SubjectIdentity>
<sr:MeasureTime>2022-01-22T12:53:02Z</sr:MeasureTime>
<sr:ValidDuration>PT3600S</sr:ValidDuration>
<sr:ResourceCapacityUsed>97698</sr:ResourceCapacityUsed>
<sr:LogicalCapacityUsed>102400</sr:LogicalCapacityUsed>
<sr:ResourceCapacityAllocated>-1</sr:ResourceCapacityAllocated>
</sr:StorageUsageRecord>
</sr:StorageUsageRecords>