67 lines
2.5 KiB
JSON
67 lines
2.5 KiB
JSON
[
|
|
{
|
|
"notes:": "this is both a scratch file and a reference for new component descriptors",
|
|
"descriptor descriptor": "the reference descriptor is the next key"
|
|
},
|
|
{
|
|
"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"
|
|
]
|
|
},
|
|
|
|
{
|
|
"name": "BAT",
|
|
"description": "Battery - {Device Name} - capacity {Capacity}",
|
|
"multi_check": "True",
|
|
"device_list": "acpi | grep Battery | cut -d: -f1",
|
|
"properties": {
|
|
"Device Name": "echo {this_device}",
|
|
"Capacity": "acpi -V | jc --acpi | jq '.[] | select(.type==\"Battery\") | .design_capacity_mah' "
|
|
},
|
|
"metrics": {
|
|
"Percent Full": "acpi -V | jc --acpi | jq '.[] | select(.type==\"Battery\") | .charge_percent'",
|
|
"State": "acpi -V | jc --acpi | jq '.[] | select(.type==\"Battery\") | .state'"
|
|
},
|
|
"precheck": "acpi | grep Battery | wc -l"
|
|
},
|
|
|
|
{
|
|
"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"
|
|
}
|
|
]
|
|
|