From aacbf55f346024fab8e2c7c62cc8be6b0b9a989a Mon Sep 17 00:00:00 2001 From: Kevin Alberts Date: Sat, 25 Apr 2020 14:35:46 +0200 Subject: [PATCH] Fix collectd plugin --- collectd_plugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/collectd_plugin.py b/collectd_plugin.py index ea33c4f..135c6d9 100644 --- a/collectd_plugin.py +++ b/collectd_plugin.py @@ -5,7 +5,7 @@ import re import time HOSTNAME = os.getenv('COLLECTD_HOSTNAME', "localhost") -INTERVAL = os.getenv('COLLECTD_INTERVAL', 60) +INTERVAL = int(os.getenv('COLLECTD_INTERVAL', '60')) FILENAME = "/tmp/spitfire_smbspy_status.txt" SMB_STATUS_REGEX = re.compile(r'Spitfire SMB has (?P[0-9]+) file\(s\) opened by (?P[0-9]+) user\(s\) \((?P[0-@9]+) active users\)\.') @@ -48,10 +48,10 @@ while True: if http_noopen_match: http_current_transfers, http_current_users = 0, 0 - print("PUTVAL \"{}/shares/smb_open_connections\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_users)) - print("PUTVAL \"{}/shares/smb_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_active_users)) - print("PUTVAL \"{}/shares/smb_open_files\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_files)) - print("PUTVAL \"{}/shares/http_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_users)) - print("PUTVAL \"{}/shares/http_open_transfers\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_transfers)) + print("PUTVAL \"{}/shares/gague-smb_open_connections\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_users)) + print("PUTVAL \"{}/shares/gague-smb_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_active_users)) + print("PUTVAL \"{}/shares/gague-smb_open_files\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_files)) + print("PUTVAL \"{}/shares/gague-http_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_users)) + print("PUTVAL \"{}/shares/gague-http_open_transfers\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_transfers)) time.sleep(INTERVAL)