| 1 |  Nagios-compatible Plugins for Linux |
| 2 | ------------------ |
| 3 | #### A suite of Nagios-compatible Plugins for monitoring Linux hosts. |
| 4 | |
| 5 |  |
| 6 | [](https://spdx.org/licenses/GPL-3.0-only.html) |
| 7 | [](https://github.com/madrisan/nagios-plugins-linux/releases/download/v32/nagios-plugins-linux-32.tar.xz) |
| 8 | [](https://saythanks.io/to/madrisan) |
| 9 | [](https://scan.coverity.com/projects/madrisan-nagios-plugins-linux) |
| 10 | |
| 11 | <a href='https://ko-fi.com/K3K57TH3' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> |
| 12 | <a href='http://amzn.eu/8axPDQ1'><img height='36' src='https://images.freeimages.com/fic/images/icons/2229/social_media_mini/48/amazon.png' border='0' alt='Wish List at Amazon.fr' /></a> |
| 13 | |
| 14 | *This project provides several plugins for monitoring physical and virtual Linux hosts with [Nagios](http://www.nagios.org/) and Nagios-compatible monitoring systems like [Icinga](https://icinga.com/learn/) and [Naemon](https://www.naemon.org/).* |
| 15 | |
| 16 | Here is the list of the available plugins: |
| 17 | |
| 18 | * **check_clock** - returns the number of seconds elapsed between local time and Nagios server time |
| 19 | * **check_container** - checks docker/podman containers :warning: *pre-alpha*, requires *libcurl* version 7.40.0+ |
| 20 | * **check_cpu** - checks the CPU (user mode) utilization |
| 21 | * **check_cpufreq** - displays the CPU frequency characteristics |
| 22 | * **check_cswch** - checks the total number of context switches across all CPUs |
| 23 | * **check_fc** - monitors the status of the fiber status ports |
| 24 | * **check_filecount** - checks the number of files found in one or more directories |
| 25 | * **check_ifmountfs** - checks whether the given filesystems are mounted |
| 26 | * **check_intr** - monitors the total number of system interrupts |
| 27 | * **check_iowait** - monitors the I/O wait bottlenecks |
| 28 | * **check_load** - checks the current system load average |
| 29 | * **check_memory** - checks the memory usage |
| 30 | * **check_multipath** - checks the multipath topology status |
| 31 | * **check_nbprocs** - displays the number of running processes per user |
| 32 | * **check_network** - displays some network interfaces statistics. The following plugins are symlinks to *check_network*: |
| 33 | * check_network_collisions |
| 34 | * check_network_dropped |
| 35 | * check_network_errors |
| 36 | * check_network_multicast |
| 37 | * **check_paging** - checks the memory and swap paging |
| 38 | * **check_pressure** - checks Linux Pressure Stall Information (PSI) data |
| 39 | * **check_readonlyfs** - checks for readonly filesystems |
| 40 | * **check_selinux** - checks if SELinux is enabled :new: |
| 41 | * **check_swap** - checks the swap usage |
| 42 | * **check_tcpcount** - checks the tcp network usage |
| 43 | * **check_temperature** - monitors the hardware's temperature |
| 44 | * **check_uptime** - checks how long the system has been running |
| 45 | * **check_users** - displays the number of users that are currently logged on |
| 46 | |
| 47 | ## Full documentation |
| 48 | |
| 49 | The full documentation of the `nagios-plugins-linux` is available online |
| 50 | in the GitHub [wiki page](https://github.com/madrisan/nagios-plugins-linux/wiki). |
| 51 | |
| 52 | ## Get and configure the source code |
| 53 | |
| 54 | This package uses `GNU autotools` for configuration and installation. |
| 55 | |
| 56 | If you have cloned the git repository |
| 57 | |
| 58 | git clone --recursive https://github.com/madrisan/nagios-plugins-linux.git |
| 59 | |
| 60 | then you will need to run `autoreconf --install` to generate the required files. |
| 61 | |
| 62 | Run `./configure --help` to see a list of available install options. |
| 63 | The plugin will be installed by default into `LIBEXECDIR`. |
| 64 | |
| 65 | It is highly likely that you will want to customise this location to |
| 66 | suit your needs, i.e.: |
| 67 | |
| 68 | ./configure --libexecdir=/usr/lib/nagios/plugins |
| 69 | |
| 70 | The plugin `check_multipath` grabs the status of each path by opening a |
| 71 | connection to the multipathd socket. The default value is currently set to |
| 72 | the Linux abstract socket namespace `@/org/kernel/linux/storage/multipathd`, |
| 73 | but can be modified at build time by using the option `--with-socketfile`. |
| 74 | |
| 75 | Example (RHEL5 and RHEL6 and other old distributions): |
| 76 | |
| 77 | ./configure --with-socketfile=/var/run/multipathd.sock |
| 78 | |
| 79 | If you want to compile the code with a C compiler different from the system default, |
| 80 | you can set the environment variable CC accordingly. Here's an example: |
| 81 | |
| 82 | CC=clang-17 ./configure --libexecdir=/usr/lib/nagios/plugins |
| 83 | |
| 84 | ## Installation |
| 85 | |
| 86 | After `./configure` has completed successfully run `make install` and |
| 87 | you're done! |
| 88 | |
| 89 | You can also run the (still incomplete) set of bundled unit tests by entering |
| 90 | the command `make check` (or `VERBOSE=1 make check`) and, if the llvm tool |
| 91 | `scan-build` is installed on your system, a `make -C tests check-clang-checker` |
| 92 | to get a static code analysis report (for developers only). |
| 93 | |
| 94 | _Note_: you can also pass the option `--enable-libprocps` to `configure` for |
| 95 | getting the informations about memory and swap usage through the API of the |
| 96 | library `libproc2.so` [procps](https://gitlab.com/procps-ng/procps/)). |
| 97 | |
| 98 | ## Supported Platforms and Linux distributions |
| 99 | |
| 100 | This package is written in plain C, making as few assumptions as possible, and |
| 101 | sticking closely to ANSI C/POSIX. |
| 102 | A C99-compliant compiler is required anyway. |
| 103 | |
| 104 | This package is known to compile with: |
| 105 | * gcc 4.1 (RHEL 5 / CentOS 5), |
| 106 | * gcc 4.4 (RHEL6 / CentOS 6), |
| 107 | * gcc 4.8 (RHEL7 / CentOS 7), |
| 108 | * gcc 3.x, 5.1, 5.3, 6.3, 7-14 (openmamba GNU/Linux, Debian 8+, Fedora 25+), |
| 109 | * clang 3.7, 3.8, 4.9, 5, 6, 7, 8, 10-17 (openmamba GNU/Linux, Fedora 25+), |
| 110 | |
| 111 | List of the Linux kernels that have been successfully tested: |
| 112 | * 2.6.18, 2.6.32, |
| 113 | * 3.10, 3.14, 3.18, |
| 114 | * 4.2, 4.4, 4,9, 4.14, 4.15, 4.16, 4.19 |
| 115 | * 5.6, 5.7, 5.8, 5.12-5.18, 6.1-6.8 |
| 116 | |
| 117 | The Nagios Plugins Linux are regularly tested on |
| 118 | * Alpine Linux (musl libc), |
| 119 | * Debian, Fedora, Gentoo, and Ubuntu (GNU C Library (glibc)). |
| 120 | |
| 121 | ## Alpine, CentOS Stream, Debian, and Fedora Packages |
| 122 | |
| 123 | The `.apk`, `.rpm` and `.deb` packages for Alpine, CentOS/RHEL, Debian, and Fedora can be built using the following commands |
| 124 | |
| 125 | Command | Distribution |
| 126 | -------------------- | ------------ |
| 127 | Alpine 3.18 | `make -C packages alpine-3.18` |
| 128 | Alpine 3.19 | `make -C packages alpine-3.19` |
| 129 | Alpine 3.20 | `make -C packages alpine-3.20` |
| 130 | CentOS Stream 8 | `make -C packages centos-stream-8` |
| 131 | CentOS Stream 9 | `make -C packages centos-stream-9` |
| 132 | Debian 10 (Buster) | `make -C packages debian-buster` |
| 133 | Debian 11 (Bullseye) | `make -C packages debian-bullseye` |
| 134 | Debian 12 (Bookworm) | `make -C packages debian-bookworm` |
| 135 | Fedora 38 | `make -C packages fedora-38` |
| 136 | Fedora 39 | `make -C packages fedora-39` |
| 137 | Fedora 40 | `make -C packages fedora-40` |
| 138 | Fedora Rawhide | `make -C packages fedora-rawhide` |
| 139 | Rocky Linux 8 | `make -C packages rockylinux-8` |
| 140 | Rocky Linux 9 | `make -C packages rockylinux-9` |
| 141 | |
| 142 | in the root source folder. |
| 143 | The building process requires the _Docker_ software containerization platform running on your system, and an internet connection to download the Docker images of the operating systems you want to build the packages for. |
| 144 | |
| 145 | On *Fedora* (and all the distributions shipping *Podman*) you can use the native *Podman* pod manager along with the Docker CLI emulation script: |
| 146 | |
| 147 | sudo install dnf podman podman-docker |
| 148 | |
| 149 | _Note_: the previous make commands can end with a `permission denied` error if *selinux* is configured in enforcing mode. |
| 150 | In this case you can temporarily disable *selinux* by executing as root the command `setenforce 0` |
| 151 | (or maybe share a better solution!). |
| 152 | |
| 153 | ## Debian Package `nagios-plugins-contrib` |
| 154 | |
| 155 | The `Nagios Plugin Linux` source code has been merged with the Debian package [`nagios-plugins-contrib`](https://sources.debian.org/src/nagios-plugins-contrib/) |
| 156 | but only the `check_memory` plugin is provided by the binary package shipped by Debian, |
| 157 | starting with the [Debian Bookworm](https://packages.debian.org/bookworm/nagios-plugins-contrib) version. |
| 158 | |
| 159 | For more details, see GitHub [discussion #147](https://github.com/madrisan/nagios-plugins-linux/discussions/147). |
| 160 | |
| 161 | ## Gentoo Package |
| 162 | |
| 163 | The plugins are available [in the Gentoo tree](https://packages.gentoo.org/packages/net-analyzer/nagios-plugins-linux-madrisan). They can be installed by running: |
| 164 | ``` |
| 165 | emerge -av net-analyzer/nagios-plugins-linux-madrisan |
| 166 | ``` |
| 167 | The USE flag `curl` is required to build `check_container`. |
| 168 | |
| 169 | ## Bugs |
| 170 | |
| 171 | If you find a bug please create an issue in the project bug tracker at |
| 172 | [GitHub](https://github.com/madrisan/nagios-plugins-linux/issues) |