def read_temp(self): """Collectd first calls register_read. At that time default interval is taken, hence temporary function is made to call, the read callback is unregistered and read() is called again with interval obtained from conf by register_config callback.""" collectd.unregister_read(self.read_temp) collectd.register_read(self.collect_jmx_data, interval=int(self.interval))
def init(): global sht21, lock_file, lock_handle if lock_file: # Try to open lock file, in case of failure proceed without locking try: lock_handle = open(lock_file, 'w') except IOError as e: collectd.error('sht21 plugin: Could not open lock file: %s' % e) collectd.error('Proceeding without locking') try: sht21 = SHT21(1) collectd.info('sht21 user-mode plugin initialized') except IOError as e: collectd.error('sht21 plugin: Could not initialize: %s' % e) collectd.unregister_read(read)
def read_temp(self): collectd.unregister_read(self.read_temp) collectd.register_read(self.read, interval=int(self.interval))