Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit e483ffbf authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

added drop broadcast IPs

parent bbe04484
Branches master
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/inv_lnx_if_ip-0.0.4-20241210.mkp "inv_lnx_if_ip-0.0.4-20241210.mkp"
[PACKAGE]: ../../raw/master/mkp/inv_lnx_if_ip-0.0.5-20250124.mkp "inv_lnx_if_ip-0.0.5-20250124.mkp"
# Extended IP-Address inventory for Linux hosts
This plugin extends the IP-Address inventory of Linux hosts by:
......
File added
......@@ -12,6 +12,8 @@
# 2024-12-06: incompatible: changed hostlabel to nvdct/l3v4_topology:host and nvdct/l3v4_topology:router
# 2024-12-09: rewritten for CMK checkAPI 2.0
# 2024-12-10: added host label nvdct/l3v6_topology:host and nvdct/l3v6_topology:router
# 2025-01-21: added drop broadcast IPs
# 2025-01-24: fixed crash on bad prefix-length (to long for the ip version i.e. 33 for ipv4)
from collections.abc import MutableMapping, MutableSequence, Sequence
from dataclasses import dataclass, field
......@@ -79,7 +81,7 @@ def host_label_lnx_ip_address(section: SectionInventory) -> HostLabelGenerator:
for raw_interface_ip in raw_interface_ips:
try:
interface_ip = ip_interface(raw_interface_ip)
except (AddressValueError, NetmaskValueError):
except (AddressValueError, NetmaskValueError,ValueError):
continue
if interface_ip.version == 4 and not interface_ip.is_loopback:
valid_v4_ips += 1
......@@ -119,6 +121,9 @@ def inventory_lnx_if_ip(section: SectionInventory) -> InventoryResult:
except (AddressValueError, NetmaskValueError):
continue
if interface_ip.ip.compressed == interface_ip.network.broadcast_address.compressed:
continue # drop broadcast IPs
yield TableRow(
path=["networking", "addresses"],
key_columns={
......
......@@ -10,7 +10,7 @@
'cmk_addons_plugins': ['inv_ip_address/agent_based/inv_lnx_ip_address.py']},
'name': 'inv_lnx_if_ip',
'title': 'Extended inventory for IP-addresses on Linux hosts',
'version': '0.0.4-20241210',
'version': '0.0.5-20250124',
'version.min_required': '2.3.0b1',
'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': '2.4.0b1'}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment