# Copyright (C) 2005-2024 Splunk Inc. All Rights Reserved. import sys from splunk.clilib.bundle_paths import make_splunkhome_path sys.path.append(make_splunkhome_path(['etc', 'apps', 'SA-ITOA', 'lib'])) sys.path.append(make_splunkhome_path(['etc', 'apps', 'SA-ITOA', 'lib', 'SA_ITOA_app_common'])) import itsi_path from itsi_py3 import _ from ITOA.itoa_config import get_supported_objects from ITOA.itoa_common import modular_input_should_run from ITOA.setup_logging import getLogger4ModInput from ITOA.mod_input_utils import skip_run_during_migration from maintenance_services.maintenance_operations.operative_maintenance_log import OperativeMaintenanceLog from SA_ITOA_app_common.solnlib.modular_input import ModularInput class MaintenanceMinderModularInput(ModularInput): """ Mod input dodicated to populate operative maintenance log for maintenance services """ title = _("Maintenance Minder Modular Input") description = _("Maintenance minder to populate operative maintenance " \ "log for maintenance services.") handlers = None app = 'SA-ITOA' name = 'maintenance_minder' use_single_instance = False use_kvstore_checkpointer = False use_hec_event_writer = False def extra_arguments(self): return [{ 'name' : "log_level", 'title' : _("Logging Level"), 'description' : _("This is the level at which the modular input will log data.") }] @skip_run_during_migration def do_run(self, input_config): """ - This is the method called by splunkd when mod input is enabled. @type: object @param input_config: config passed down by splunkd """ logger = getLogger4ModInput(input_config) if not modular_input_should_run(self.session_key, logger=logger): logger.info("Will not run modular input on this node.") return OperativeMaintenanceLog(self.session_key).populate_operative_maintenance_log() if __name__ == "__main__": worker = MaintenanceMinderModularInput() worker.execute()