From 994eac76238e4ab81f69e35c4021fbd57b01e186 Mon Sep 17 00:00:00 2001 From: Kerri Wait <kerri.wait@monash.edu> Date: Mon, 14 Sep 2020 16:09:05 +1000 Subject: [PATCH] Add custom fact file for `hw_counters` fact in telegraf role --- roles/telegraf/files/hw_counters.fact | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 roles/telegraf/files/hw_counters.fact diff --git a/roles/telegraf/files/hw_counters.fact b/roles/telegraf/files/hw_counters.fact new file mode 100644 index 00000000..4abbd809 --- /dev/null +++ b/roles/telegraf/files/hw_counters.fact @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +import json +import os + +def render_data(data): + return json.dumps(data) + +device_name = 'mlx5_0' +hw_counters = {} +path = '/sys/class/infiniband/{}/ports/1/hw_counters/'.format(device_name) + +hw_counters[device_name] = os.listdir(path) + +print(render_data(hw_counters)) \ No newline at end of file -- GitLab