Skip to content

Commit 65657d7

Browse files
committed
19078 FIX Fix rate calculation in clustered interface checks
SUP-26175 Change-Id: I7a13638879e7d68508f900401ced0b5ddce516de
1 parent a06ce34 commit 65657d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+540
-291
lines changed

.werks/19078.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[//]: # (werk v2)
2+
# Fix rate calculation in clustered interface checks
3+
4+
key | value
5+
---------- | ---
6+
date | 2026-01-07T21:06:40+00:00
7+
version | 2.4.0p19
8+
class | fix
9+
edition | cre
10+
component | checks
11+
level | 1
12+
compatible | yes
13+
14+
Depending on the monitored device, clustered interface checks might have reported incorrect or missing rates.
15+
Note that this only affected clustered services using the native cluster mode.

cmk/plugins/aws/agent_based/aws_ec2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ def check_aws_ec2_network_io(
172172
out_octets=section["NetworkOut"] / 60,
173173
),
174174
get_rate_errors=[],
175+
timestamp=time.time(),
175176
),
176-
timestamp=time.time(),
177177
value_store=get_value_store(),
178178
params=params,
179179
)

cmk/plugins/aws/agent_based/aws_rds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def check_aws_rds_network_io(
124124
out_octets=metrics["NetworkTransmitThroughput"],
125125
),
126126
get_rate_errors=[],
127+
timestamp=time.time(),
127128
),
128-
timestamp=time.time(),
129129
value_store=get_value_store(),
130130
params=params,
131131
)

cmk/plugins/azure/agent_based/azure_virtual_machine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ def check_azure_vm_network_io(
469469
),
470470
rates=interfaces.Rates(in_octets=in_octets, out_octets=out_octets),
471471
get_rate_errors=[],
472+
timestamp=time.time(),
472473
),
473-
timestamp=time.time(),
474474
value_store=get_value_store(),
475475
params=params,
476476
)

cmk/plugins/collection/agent_based/aix_if.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
44
# conditions defined in the file COPYING, which is part of this source code package.
55

6+
import time
7+
68
from cmk.agent_based.v2 import AgentSection, StringTable
79
from cmk.plugins.lib import interfaces
810

@@ -20,6 +22,7 @@ def _consume_down_interfaces(string_table: StringTable) -> tuple[list[str], int]
2022

2123
def _parse_aix_common( # pylint: disable=too-many-branches
2224
string_table: StringTable,
25+
timestamp: float,
2326
) -> tuple[dict[str, interfaces.InterfaceWithCounters], dict[str, list[str]]]:
2427
ifaces = {}
2528
flags = {}
@@ -36,6 +39,7 @@ def _parse_aix_common( # pylint: disable=too-many-branches
3639
type="24" if nic.startswith("lo") else "6",
3740
),
3841
interfaces.Counters(),
42+
timestamp=timestamp,
3943
)
4044
elif line[0] == "Bytes:" and line[2] == "Bytes:":
4145
iface.counters.out_octets = interfaces.saveint(line[1])
@@ -69,9 +73,10 @@ def _parse_aix_common( # pylint: disable=too-many-branches
6973

7074
def _parse_aix_if_ifconfig_augmented(
7175
string_table: StringTable,
76+
timestamp: float,
7277
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
7378
interfaces_in_down_state, idx = _consume_down_interfaces(string_table)
74-
ifaces, flags = _parse_aix_common(string_table[idx:])
79+
ifaces, flags = _parse_aix_common(string_table[idx:], timestamp)
7580
for nic, iface in ifaces.items():
7681
iface.attributes.oper_status = "2" if nic in interfaces_in_down_state else "1"
7782
iface.attributes.finalize()
@@ -80,8 +85,9 @@ def _parse_aix_if_ifconfig_augmented(
8085

8186
def _parse_aix_if_entstat_only(
8287
string_table: StringTable,
88+
timestamp: float,
8389
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
84-
ifaces, flags = _parse_aix_common(string_table)
90+
ifaces, flags = _parse_aix_common(string_table, timestamp)
8591

8692
for nic, iface in ifaces.items():
8793
iface_flags = flags.get(nic, [])
@@ -99,12 +105,21 @@ def _parse_aix_if_entstat_only(
99105
return list(ifaces.values())
100106

101107

108+
def parse_aix_if_pure(
109+
string_table: StringTable,
110+
timestamp: float,
111+
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
112+
return (
113+
_parse_aix_if_ifconfig_augmented(string_table, timestamp)
114+
if string_table[0][0] == "[interfaces_in_down_state]"
115+
else _parse_aix_if_entstat_only(string_table, timestamp)
116+
)
117+
118+
102119
def parse_aix_if(
103120
string_table: StringTable,
104121
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
105-
if string_table[0][0] == "[interfaces_in_down_state]":
106-
return _parse_aix_if_ifconfig_augmented(string_table)
107-
return _parse_aix_if_entstat_only(string_table)
122+
return parse_aix_if_pure(string_table, time.time())
108123

109124

110125
agent_section_aix_if = AgentSection(

cmk/plugins/collection/agent_based/cadvisor_if.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def check_cadvisor_if(item: str, section: Section) -> CheckResult:
9191
out_disc=section["if_out_discards"],
9292
out_err=section["if_out_errors"],
9393
),
94+
timestamp=time.time(),
9495
),
95-
timestamp=time.time(),
9696
value_store=get_value_store(),
9797
params={},
9898
),

cmk/plugins/collection/agent_based/emc_vplex_if.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
44
# conditions defined in the file COPYING, which is part of this source code package.
55

6+
import time
67
from collections.abc import Sequence
78

89
from cmk.agent_based.v2 import OIDEnd, SNMPSection, SNMPTree, StringTable
910
from cmk.plugins.lib import interfaces
1011
from cmk.plugins.lib.emc import DETECT_VPLEX
1112

1213

13-
def parse_emc_vplex_if(
14+
def parse_emc_vplex_if_pure(
1415
string_table: Sequence[StringTable],
16+
timestamp: float,
1517
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
1618
directors = {}
1719
for director, ip in string_table[0]:
@@ -32,11 +34,18 @@ def parse_emc_vplex_if(
3234
in_octets=int(frontend_info[1]),
3335
out_octets=int(frontend_info[2]),
3436
),
37+
timestamp=timestamp,
3538
)
3639
for idx, frontend_info in enumerate(string_table[1] + string_table[2])
3740
]
3841

3942

43+
def parse_emc_vplex_if(
44+
string_table: Sequence[StringTable],
45+
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
46+
return parse_emc_vplex_if_pure(string_table, timestamp=time.time())
47+
48+
4049
snmp_section_emc_vplex_if = SNMPSection(
4150
name="emc_vplex_if",
4251
parse_function=parse_emc_vplex_if,

cmk/plugins/collection/agent_based/hitachi_hnas_fc_if.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
44
# conditions defined in the file COPYING, which is part of this source code package.
55

6+
import time
67
from collections.abc import Sequence
78

89
from cmk.agent_based.v2 import CheckPlugin, RuleSetType, SNMPSection, SNMPTree, StringTable
@@ -12,6 +13,7 @@
1213
def parse_hitachi_hnas_fc_if(
1314
string_table: Sequence[StringTable],
1415
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
16+
timestamp = time.time()
1517
return [
1618
interfaces.InterfaceWithCounters(
1719
interfaces.Attributes(
@@ -28,6 +30,7 @@ def parse_hitachi_hnas_fc_if(
2830
in_err=sum(map(int, line[6:13])),
2931
out_octets=interfaces.saveint(line[5]),
3032
),
33+
timestamp=timestamp,
3134
)
3235
for line in string_table[0]
3336
]

cmk/plugins/collection/agent_based/hpux_if.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
44
# conditions defined in the file COPYING, which is part of this source code package.
55

6+
import time
67

78
from cmk.agent_based.v2 import AgentSection, CheckPlugin, RuleSetType, StringTable
89
from cmk.plugins.lib import if64, interfaces
@@ -26,6 +27,7 @@
2627
def parse_hpux_if(
2728
string_table: StringTable,
2829
) -> interfaces.Section[interfaces.InterfaceWithCounters]:
30+
timestamp = time.time()
2931
nics = []
3032
for line in string_table:
3133
if "***" in line:
@@ -37,6 +39,7 @@ def parse_hpux_if(
3739
type="6",
3840
),
3941
interfaces.Counters(),
42+
timestamp=timestamp,
4043
)
4144
nics.append(iface)
4245
continue

cmk/plugins/collection/agent_based/huawei_osn_if.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424

2525
def parse_huawei_osn_if(string_table: Sequence[StringTable]) -> Section:
26+
timestamp = time.time()
2627
return {
2728
name: interfaces.InterfaceWithCounters(
2829
interfaces.Attributes(
@@ -44,6 +45,7 @@ def parse_huawei_osn_if(string_table: Sequence[StringTable]) -> Section:
4445
out_bcast=interfaces.saveint(line[6]),
4546
out_err=interfaces.saveint(line[10]),
4647
),
48+
timestamp,
4749
)
4850
for line in string_table[0]
4951
for name in [line[0]]
@@ -93,7 +95,6 @@ def check_huawei_osn_if(
9395
params,
9496
interfaces.InterfaceWithRatesAndAverages.from_interface_with_counters_or_rates(
9597
interface,
96-
timestamp=time.time(),
9798
value_store=get_value_store(),
9899
params=params,
99100
),

0 commit comments

Comments
 (0)