diff --git a/agent_based/checkpoint_inv_base.py b/agent_based/checkpoint_inv_base.py index 511bac8ce8adaf4c47d1b7dfac0d50b195091621..db97bed68d0824899c4e33254a7a09ad5b699340 100644 --- a/agent_based/checkpoint_inv_base.py +++ b/agent_based/checkpoint_inv_base.py @@ -13,6 +13,7 @@ # 2020-11-28 : added available updates # 2021-02-08 : transfered license/support info to seperate plugin # 2021-02-22 : code cleanup +# 2021-03-05 : added hostlabel section # # sample string_table # [ @@ -28,11 +29,13 @@ from typing import List, NamedTuple from .agent_based_api.v1.type_defs import ( + HostLabelGenerator, StringTable, InventoryResult, ) from .agent_based_api.v1 import ( Attributes, + HostLabel, register, SNMPTree, startswith, @@ -85,16 +88,23 @@ def parse_checkpoint_inv_base(string_table: List[StringTable]) -> List: return section +def host_label_checkpoint_inv_base(section: List) -> HostLabelGenerator: + for invPath, key, value in section: + if key == 'appliance_series' and value.lower() == 'maestro': + yield HostLabel('checkpoint/device_type', 'maestro') + + def inventory_checkpoint_base(section: List) -> InventoryResult: for invPath, key, value in section: yield Attributes( - path= invPath, + path=invPath, inventory_attributes={key: value}) register.snmp_section( name='checkpoint_inv_base', parse_function=parse_checkpoint_inv_base, + host_label_function=host_label_checkpoint_inv_base, fetch=[ SNMPTree( base='.1.3.6.1.4.1.2620.1.6', # CHECKPOINT-MIB::svn @@ -129,4 +139,4 @@ register.snmp_section( register.inventory_plugin( name='checkpoint_inv_base', inventory_function=inventory_checkpoint_base, -) \ No newline at end of file +) diff --git a/inv_checkpoint_base.mkp b/inv_checkpoint_base.mkp index 9683670039ff5ad592bf8a64f7f5d0f4e1b5d4c3..c9c748a15e785762e82f228200a8f2f4dde31146 100644 Binary files a/inv_checkpoint_base.mkp and b/inv_checkpoint_base.mkp differ