summaryrefslogtreecommitdiffstats
path: root/daemon/system-info.sh
AgeCommit message (Collapse)Author
2020-09-04Fixed lack of macOS RAM info in system-info.sh (#9882)jim
* fix lack macOS ram info in system-info.sh * aligned spaces
2020-08-11Fix crash when receiving malformed labels via streaming. (#9715)Markos Fountoulakis
* Fix crash when receiving malformed labels via streaming. * Disallow empty _virtualization values in system_info.
2020-06-29Corrected virtualization detection in system-info.sh. (#9425)Austin S. Hemmelgarn
This causes failure to detect virtualization to be reported as no virtualization instead of unknown virtulization.
2020-05-21Improve system-info.sh to better handle certain cases when gathering info on ↵Austin S. Hemmelgarn
the system's disk capacity. (#7902) * Remove trailing whitespace in system-info.sh. * Fix handling of APFS on macOS. APFS can have multiple volumes in a single partition, which means that the same functional 'volume' can appear multiple times in the output of `df`. Duplicate lines for such volumes will show the same total size and available space along with a common prefix for the device name. This updates the parsing logic for `df` on macOS to account for this by deduplicating lines in the `df` output that have the same total size, available space, and same normalized device name. This has the potential to incorrectly under-account space in some cases, but the liklihood of that happeing is much less than the certainty of overaccounting space on standard APFS configurations. * Properly handle VirtIO block devices when using /sys. The VirtIO Block device driver uses a dynamically allocated device major number, meaning that we can't trivially match on it. This updates the handling to properly look it up in `/proc/devices` instead of just using the whole dynamic device number range. * Add handling for NVMe block devices in sysfs code. They use dynamic major numbers just like VirtIO Block devices do. * Switch to device major discovery in /proc/devices for all device types. This converts the code to use `/proc/devices` to look up correct device major numbers for block devices taht we treat as disks just like we are already doing for those that have dynamically assigned numbers. This makes the code both more robust and easier to understand and modify. This also excludes some particularly old hardware that we were originally looking for. If needed, we can add in the required device names, but for now it's better to keep the list concise. * Correct handling of device major discovery. We need to strip leading whitespace before calling cut, not after. * Only use /sys/block if we can read /proc/devices. We use `/proc/devices` to do device number lookups that we then use to filter devices under `/sys/block`. As a result, if we can't read `/proc/devices`, then we won't actually parse anything out of `/sys/block` either, so we need to just fall back to parsing `df` output. * Deduplicate `df` output by device name on Linux. This ensures that we properly handle BTRFS subvolumes, counting each actual volume only once. * Use POSIX math expansion instead of awk to sum disk sizes. This avoids the rather annoying habit of AWK of printing integers in scientific notation instead of as exact values. * Correct `sed` options for POSIX complaince. * Fix disk info fetching for macOS> POSIX tools, as found on macOS, lack a number of rather useful filtering and sorting features, so we need to get rather creative with the handling on macOS to make the disk space computation work correctly. This unfortunately makes the calculation a bit less reliable than it would have been had the existing calculations worked correctly, but it's the best I can come up with without making things exponentiall more complicated. * Properly handle sector size when using sysfs.
2020-04-22Fixed issue in `system-info.sh`regarding the parsing of `lscpu` output. (#8754)Austin S. Hemmelgarn
* Fix parsing issue in system-info.sh. Depending on the exact hardware it's run on, `lscpu` may or may not report a maximum and/or minimum CPU frequency. We want to preferentially match on the maximum if it's there because the regular CPU frequency entry from `lscpu` shows the _current_ frequency most of the time, and we want to report the 'intended' frequency for the CPU. * Fix the check to see if we found a CPU frequency value. * Actually fix parsing.
2020-02-07Update `api/v1/info ` (#7862)thiagoftsm
* update_info: New variables This commit creates inside script and it reads them to Netdata * update_info: API This commit changes the web api response * update_info: Disk space This commit brings the disk space to info and renames the environment variables inside Netdata * update_info: Rename variable This commit renames the environment variable * update_info: Rename response variable This commit renames a response variable * update_info: Labels This commit creates the missing labels * update_info: test before free * update_info: Doc function This commit brings docummentation to the functions to give instructions to developer * update_info: Fix info message This commit removes some info messages from the error.log * update_info: Remove unecessary ifs, considering free manual
2020-01-29Add disk size detection to system-info.sh. (#7866)Austin S. Hemmelgarn
* Add rudimentary disk size detection to system-info.sh. This adds really basic detection of total disk size to the system-info.sh script. This detection is _wildly_ inaccurate in many cases, but it's not realistically possible to make it much better than what's added here without making the script exponentially more complicated (there are just way too many edge cases and special conditions to worry about). This adds the following keys to the output of the script: * NETDATA_TOTAL_DISK_SIZE: This indicates the total detected disk size in bytes. * NETDATA_DISK_DETECTION: This indicates what detection method was used for determining the total disk size. It may return either `df` (which works almost everywhere but is wildly inaccurate) or `sysfs` (which is linux specific, but is 100% accurate for a majority of cases). On most platforms, this parses the output of the `df` command, limiting only to filesystems that are used on fixed disks, which provides reasonably accurate results in most trvial cases, but kind of falls apart the moment people are doing anything remotely complicated in terms of storage (like using a logical volume manager or under-comitting their disk space). On Linux, it will preferentially try to parse the info out of `/sys/block`, filtering on device major numbers that are actually used for fixed disks and excluding devices that are indicated to be removable. This provides a very accurate result if the system does not use removable media as primary storage, but requires that the user who runs the script can read the contents of `/sys/block`. * Add VirtIO block device major number to the list of scanned devices. * Actually handle VirtIO block devices correctly. * Fixes for macOS handling.
2020-01-24Improve the system-info.sh script to report CPU and RAM meta-data. (#7815)Austin S. Hemmelgarn
* Add CPU information collection for Linux and FreeBSD. This adds logic to system.info.sh to collect info about the system's CPU. It adds the following keys to the output of the script: * NETDATA_CPU_LOGICAL_CPU_COUNT: This reports the number of logical CPU cores the system is actually using (including offline ones). This may differ from the CPU's advertised core count, but is what most people actually care about. * NETDATA_CPU_VENDOR: This reports the CPU manufacturer. This is needed because some systems do not include the manufacturer name in the CPU model name. * NETDATA_CPU_MODEL: This reports the CPU model. It may or may not include any of a model number, intended operating frequency, and manufacturer name. * NETDATA_CPU_FREQ: This reports a best guess at the design frequency for the CPU. It may instead be the max boost frequency. This is reported as a number with associated units, which will usually be either hertz or megahertz. * NETDATA_CPU_DETECTION: This reports the method used to detect the CPU information, It will be either 'none' if no detection was successful, or a space-separated list of detection methods. This may potentially use any of the following detection methods: * lscpu: Uses a mix of information from across the system. Requires the `lscpu` command to be installed. * dmidecode: Uses the information from the DMI tables. Requires hardware support as well as the `dmidecode` command. * nproc: Uses the `nproc` command from the GNU coreutils to get a count of logical processors. * sysctl: Uses the `sysctl` command on FreeBSD to fetch information. * sysfs: Uses /sys on Linux to fetch information. * procfs: Uses /proc/cpuinfo on Linux to fetch information. * uname: Uses the `uname` command from the GNU coreutils to get CPU model and vendor information. All values tht were not successfully detected should read back as 'unknown'. Some values may have spaces present, and thus are quoted in the output. * Collect total system RAM info in system-info.sh This collects info about the total usable system RAM in the system-info.sh script. It adds the following two keys to the output of the script: * NETDATA_TOTAL_RAM: Reports the total usable system RAM as a number with an associated unit, usually as bytes or kilobytes. Reports 'unknown' if this couldn't be determined. * NETDATA_RAM_DETECTION: Indicates how we detected the total RAM, or 'none' if we couldn't figure out the total RAM. * Make lscpu output parsing more robust. * Remove extra quotes. The output is not parsed as shell variables, but using a special parser that just reads everything from the `=` to EOL as the value. * Coerce output to base units. This properly converts the output for CPU frequencies and RAM sizes to use base units of Hertz or bytes, allowing for simpler parsing of the output. * Fix incorrect number handling in total RAM parsing. * Correctly fix incorrect number handling in total RAM parsing. * Fix parsing of `lscpu` output. This properly recognizes the CPU frequency value as MHz and truncates the value to an integer.
2020-01-21Issue 7488 docker labels (#7770)Andrew Moss
Improve the metadata detection for containers. The system_info structure has been updated to hold separate copies of OS_NAME, OS_ID, OS_ID_LIKE, OS_VERSION, OS_VERSION_ID and OS_DETECTION for both the container environment and the host. This new information is communicated through the /api/v1/info endpoint. For the streaming interface a partial copy of the info is carried until the stream protocol is upgraded. The anonymous_statistics script has been updated to carry the new data to Google Analytics. Some minor improvements have been made to OS-X / FreeBSD detection, and the detection of virtualization. The docs have been updated to explain how to pass the host environment to the docker container running Netdata.
2019-12-16Labels issues (#7515)Andrew Moss
Initial work on host labels from the dedicated branch. Includes work for issues #7096, #7400, #7411, #7369, #7410, #7458, #7459, #7412 and #7408 by @vlvkobal, @thiagoftsm, @cakrit and @amoss.
2019-08-09Better system OS detection for RHEL6 and Mac OS X (#6612)Piotr Roszatycki
* On RHEL 6 file /etc/lsb-release is pretty useless * Better OS version detection for Mac OS X
2019-05-02Add support for Mac OS X Name and Version (#5949)Chris Akritidis
* Add support for Mac OS X Name and Version * Fix codacy warnings
2019-04-18Extend netdata info API call (#5889)Chris Akritidis
* Add array of collector plugins-modules to api/v1/info * Add system info to api/v1/info, collect data from separate script, use environment vars in anonymous statistics script