cosmostat active host inventory file api

This commit is contained in:
2026-04-04 17:47:32 -07:00
parent be95ab7593
commit a89703c420
26 changed files with 1243 additions and 261 deletions

View File

@ -41,6 +41,22 @@
]
},
{
"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"