Files
cosmoserver/files/api/new_descriptors.json

50 lines
1.8 KiB
JSON

[
{
"notes:": "this is both a scratch file and a reference for new component descriptors"
},
{
"name": "",
"description": "",
"multi_check": "True",
"device_list": "command to list all devices of this type for iteration",
"properties": {
"property_name": "shell command to display said property",
"property_with_variance":{
"x86_64": "this structure works with metrics also",
"aarch64": "the code calls based on the key name"
}
},
"metrics": {
"metric_name": "shell command to display said metric"
},
"multi_metrics": [
"array",
"of metric names",
"for devices with",
"multiple instances"
],
"virt_ignore": [
"array",
"of metrics",
"or properties",
"to skip when",
"running on a VM"
],
"precheck": "if there is a chance this device might be absent, this is the shell command to check for its presence",
"arch_check": "If there have to be different commands for different architechures, this is the solution",
"arch_variance": [
"array",
"of metrics",
"or properties",
"which have variance"
]
},
{
"SATA GBW": "sudo /usr/sbin/smartctl -x --json /dev/{this_device} | jq -r '.physical_block_size as $block |.ata_device_statistics.pages[] | select(.name == \"General Statistics\") | .table[] | select(.name == \"Logical Sectors Written\") | .value as $sectors | ($sectors * $block) / 1073741824 ' | awk '{{printf \"%.2f GiB Written\\n\", $0}}' || true",
"NVMe GBW": "sudo /usr/sbin/smartctl -x --json /dev/{this_device} | jq -r ' .nvme_smart_health_information_log.data_units_written as $dw | .logical_block_size as $ls | ($dw * $ls) / 1073741824 ' | awk '{{printf \"%.2f GiB Written\\n\", $0}}' || true"
}
]