|
| 1 | +# check_system_basics |
| 2 | + |
| 3 | +`check_system_basics` is a monitoring plugin, which is capable to check various Linux metrics such |
| 4 | +as memory or filesystem usage via subcommands. |
| 5 | + |
| 6 | +In the current version check_system_basics supports the `memory`, `filesystem`, `psi`, `sensors`, `netdev` and `load` sub command. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +### memory |
| 11 | + |
| 12 | +A sub command to measure and evaluate memory and swap usage. This is not a trivial topic, but there is [detailed information](https://www.thegeekdiary.com/understanding-proc-meminfo-file-analyzing-memory-utilization-in-linux/) available for those who search for it. |
| 13 | + |
| 14 | +For the memory usage thresholds can be applied to either available, free or used memory. The recommended way is to set thresholds for available memory, |
| 15 | +since this is probably the metric most administrators are interested in. |
| 16 | + |
| 17 | + |
| 18 | +### filesystem |
| 19 | + |
| 20 | +A sub command to check the usage of the currently mounted filesystems. |
| 21 | + |
| 22 | +Thresholds can be applied on absolute values (in bytes) or percentage values of the free space on the filesystem |
| 23 | +or the free inodes. |
| 24 | + |
| 25 | + * With `--exclude-fs-type` and `--include-fs-type` specific filesystem types can be excluded or explicitly included. |
| 26 | + * With `--exclude-device-path` and `--include-device-path` specific device paths can be excluded or explicitly included. |
| 27 | + * With `--exclude-mount-path` and `--include-mount-path` specific mount paths can be excluded or explicitly included. |
| 28 | + |
| 29 | + |
| 30 | +### load |
| 31 | + |
| 32 | +A sub command to retrieve the current system load values and alerts if they are not within the defined thresholds. |
| 33 | + |
| 34 | +By default no thresholds are applied. |
| 35 | + |
| 36 | + |
| 37 | +### psi |
| 38 | + |
| 39 | +Note: The Pressure stall information interface is not available on all current Linux distributions (specifically it is not |
| 40 | +activated in their kernel configuration). |
| 41 | +Therefore this command is not available and will exit with an error. |
| 42 | + |
| 43 | +A sub command to retrieve the current ["pressure stall information"](https://lwn.net/Articles/759781/) values of the system. These are useful metrics to determine a shortage |
| 44 | +of resources on the system, the resources being cpu, memory and io. |
| 45 | +For each of these resources a 10 second, 60 second and 300 second aggregate percentage value is available for which |
| 46 | +amount of time a process did not immediately receive the resource it was asking for and was therefore stalled. |
| 47 | + |
| 48 | +The PSI interface might not be available on your systems, since not all distributions build it into their kernel (RHEL for example). |
| 49 | +In this case, the Plugin will return UNKNOWN. |
| 50 | + |
| 51 | +At least on RHEL systems the PSI interface can be enabled via appending "psi=1" to the kernel commandline (`/etc/default/grub`). |
| 52 | + |
| 53 | +The checks includes the three components CPU, IO and Memory by default, but individual components can be selected with the following flagS: |
| 54 | + |
| 55 | +``` |
| 56 | +--include-cpu |
| 57 | +--include-memory |
| 58 | +--include-io |
| 59 | +``` |
| 60 | + |
| 61 | +Default thresholds are applied to all of the measurements. |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +### sensors |
| 67 | + |
| 68 | +A sub command to read the sensors exposed by the linux kernel and display whether they |
| 69 | +are within their respective thresholds (if any are set on the system side). |
| 70 | +Additionally it will export the respective values as performance data to be rendered |
| 71 | +by a graphing system. |
| 72 | + |
| 73 | +There are no parameters available at the point of writing. |
| 74 | + |
| 75 | + |
| 76 | +## Building |
| 77 | + |
| 78 | +### Necessary tools |
| 79 | + |
| 80 | + * the [`golang` toolchain](https://go.dev/) |
| 81 | + |
| 82 | +### Compiling |
| 83 | + |
| 84 | +``` |
| 85 | +go build |
| 86 | +``` |
| 87 | +executed in the main folder of this repository will generate an executable. If you are not on a linux system, |
| 88 | +it should probably look like this: |
| 89 | + |
| 90 | +``` |
| 91 | +GOOS=linux go build |
| 92 | +``` |
| 93 | + |
| 94 | +### Creating the Icinga2 CheckCommand config (if necessary) |
| 95 | + |
| 96 | +``` |
| 97 | +./check_system_basics --dump-icinga2-config > myConfigFile.conf |
| 98 | +``` |
0 commit comments