cosmostat working

This commit is contained in:
2026-03-29 09:39:43 -07:00
parent 97fdb3d5d8
commit 4c4d9e4d6f
19 changed files with 813 additions and 491 deletions

View File

@ -69,6 +69,7 @@ class Component:
self.virt_ignore = self._descriptor.get('virt_ignore', [])
self.multi_metrics = self._descriptor.get('multi_metrics', [])
self.arch_check = self._descriptor.get('arch_check', [])
self.php_extra_list = self._descriptor.get('php_extra', [])
if self.is_virtual:
self.virt_ignore = []
@ -173,6 +174,13 @@ class Component:
log_data(log_output = f"result - {result_command}", log_level = "debug_output")
return result_command
# check if this property should show in the System Properties box
def check_php_extra(self, property_name):
result = False
if property_name in self.php_extra_list:
result = True
return result
########################################################
# keyed data functions
########################################################
@ -407,7 +415,6 @@ class System:
if multi_check:
log_data(log_output = f"Creating one component of type {component_name} for each one found", log_level = "log_output")
component_type_device_list = get_device_list(component_name)
component_id = 0
for this_device in component_type_device_list:
this_component_ID = component_type_device_list.index(this_device)
this_component_name = f"{component_name} {this_component_ID}"
@ -486,20 +493,36 @@ class System:
result.append(metric)
return result
def get_system_properties(self, human_readable = False):
def get_system_properties(self, human_readable = False, php_extra = False):
result = []
for name, value in self._properties.items():
if human_readable:
result.append({
"Source": "System",
"Property": f"{name}: {value}"
})
})
else:
result.append({
"Source": "System",
"Property": name,
"Value": value
})
if php_extra and human_readable:
for component_result in self.php_component_data():
result.append(component_result)
return result
def php_component_data(self):
result = []
for component in self.components:
for this_property in component._properties:
if component.check_php_extra(this_property):
result_string = f"{this_property}: {component._properties[this_property]}"
result.append({
"Source": "System",
"Property": result_string
})
return result
########################################################
@ -584,7 +607,12 @@ def run_command(cmd, zero_only=False, use_shell=True, req_check = True):
except:
return output_lines
# need to add a archticture checker for this
# i also want to make the loop cleaner
# i don't need to iterate over the component class tree
# to get what I want, i think
def get_device_list(device_type_name: str):
result = []
for component in component_class_tree:
precheck_value = 1
@ -594,6 +622,7 @@ def get_device_list(device_type_name: str):
precheck_value = int(precheck_value_output)
log_data(log_output = f"Precheck found - {precheck_command} - {precheck_value}", log_level = "log_output")
if component["name"] == device_type_name and precheck_value != 0:
device_list_command = component["device_list"]
device_list_result = run_command(device_list_command)
result = device_list_result