Skip to content

Commit

Permalink
Merge pull request #134 from Panos512/20240307_unifies_cms_space_probe
Browse files Browse the repository at this point in the history
CMS: unifies metric for CMS space probe
  • Loading branch information
ericvaandering authored Mar 21, 2024
2 parents 8221e05 + aabfccd commit 2eb81e2
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions cms/check_used_space
Original file line number Diff line number Diff line change
Expand Up @@ -57,44 +57,47 @@ if __name__ == '__main__':

# Calculate free rucio space of RSE and push it
if usage['source'] == 'rucio':
prom_labels['source'] = 'rucio_free_space'
source = 'rucio_free_space'
prom_labels['source'] = source
rucio_used = usage['used']
rucio_free_space = int(usage['total']) - int(usage['used'])
(manager.gauge(name='rucio_free_space',
(manager.gauge(name='rucio_space',
documentation='Space used at an RSE from various sources', labelnames=label_names)
.labels(**prom_labels)
.set(rucio_free_space))
print(rse['rse'], country, rse_type, 'rucio_free_space', rucio_free_space)
print(rse['rse'], country, rse_type, source, rucio_free_space)

# Calculate total free space of RSE (static-rucio) and push it
if usage['source'] == 'static':
static_used = usage['used']

if rucio_used and static_used:
prom_labels['source'] = 'free_space'
source = 'free_space'
prom_labels['source'] = source
free_space = int(static_used) - int(rucio_used)
(manager.gauge(name='free_space',
(manager.gauge(name='rucio_space',
documentation='Space used at an RSE from various sources', labelnames=label_names)
.labels(**prom_labels)
.set(free_space))
print(rse['rse'], country, rse_type, 'free_space', free_space)
print(rse['rse'], country, rse_type, source, free_space)

source = usage['source']
prom_labels['source'] = source
(manager.gauge(name='{source}',
(manager.gauge(name='rucio_space',
documentation='Space used at an RSE from various sources', labelnames=label_names)
.labels(**prom_labels)
.set(usage['used']))
print(rse['rse'], country, rse_type, source, usage['used'])

# export and push `MinFreeSpace` value from RSE limits
if limits.get('MinFreeSpace'):
prom_labels['source'] = 'min_free_space'
(manager.gauge(name='min_free_space',
source = 'min_free_space'
prom_labels['source'] = source
(manager.gauge(name='rucio_space',
documentation='Space used at an RSE from various sources', labelnames=label_names)
.labels(**prom_labels)
.set(limits.get('MinFreeSpace')))
print(rse['rse'], country, rse_type, 'min_free_space', limits.get('MinFreeSpace'))
print(rse['rse'], country, rse_type, source, limits.get('MinFreeSpace'))
except:
print(traceback.format_exc())
sys.exit(UNKNOWN)

0 comments on commit 2eb81e2

Please sign in to comment.