From Segfault
Jump to navigation Jump to search



Use nagios-check_smartmon[1] as a Nagios plugin to check on disk devices:

$ pkg install nagios-check_smartmon                                    # Might depend on smartmontools
$ /usr/local/libexec/nagios/check_smartmon -d /dev/ada0
OK: device is functional and stable (temperature: 35)|TEMP=35;55;60;



There was bsdhwmon[2], but it's dead, apparently. I know of no other tool to grab sensor data off a FreeBSD system :-\



Standard check_memory:

$ sudo apt-get install libnagios-plugin-perl
$ /usr/lib/naemon/plugins/check_memory -w 85 -c 90
MEMORY CRITICAL - 254M free | free=267235328b;85;90

pmp-check-unix-memory from Percona:

$ /usr/lib/naemon/plugins/pmp-check-unix-memory -w 85 -c 90
OK Memory 74% used | memory_used=74;85;90;0;100 outputs caches too:

git clone justintime-nagios-plugins-git
cd justintime-nagios-plugins-git/
sudo install -o root -g root -m 0755 check_mem/ /usr/local/share/nagios/plugins/

$ /usr/local/share/nagios/plugins/ -u -w 80 -c 90
CRITICAL - 91.5% (937376 kB) used!|TOTAL=1024452KB;;;; USED=937376KB;819561;922006;; FREE=87076KB;;;; CACHES=225700KB;;;;

check_mem outputs caches and buffers too:

git clone nagios-memory-git
cd nagios-memory-git
sudo install -o root -g root -m 0755 plugins/check_mem /usr/local/share/nagios/plugins/check_mem
sudo install -o root -g root -m 0644 pnp4nagios/templates/check_mem.php /opt/pnp4nagios/share/templates/

$ plugins/check_mem -w 80 -c 90
MEMORY OK - 73% used | used=775139328;; cached=172224512;; buffers=21344256;; free=80330752;;

A bash version, but no cache and no buffer information and no percentage can be given. Also, the plugin seems to emulate the check_procs --metric RSS command:

git clone zhang-check_proc_mem-git
cd zhang-check_proc_mem-git

$ ./ -w 960 -c 1024 --pid $$
Memory: OK VIRT: 25 MB - RES: 8 MB used!|RES=8388608;;;; outputs caches and buffers too, but has no source code repository:

wget "" -O

For some reason the script is damaged and needs to be repaired:

(echo '#!/bin/sh'; tail -n +2 | fromdos) >
sudo install -o root -g root -m 0755 /usr/local/share/nagios/plugins/

$ /usr/local/share/nagios/plugins/ -w 80 -c 90
Memory: OK Total: 1000 MB - Used: 729 MB - 72% used|TOTAL=1049038848;;;; USED=763695104;;;; CACHE=167231488;;;; BUFFER=23158784;;;;

And a Python variant too, but without performance data, no percentage can be given and there's no buffer or cache output either:

wget "" -O
sudo install -o root -g root -m 0755 /usr/local/share/nagios/plugins/check_memory.p

$ /usr/local/share/nagios/plugins/ 960 1024
OK -- Total Memory 1000MB Current Memory Usage is 923MB Free Memory 76MB

Another one in bash, but without performance data and the switches to display buffer and cache information are not working - and the output is totally off the charts anyway. Only included here for the same of completenes:

git clone shreix-nagios-plugins-git
cd shreix-nagios-plugins-git/
sudo install -o root -g root -m 0755 /usr/local/share/nagios/plugins/

$ /usr/local/share/nagios/plugins/ -w 20 -c 90 -i -b
MEMORY OK - 8.341% is used out of 1024452 kB





TBD: list unused kernel modules






git clone monitoring-plugins-git
cd monitoring-plugins-git

tools/setup && ./configure --prefix=/opt/monitoring-plugins --enable-static
sudo make install
sudo chmod -R a+rX /opt/monitoring-plugins/ && tar -C /opt -cf - monitoring-plugins/               # Install on a remote machine


For monitoring log files, the stock plugin may be too simple, especially with regards to logfile rotation. Let's use check_logfiles instead:

git clone check_logfiles-git
cd check_logfiles-git
sudo apt-get install autoconf automake
autoreconf --install && ./configure --prefix=/opt/check_logfiles --with-nagios-user=nagios --with-nagios-group=nagios && make
sudo make install

Instead of "make install" above, we can install the script manually too:

sudo install -m 0755 -o root -g root plugins-scripts/check_logfiles /usr/local/share/nagios/plugins/



  1. nagios-check_smartmon
  2. bsdhwmon (Archive) - The bsdhwmon project is currently on hiatus.