fix: remove redundant no-commands log lines; fix skip_reason docstring style
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ class Plugin(ABC):
|
|||||||
description: Human-readable description
|
description: Human-readable description
|
||||||
interval: Collection interval in seconds (0 for InfoPlugin = collect once)
|
interval: Collection interval in seconds (0 for InfoPlugin = collect once)
|
||||||
enabled: Whether plugin is active (can be disabled via config)
|
enabled: Whether plugin is active (can be disabled via config)
|
||||||
skip_reason: Optional[str] = None # Set before returning False from initialize() so loader logs INFO not WARNING
|
skip_reason: Set by plugin before returning False from initialize(); causes loader to log INFO instead of WARNING.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
name: str = ""
|
name: str = ""
|
||||||
|
|||||||
@@ -79,12 +79,6 @@ class NagiosRunnerPlugin(MonitorPlugin):
|
|||||||
self.shell: bool = config.get("shell", True) if config else True
|
self.shell: bool = config.get("shell", True) if config else True
|
||||||
self.interval = config.get("interval", 300) if config else 300
|
self.interval = config.get("interval", 300) if config else 300
|
||||||
|
|
||||||
# Validate commands
|
|
||||||
if not self.commands:
|
|
||||||
self.logger.info(
|
|
||||||
"No Nagios commands configured. Add 'nagios_runner.commands' to config."
|
|
||||||
)
|
|
||||||
|
|
||||||
async def initialize(self) -> bool:
|
async def initialize(self) -> bool:
|
||||||
"""Initialize the Nagios runner plugin.
|
"""Initialize the Nagios runner plugin.
|
||||||
|
|
||||||
@@ -95,7 +89,6 @@ class NagiosRunnerPlugin(MonitorPlugin):
|
|||||||
|
|
||||||
if not self.commands:
|
if not self.commands:
|
||||||
self.skip_reason = "no commands configured (add nagios_runner.commands to config)"
|
self.skip_reason = "no commands configured (add nagios_runner.commands to config)"
|
||||||
self.logger.info("No Nagios commands configured")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.logger.info(f"Configured to run {len(self.commands)} Nagios plugin(s)")
|
self.logger.info(f"Configured to run {len(self.commands)} Nagios plugin(s)")
|
||||||
|
|||||||
Reference in New Issue
Block a user