From 69558d51cceba1a1f4be94dc21fef02c1c9d9170 Mon Sep 17 00:00:00 2001 From: aayush-bhardwaj Date: Wed, 8 Nov 2017 10:28:00 +0530 Subject: [PATCH] Changes in writ_json to correct the directory structure for linux sample data collected in the server. desired structure - /var/lib/data/linux/cpustatic and similar for other linux plugins. --- write_json.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/write_json.py b/write_json.py index 535976c..33f7179 100644 --- a/write_json.py +++ b/write_json.py @@ -20,7 +20,13 @@ def datadict_to_dirname(self, data): if PLUGIN not in data: collectd.error("Plugin values not set") return None - path = os.path.join(self.path, DATADIR, data[PLUGIN]) + # path = os.path.join(self.path, DATADIR, data[PLUGIN]) + + if(data[PLUGIN] == "linux"): + path = os.path.join(self.path, DATADIR, data[PLUGIN] + "/" + data[PLUGINTYPE]) + else: + path = os.path.join(self.path, DATADIR, data[PLUGIN]) + if PLUGIN_INS in data: path = os.path.join(path, data[PLUGIN_INS]) return path