Skip to content

Instantly share code, notes, and snippets.

@haarcuba
Created March 23, 2016 23:06
Show Gist options
  • Save haarcuba/25a989a297259cab0941 to your computer and use it in GitHub Desktop.
Save haarcuba/25a989a297259cab0941 to your computer and use it in GitHub Desktop.
Collectd null write plugin - a write outlet that does nothing (prevents collectd from complaining that is has no write channels)
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/path/to/write_null" # write_null is a folder with an __init__.py inside
LogTraces true
Import "write_null"
<Module write_null>
</Module>
</Plugin>
import collectd
import time
def write(vl, data=None):
pass
def config(*args, **kwargs):
thefile=open('/tmp/proofItWorks','w')
thefile.write( '{0} Im alive!\n'.format( time.asctime() ) )
thefile.close()
collectd.register_write(write);
collectd.register_config(config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment