Lorenz Brun | 189495a | 2022-11-08 12:59:36 +0000 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | package cloud.agent.api; |
| 3 | option go_package = "source.monogon.dev/cloud/agent/api"; |
| 4 | |
| 5 | message BlockDevice { |
| 6 | // Name of the vendor of the block device |
| 7 | string vendor = 1; |
| 8 | // Device model of the block device |
| 9 | string device_model = 2; |
| 10 | // Serial number of the block device |
| 11 | string serial_number = 3; |
| 12 | // World Wide Name of the block device (not always available) |
| 13 | bytes wwn = 4; |
| 14 | // Set if this is a rotational disk |
| 15 | bool rotational = 5; |
| 16 | |
| 17 | // Usable capacity in bytes |
| 18 | int64 capacity_bytes = 6; |
| 19 | |
| 20 | // Logical and physical block size in bytes. Note that on many modern |
| 21 | // enterprise drives these can be changed. |
| 22 | int32 logical_block_size_bytes = 7; |
| 23 | int32 physical_block_size_bytes = 8; |
| 24 | |
| 25 | enum Protocol { |
| 26 | UNKNOWN = 0; |
| 27 | SCSI = 1; |
| 28 | ATA = 2; |
| 29 | NVME = 3; |
| 30 | MMC = 4; |
| 31 | } |
| 32 | Protocol protocol = 9; |
| 33 | |
| 34 | // Set if the block device has reasons to believe that it will fail soon. |
| 35 | // This is entirely controlled by firmware, its accuracy is as good as |
| 36 | // the vendor has made it. |
| 37 | bool critical_warning = 10; |
| 38 | |
| 39 | // Number of unrecoverable media read errors. |
| 40 | // On SATA disks this is technically equivalent to Raw_Read_Error_Rate, but |
| 41 | // only a tiny minority of devices populate that sanely. So instead this is |
| 42 | // defined as the sum of S.M.A.R.T. attributes 5, 197 and 198. |
| 43 | optional int64 media_errors = 11; |
| 44 | |
| 45 | // Fraction of spare space still available to replace bad blocks. |
| 46 | // If this reaches zero, the disk generally dies. |
| 47 | optional float available_spare_ratio = 12; |
| 48 | |
| 49 | // Fraction of the estimated life of the device used up. |
| 50 | // Only considers flash wear, not runtime or similar. |
| 51 | // Reported by firmware, as accurate as the vendor has made it. |
| 52 | optional float usage_ratio = 13; |
| 53 | } |
| 54 | |
| 55 | message NetworkInterface { |
| 56 | // Contains the EUI-48 MAC address of the interface. |
| 57 | bytes mac = 1; |
| 58 | // Linux kernel driver which is bound to the interface. |
| 59 | string driver = 2; |
| 60 | |
| 61 | // List of supported speeds in bytes per second. |
| 62 | repeated int64 supported_speed_bytes = 3; |
| 63 | |
| 64 | // Does the interface have an active link. |
| 65 | bool link_up = 4; |
| 66 | // Currently-negotiated speed in bytes per second. Unstable on marginal |
| 67 | // links. |
| 68 | int64 current_speed_bytes = 5; |
| 69 | } |
| 70 | |
| 71 | message CPU { |
| 72 | message X86_64 { |
| 73 | // Family of the CPU, including extended family. |
| 74 | // For example 6 for Intel's "big" cores. |
| 75 | int32 family = 1; |
| 76 | // Model of the CPU, including extended model. |
| 77 | // For example 154 for ADL-S. |
| 78 | int32 model = 2; |
| 79 | // Stepping of the CPU, model-dependent value. |
| 80 | int32 stepping = 3; |
| 81 | } |
| 82 | oneof architecture { |
| 83 | X86_64 x86_64 = 1; |
| 84 | // Information specific to other architectures can be added here. |
| 85 | } |
| 86 | // Number of hardware threads (including SMT threads, harts, ...) exposed to |
| 87 | // to the operating system. |
| 88 | int32 hardware_threads = 9; |
| 89 | // Number of cores of the CPU. This does not include SMT threads or other |
| 90 | // equivalent mechanisms to increase logical core count. |
| 91 | int32 cores = 8; |
| 92 | // Name of the vendor of the CPU |
| 93 | string vendor = 10; |
| 94 | // Name of the model of the CPU |
| 95 | string model = 11; |
| 96 | } |
| 97 | |
| 98 | message Node { |
| 99 | // Manufacturer of the system, taken from DMI. |
| 100 | string manufacturer = 1; |
| 101 | // Product name, taken from DMI. |
| 102 | string product = 2; |
| 103 | // Serial number of the system, taken from DMI. |
| 104 | string serial_number = 3; |
| 105 | |
| 106 | // Amount of physical memory installed, in bytes. Determined using DMI (if |
| 107 | // available and not marked unusable) or memory blocks in sysfs |
| 108 | // (/sys/devices/system/memory/...). This is not taken from meminfo as that |
| 109 | // value is relatively unstable and hard to match to. |
| 110 | // Assuming a non-terrible firmware implementation this value is expected to |
| 111 | // be stable. |
| 112 | int64 memory_installed_bytes = 8; |
| 113 | |
| 114 | // Ratio of claimed installed memory which is available to the Linux |
| 115 | // kernel (taken from sysinfo's totalmem). Note that this value is unstable |
| 116 | // across kernel versions and even firmware configuration settings and should |
| 117 | // only be used to detect gross mismatches. 1 means all of the claimed |
| 118 | // installed memory is available, 0 means none. |
| 119 | float memory_usable_ratio = 9; |
| 120 | |
| 121 | repeated CPU cpu = 10; |
| 122 | repeated BlockDevice block_device = 11; |
| 123 | repeated NetworkInterface network_interface = 12; |
| 124 | } |