You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifmajorVersion==4: # Agents with version 4 and below will always fail.
161
+
node["machineAgentAge"] =3
162
+
else:
163
+
years=currYear-majorVersion
164
+
ifminorVersion<currMonth:
165
+
years+=1
166
+
node["machineAgentAge"] =years
167
+
168
+
ifyears<=2:
169
+
numberMachineAgentsLessThan2YearsOld+=1
170
+
ifyears==1:
171
+
numberMachineAgentsLessThan1YearOld+=1
172
+
else:
173
+
logging.warning(f"Could not parse machine agent version from '{machine_agent_version_str}' for node {node.get('name', 'unknown')}. Skipping age calculation.")
174
+
node["machineAgentAge"] =None# Indicate that age couldn't be determined
175
+
else:
176
+
logging.warning(f"Machine agent present for node {node.get('name', 'unknown')}, but 'machineAgentVersion' is None or empty in metadata. Skipping version-dependent analysis.")
177
+
node["machineAgentAge"] =None# Indicate that age couldn't be determined
178
+
179
+
# Determine application load - this uses 'machineAgentAvailability' which is at the top level of 'node'
180
+
ifnode.get("machineAgentAvailability", 0) !=0:
181
+
numberMachineAgentsReportingData+=1
154
182
else:
155
-
years=currYear-majorVersion
156
-
ifminorVersion<currMonth:
157
-
years+=1
158
-
node["machineAgentAge"] =years
159
-
160
-
ifyears<=2:
161
-
numberMachineAgentsLessThan2YearsOld+=1
162
-
ifyears==1:
163
-
numberMachineAgentsLessThan1YearOld+=1
164
-
165
-
# Determine application load
166
-
ifnode["machineAgentAvailability"] !=0:
167
-
numberMachineAgentsReportingData+=1
183
+
logging.info(f"No machine agent present for node {node.get('name', 'unknown')}. Skipping machine agent specific analysis for this node.")
184
+
# The original code had a 'continue' here to skip the rest of the loop for this node
185
+
# if 'machineAgentPresent' was False. We maintain that behavior.
186
+
continue# Skip to the next node if no machine agent is present.
168
187
169
188
# In the case of multiple versions, will return the largest common agent count regardless of version.
0 commit comments