129 lines
4.5 KiB
JSON
129 lines
4.5 KiB
JSON
[
|
|
{
|
|
"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"
|
|
]
|
|
},
|
|
{
|
|
"static_key_variables": [
|
|
{"name": "Hostname", "command": "hostname"},
|
|
{"name": "Virtual Machine", "command": "echo $( [ \"$(systemd-detect-virt)\" = none ] && echo False || echo True )", "req_check": "False"},
|
|
{"name": "CPU Architecture", "command": "lscpu --json | jq -r '.lscpu[] | select(.field==\"Architecture:\") | .data'"},
|
|
{"name": "OS Kernel", "command": "uname -r"},
|
|
{"name": "OS Name", "command": "cat /etc/os-release | grep PRETTY | cut -d\\\" -f2"},
|
|
{"name": "Manufacturer", "command": "sudo dmidecode --type 1 | grep Manufacturer: | cut -d: -f2 | sed -e 's/^[ \\t]*//'"},
|
|
{"name": "Product Name", "command": "sudo dmidecode --type 2 | grep 'Product Name:' | cut -d: -f2 | sed -e 's/^[ \\t]*//'"},
|
|
{"name": "Serial Number", "command": "sudo dmidecode --type 2 | grep 'Serial Number: '| cut -d: -f2 | sed -e 's/^[ \\t]*//'"}
|
|
],
|
|
"dynamic_key_variables": [
|
|
{"name": "System Uptime", "command": "uptime -p"},
|
|
{"name": "Current Date", "command": "date '+%D %r'"}
|
|
],
|
|
"virt_ignore": [
|
|
"Product Name",
|
|
"Serial Number"
|
|
]
|
|
},
|
|
{
|
|
"name:": "System",
|
|
"static_key_variables": [
|
|
{
|
|
"name": "Hostname",
|
|
"command": "hostname"
|
|
},
|
|
{
|
|
"name": "Virtual Machine",
|
|
"command": "echo $( [ \"$(systemd-detect-virt)\" = none ] && echo False || echo True )",
|
|
"req_check": "False"
|
|
},
|
|
{
|
|
"name": "CPU Architecture",
|
|
"command": "lscpu --json | jq -r '.lscpu[] | select(.field==\"Architecture:\") | .data'"
|
|
},
|
|
{
|
|
"name": "OS Kernel",
|
|
"command": "uname -r"
|
|
},
|
|
{
|
|
"name": "OS Name",
|
|
"command": "cat /etc/os-release | grep PRETTY | cut -d\\\" -f2"
|
|
},
|
|
{
|
|
"name": "Manufacturer",
|
|
"command":{
|
|
"x86_64": "sudo dmidecode --type 1 | grep Manufacturer: | cut -d: -f2 | sed -e 's/^[ \\t]*//'"
|
|
},
|
|
"arch_check": "true"
|
|
},
|
|
{
|
|
"name": "Product Name",
|
|
"command": {
|
|
"x86_64": "sudo dmidecode --type 2 | grep 'Product Name:' | cut -d: -f2 | sed -e 's/^[ \\t]*//'"
|
|
},
|
|
"arch_check": "true"
|
|
},
|
|
{
|
|
"name": "Serial Number",
|
|
"command": {
|
|
"x86_64": "sudo dmidecode --type 2 | grep 'Serial Number: '| cut -d: -f2 | sed -e 's/^[ \\t]*//'"
|
|
},
|
|
"arch_check": "true"
|
|
}
|
|
],
|
|
"dynamic_key_variables": [
|
|
{
|
|
"name": "System Uptime",
|
|
"command": "uptime -p"
|
|
},
|
|
{
|
|
"name": "Current Date",
|
|
"command": "date '+%D %r'"
|
|
}
|
|
],
|
|
"virt_ignore": [
|
|
"Product Name",
|
|
"Serial Number"
|
|
]
|
|
},
|
|
|
|
|
|
{
|
|
"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"
|
|
}
|
|
]
|
|
|