Skip to content

Commit

Permalink
COLLECTD_FACTER_INTERVAL env to specify interval
Browse files Browse the repository at this point in the history
facter can be a relativly expensive command
to run so reducing the collectd frequence
is very useful.

Unfortuantly collectd python does
not support this per python plugin.
[#717](collectd/collectd#717)

If set to a number of seconds this will be interval
for collectd_python.
  • Loading branch information
traylenator committed Nov 20, 2017
1 parent 33b9fd6 commit bc06a73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Environment Variables.
----------------------

- ``COLLECTD_FACTER_INTERVAL`` If set to a number
of seconds collectd_facter will read and publish data
at this interval. Work around for
https://github.com/collectd/collectd/issues/717
6 changes: 5 additions & 1 deletion collectd_facter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def shutdown():
# Register Callbacks
# -----------------------------------------------------------------------------
collectd.register_config(config)
collectd.register_read(read)
try:
interval = int(os.environ['COLLECTD_FACTER_INTERVAL'])
collectd.register_read(read,interval)
except KeyError, e:
collectd.register_read(read)
collectd.register_shutdown(shutdown)

0 comments on commit bc06a73

Please sign in to comment.