libgs.monitoring.Monitor.register_monitor

Monitor.register_monitor(name, gen, dt=-1, parent=None, loglvl_values=None, loglvl_alerts=10, logthr_alerts=30, dependents=(), alert_exc=<class 'libgs.monitoring.NoAlert'>)[source]

This is a low level function to register a monitor generator with the monitor class.

The format of the generator is quite specific, and it should therefore ideally have been created from a callable using the to_gen_in_executor() method. Using this method will ensure the generator returns values in the right format for the monitor class, and that it never blocks.

Parameters:
  • name – The name of the monitor point
  • gen – The monitor generator (* see description above)
  • dt – The time interval in which to poll the monitored (dt = None -> one shot)
  • parent – Assign a parent to the monitored (For grouping purposes only) If the parent does not exist, it will be created.
  • loglvl_values – If not None, any change in value will be logged with the logging level specified.
  • loglvl_alerts – If not None, a change in alert level may be logged with the logging level specified
  • logthr_alerts – The threshold for the alertcode above by which to log. Default = RedAlert.alertcode
  • dependents – Other monitors to update from same generator
  • alert_exc – Alert to set in case an exception is raised in monitor function. Default = NoAlert