Example #1
0
 def _execute(
     self,
     *,
     selected_raw_sections: Optional[SelectedRawSections],
 ) -> SNMPRawData:
     # This is wrong
     configurator = cast(SNMPConfigurator, self.configurator)
     configurator.selected_raw_sections = selected_raw_sections  # checking only
     # End of wrong
     with SNMPFetcher.from_json(
             self.configurator.configure_fetcher()) as fetcher:
         return fetcher.fetch()
     raise MKAgentError("Failed to read data")
Example #2
0
 def _make_fetcher(self) -> SNMPFetcher:
     SNMPFetcher.plugin_store = make_plugin_store()
     return SNMPFetcher(
         self._make_file_cache(),
         sections=self._make_sections(),
         on_error=self._on_snmp_scan_error,
         missing_sys_description=config.get_config_cache().
         in_binary_hostlist(
             self.snmp_config.hostname,
             config.snmp_without_sys_descr,
         ),
         do_status_data_inventory=self.host_config.do_status_data_inventory,
         snmp_config=self.snmp_config,
     )
Example #3
0
 def _make_fetcher(self) -> SNMPFetcher:
     return SNMPFetcher(
         self._make_file_cache(),
         snmp_plugin_store=self._make_snmp_plugin_store(),
         disabled_sections=self._make_disabled_sections(),
         configured_snmp_sections=self._make_configured_snmp_sections(),
         inventory_snmp_sections=self._make_inventory_snmp_sections(),
         on_error=self.on_snmp_scan_error,
         missing_sys_description=config.get_config_cache().in_binary_hostlist(
             self.snmp_config.hostname,
             config.snmp_without_sys_descr,
         ),
         use_snmpwalk_cache=self.use_snmpwalk_cache,
         do_status_data_inventory=self.host_config.do_status_data_inventory,
         snmp_config=self.snmp_config,
     )
Example #4
0
 def _make_fetcher(self) -> SNMPFetcher:
     return SNMPFetcher(
         self._make_file_cache(),
         snmp_section_trees={
             s.name: s.trees for s in agent_based_register.iter_all_snmp_sections()
         },
         snmp_section_detects=self._make_snmp_section_detects(),
         configured_snmp_sections=self._make_configured_snmp_sections(),
         on_error=self.on_snmp_scan_error,
         missing_sys_description=config.get_config_cache().in_binary_hostlist(
             self.snmp_config.hostname,
             config.snmp_without_sys_descr,
         ),
         use_snmpwalk_cache=self.use_snmpwalk_cache,
         snmp_config=self.snmp_config,
     )
Example #5
0
 def _make_fetcher(self) -> SNMPFetcher:
     return SNMPFetcher(
         self._make_file_cache(),
         snmp_plugin_store=SNMPPluginStore({
             s.name: SNMPPluginStoreItem(s.trees, s.detect_spec)
             for s in agent_based_register.iter_all_snmp_sections()
         }),
         disabled_sections=self.host_config.disabled_snmp_sections(),
         configured_snmp_sections=self._make_configured_snmp_sections(),
         inventory_snmp_sections=self._make_inventory_snmp_sections(),
         on_error=self.on_snmp_scan_error,
         missing_sys_description=config.get_config_cache().
         in_binary_hostlist(
             self.snmp_config.hostname,
             config.snmp_without_sys_descr,
         ),
         use_snmpwalk_cache=self.use_snmpwalk_cache,
         do_status_data_inventory=self.host_config.do_status_data_inventory,
         snmp_config=self.snmp_config,
     )