From 8bbb822070c1a9d8f875c541c1072a2acbc77727 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 5 May 2023 13:50:18 +0200
Subject: [PATCH] make counter datadir user specific

---
 check_snmp_data.md  | 2 ++
 inc_pluginfunctions | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)
 create mode 100644 check_snmp_data.md

diff --git a/check_snmp_data.md b/check_snmp_data.md
new file mode 100644
index 0000000..8b3fbf1
--- /dev/null
+++ b/check_snmp_data.md
@@ -0,0 +1,2 @@
+# check_snmp_data
+
diff --git a/inc_pluginfunctions b/inc_pluginfunctions
index abc6128..3de16e7 100644
--- a/inc_pluginfunctions
+++ b/inc_pluginfunctions
@@ -33,7 +33,8 @@
 # 2022-10-25  v1.5  <axel.hahn@iml.unibe.ch> handle empty value in ph.perfadd
 # 2023-01-30  v1.6  <axel.hahn@unibe.ch>     check performance params 5+6 and show a warning if missing
 # 2023-02-16  v1.7  <axel.hahn@unibe.ch>     adding a generic min and max value did not really help
-# 2024-04-24  v1.8  <axel.hahn@unibe.ch>     fix unit conversion
+# 2023-04-24  v1.8  <axel.hahn@unibe.ch>     fix unit conversion
+# 2023-05-05  v1.9  <axel.hahn@unibe.ch>     user specific counter directory
 # ======================================================================
 
 
@@ -324,8 +325,8 @@ function ph.getFileAge(){
 function ph._getStorefile(){
         local varName=$1
 
-        local mydir="/tmp/icinga_counter"
-        test -n "$dir_data" && mydir="${dir_data}/_counter"
+        local mydir="/tmp/icinga_counter_$( whoami )"
+        test -n "$dir_data" && mydir="${dir_data}/_counter_$( whoami )"
         local _basename
         _basename=$(basename $0)
 
-- 
GitLab