ShMonitor
ShMonitor use ShTracerHost as backend for polling output of a command.
- class duetector.monitors.sh_monitor.ShTracerHost(backend, timeout=5)[source]
Bases:
objectHost for Shell, provide a way to poll shell command.
Use
subprocess.Popento run shell command.
- class duetector.monitors.sh_monitor.ShMonitor(config: dict[str, Any] | None = None, *args, **kwargs)[source]
Bases:
MonitorA monitor for shell command.
- property auto_init
Auto init tracers when init monitor.
- config_scope: str | None = 'monitor.sh'
Config scope for this monitor.
- default_config = {'auto_init': True, 'backend_args': {'max_workers': 10}, 'disabled': False, 'poller': {'call_when_shutdown': True, 'interval_ms': 500}, 'timeout': 5}
Default config for this monitor.
- Two sub-configs are available:
auto_init: Auto init tracers when init monitor.
timeout: Timeout for shell command.
- poll(tracer: ShellTracer)[source]
Poll a tracer. Should be implemented by subclass.
- property timeout
Timeout for shell command.