Vigilant is a Python framework for realtime, reactive process monitoring. Suppose we have a function read_voltage() which measures and returns a voltage. We can create a Monitor task to measure this voltage once per second:
from vigilant import Monitor
monitor = Monitor()
monitor.watch(read_voltage)
monitor.start(period=1)If you pass a threshold into the Monitor.watch() method, you can also define a reaction function to be called when a monitored variable exits the range. This can be used to alert operators to a failure, or to automatically bring the process back into the operational range:
def react():
print('Monitored variable out of range!')
monitor.watch(read_voltage, threshold=(0, 1), reaction=react)You can also subscribe to external data feeds, which will be monitored asynchronously and merged with the dataset during the monitoring cycle:
monitor.listen('voltage feed', address='127.0.0.1:9000')Vigilant provides a number of other features, including:
- Adding new monitored variables dynamically
- Plotting acquired data in realtime
- Automatically saving data to file
- Data feed with ZMQ to which external processes can subscribe for UI or analysis
- Scalable time-series storage using InfluxDB
These features are covered in the Tutorial notebook, which can also be run in the cloud from the Binder badge above.
Note: some computers have issues displaying the Plotly graphs in Chrome. If no plot appears when the Visualizer extension is loaded, try running in Firefox.