Only specify interval if we receive one from collectd

This commit is contained in:
Lance Edgar 2021-11-27 15:15:17 -06:00
parent 6b35ca5ada
commit 6a2454c212

View file

@ -243,15 +243,20 @@ class DataSync(Subcommand):
hostname = os.environ.get('COLLECTD_HOSTNAME')
if not hostname:
hostname = socket.getfqdn()
if not interval:
interval = os.environ.get('COLLECTD_INTERVAL', 10)
interval = os.environ.get('COLLECTD_INTERVAL')
if interval:
interval = ' interval={}'.format(interval)
else:
interval = ''
if now:
value = '{}:{}'.format(now.timestamp(), value)
else:
value = 'N:{}'.format(value)
msg = 'PUTVAL {}/{}/{} interval={} {}\n'.format(
msg = 'PUTVAL {}/{}/{}{} {}\n'.format(
hostname,
plugin,
data_type,