From 0fc112284fbc1d404c9e00574f2d10ea247d349d Mon Sep 17 00:00:00 2001
From: "Phaidra Developers (phkug03)" <devel.phaidra@univie.ac.at>
Date: Sat, 27 Mar 2021 02:59:48 +0100
Subject: [PATCH] method to access other collections

---
 modules/util/Util/Monitoring.pm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules/util/Util/Monitoring.pm b/modules/util/Util/Monitoring.pm
index 4191e0d..be4e2e4 100644
--- a/modules/util/Util/Monitoring.pm
+++ b/modules/util/Util/Monitoring.pm
@@ -158,6 +158,24 @@ sub read_config
   1;
 }
 
+sub get_collection
+{
+  my $self= shift;
+  my $name= shift;
+
+  my $col_handle= '_'. $name;
+  return $self->{$col_handle} if (exists($self->{$col_handle}));
+
+  my $mon_cfg= $self->{mon_cfg};
+  my $paf= $mon_cfg->{'AgentDB'};
+  my $col_name= setup_default_collection ($paf, $name);
+
+  my $mdb= $self->{_mdb};
+  my $col= $mdb->get_collection($col_name);
+  $self->{$col_handle}= $col;
+  $col;
+}
+
 sub get_config
 {
   my $obj= shift;
-- 
GitLab