How to check for free/used space in GB with NRPE (Linux)
How to check for free/used space in GB with NRPE (Linux)
Hello XI support
How to check for free/used space in GB with NRPE (Linux)
- with check_disk command?
Thank you
How to check for free/used space in GB with NRPE (Linux)
- with check_disk command?
Thank you
Re: How to check for free/used space in GB with NRPE (Linux)
check_disk accepts a "units" argument that should allow you to get the output in terms of kilobytes, megabytes (default), gigabytes, or terabytes.
From ./check_disk -h:
Applied like so:
In your Nagios XI configuration, you would simply reconfigure the service check adding -u GB to the arguments passed to check_disk.
From ./check_disk -h:
Code: Select all
-u, --units=STRING
Choose bytes, kB, MB, GB, TB (default: MB)
Code: Select all
[root@localhost libexec]# ./check_disk -u kB
DISK OK - free space: / 15482344 kB (84% inode=99%); /dev 1931056 kB (100% inode=99%); /dev/shm 1941232 kB (100% inode=99%); /run 1723688 kB (88% inode=98%); /sys/fs/cgroup 1941232 kB (100% inode=99%); /boot 383132 kB (75% inode=99%); /run/user/0 388248 kB (100% inode=99%); /run/user/1000 388248 kB (100% inode=99%);| /=2824728kB;;;0;18307072 /dev=0kB;;;0;1931056 /dev/shm=0kB;;;0;1941232 /run=217544kB;;;0;1941232 /sys/fs/cgroup=0kB;;;0;1941232 /boot=125456kB;;;0;508588 /run/user/0=0kB;;;0;388248 /run/user/1000=0kB;;;0;388248
....
[root@localhost libexec]# ./check_disk -u GB
DISK OK - free space: / 14 GB (84% inode=99%); /dev 1 GB (100% inode=99%); /dev/shm 1 GB (100% inode=99%); /run 1 GB (88% inode=98%); /sys/fs/cgroup 1 GB (100% inode=99%); /boot 0 GB (75% inode=99%); /run/user/0 0 GB (100% inode=99%); /run/user/1000 0 GB (100% inode=99%);| /=2GB;;;0;17 /dev=0GB;;;0;1 /dev/shm=0GB;;;0;1 /run=0GB;;;0;1 /sys/fs/cgroup=0GB;;;0;1 /boot=0GB;;;0;0 /run/user/0=0GB;;;0;0 /run/user/1000=0GB;;;0;0
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: How to check for free/used space in GB with NRPE (Linux)
Thank you, how to configure warnings / criticals in this case?mcapra wrote:check_disk accepts a "units" argument that should allow you to get the output in terms of kilobytes, megabytes (default), gigabytes, or terabytes.
From ./check_disk -h:Applied like so:Code: Select all
-u, --units=STRING Choose bytes, kB, MB, GB, TB (default: MB)
In your Nagios XI configuration, you would simply reconfigure the service check adding -u GB to the arguments passed to check_disk.Code: Select all
[root@localhost libexec]# ./check_disk -u kB DISK OK - free space: / 15482344 kB (84% inode=99%); /dev 1931056 kB (100% inode=99%); /dev/shm 1941232 kB (100% inode=99%); /run 1723688 kB (88% inode=98%); /sys/fs/cgroup 1941232 kB (100% inode=99%); /boot 383132 kB (75% inode=99%); /run/user/0 388248 kB (100% inode=99%); /run/user/1000 388248 kB (100% inode=99%);| /=2824728kB;;;0;18307072 /dev=0kB;;;0;1931056 /dev/shm=0kB;;;0;1941232 /run=217544kB;;;0;1941232 /sys/fs/cgroup=0kB;;;0;1941232 /boot=125456kB;;;0;508588 /run/user/0=0kB;;;0;388248 /run/user/1000=0kB;;;0;388248 .... [root@localhost libexec]# ./check_disk -u GB DISK OK - free space: / 14 GB (84% inode=99%); /dev 1 GB (100% inode=99%); /dev/shm 1 GB (100% inode=99%); /run 1 GB (88% inode=98%); /sys/fs/cgroup 1 GB (100% inode=99%); /boot 0 GB (75% inode=99%); /run/user/0 0 GB (100% inode=99%); /run/user/1000 0 GB (100% inode=99%);| /=2GB;;;0;17 /dev=0GB;;;0;1 /dev/shm=0GB;;;0;1 /run=0GB;;;0;1 /sys/fs/cgroup=0GB;;;0;1 /boot=0GB;;;0;0 /run/user/0=0GB;;;0;0 /run/user/1000=0GB;;;0;0
Re: How to check for free/used space in GB with NRPE (Linux)
For check_disk, the warning and critical thresholds adopt the units you define when calling the script.
Warning at 2GB remaining, critical at 1GB remaining:
Warning at 2KB remaining, critical at 1KB remaining:
You will notice, based on the units we are using, one check generates a CRITICAL status while the other generates an OK status.
The syntax is the same. The only thing that changes is the units. If you use percentages, it doesn't matter what unit is set as far as alerts are concerned.
Warning at 2GB remaining, critical at 1GB remaining:
Code: Select all
[root@localhost libexec]# ./check_disk -u GB -w 2 -c 1
DISK CRITICAL - free space: / 14 GB (84% inode=99%); /dev 1 GB (100% inode=99%); /dev/shm 1 GB (100% inode=99%); /run 1 GB (88% inode=97%); /sys/fs/cgroup 1 GB (100% inode=99%); /boot 0 GB (75% inode=99%); /run/user/0 0 GB (100% inode=99%); /run/user/1000 0 GB (100% inode=99%);| /=2GB;15;16;0;17 /dev=0GB;-1;0;0;1 /dev/shm=0GB;-1;0;0;1 /run=0GB;-1;0;0;1 /sys/fs/cgroup=0GB;-1;0;0;1 /boot=0GB;-2;-1;0;0 /run/user/0=0GB;-2;-1;0;0 /run/user/1000=0GB;-2;-1;0;0
Code: Select all
[root@localhost libexec]# ./check_disk -u kB -w 2 -c 1
DISK OK - free space: / 15471144 kB (84% inode=99%); /dev 1931056 kB (100% inode=99%); /dev/shm 1941232 kB (100% inode=99%); /run 1719664 kB (88% inode=97%); /sys/fs/cgroup 1941232 kB (100% inode=99%); /boot 383132 kB (75% inode=99%); /run/user/0 388248 kB (100% inode=99%); /run/user/1000 388248 kB (100% inode=99%);| /=2835928kB;18307070;18307071;0;18307072 /dev=0kB;1931054;1931055;0;1931056 /dev/shm=0kB;1941230;1941231;0;1941232 /run=221568kB;1941230;1941231;0;1941232 /sys/fs/cgroup=0kB;1941230;1941231;0;1941232 /boot=125456kB;508586;508587;0;508588 /run/user/0=0kB;388246;388247;0;388248 /run/user/1000=0kB;388246;388247;0;388248
The syntax is the same. The only thing that changes is the units. If you use percentages, it doesn't matter what unit is set as far as alerts are concerned.
Code: Select all
[root@localhost libexec]# ./check_disk -u GB -w 75% -c 20%
DISK WARNING - free space: / 14 GB (84% inode=99%); /dev 1 GB (100% inode=99%); /dev/shm 1 GB (100% inode=99%); /run 1 GB (88% inode=97%); /sys/fs/cgroup 1 GB (100% inode=99%); /boot 0 GB (75% inode=99%); /run/user/0 0 GB (100% inode=99%); /run/user/1000 0 GB (100% inode=99%);| /=2GB;4;13;0;17 /dev=0GB;0;0;0;1 /dev/shm=0GB;0;0;0;1 /run=0GB;0;0;0;1 /sys/fs/cgroup=0GB;0;0;0;1 /boot=0GB;0;0;0;0 /run/user/0=0GB;0;0;0;0 /run/user/1000=0GB;0;0;0;0
...
[root@localhost libexec]# ./check_disk -u kB -w 75% -c 20%
DISK WARNING - free space: / 15471092 kB (84% inode=99%); /dev 1931056 kB (100% inode=99%); /dev/shm 1941232 kB (100% inode=99%); /run 1719856 kB (88% inode=97%); /sys/fs/cgroup 1941232 kB (100% inode=99%); /boot 383132 kB (75% inode=99%); /run/user/0 388248 kB (100% inode=99%); /run/user/1000 388248 kB (100% inode=99%);| /=2835980kB;4576768;14645657;0;18307072 /dev=0kB;482764;1544844;0;1931056 /dev/shm=0kB;485308;1552985;0;1941232 /run=221376kB;485308;1552985;0;1941232 /sys/fs/cgroup=0kB;485308;1552985;0;1941232 /boot=125456kB;127147;406870;0;508588 /run/user/0=0kB;97062;310598;0;388248 /run/user/1000=0kB;97062;310598;0;388248
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: How to check for free/used space in GB with NRPE (Linux)
This is not what I meant :-\mcapra wrote:For check_disk, the warning and critical thresholds adopt the units you define when calling the script.
Warning at 2GB remaining, critical at 1GB remaining:Warning at 2KB remaining, critical at 1KB remaining:Code: Select all
[root@localhost libexec]# ./check_disk -u GB -w 2 -c 1 DISK CRITICAL - free space: / 14 GB (84% inode=99%); /dev 1 GB (100% inode=99%); /dev/shm 1 GB (100% inode=99%); /run 1 GB (88% inode=97%); /sys/fs/cgroup 1 GB (100% inode=99%); /boot 0 GB (75% inode=99%); /run/user/0 0 GB (100% inode=99%); /run/user/1000 0 GB (100% inode=99%);| /=2GB;15;16;0;17 /dev=0GB;-1;0;0;1 /dev/shm=0GB;-1;0;0;1 /run=0GB;-1;0;0;1 /sys/fs/cgroup=0GB;-1;0;0;1 /boot=0GB;-2;-1;0;0 /run/user/0=0GB;-2;-1;0;0 /run/user/1000=0GB;-2;-1;0;0You will notice, based on the units we are using, one check generates a CRITICAL status while the other generates an OK status.Code: Select all
[root@localhost libexec]# ./check_disk -u kB -w 2 -c 1 DISK OK - free space: / 15471144 kB (84% inode=99%); /dev 1931056 kB (100% inode=99%); /dev/shm 1941232 kB (100% inode=99%); /run 1719664 kB (88% inode=97%); /sys/fs/cgroup 1941232 kB (100% inode=99%); /boot 383132 kB (75% inode=99%); /run/user/0 388248 kB (100% inode=99%); /run/user/1000 388248 kB (100% inode=99%);| /=2835928kB;18307070;18307071;0;18307072 /dev=0kB;1931054;1931055;0;1931056 /dev/shm=0kB;1941230;1941231;0;1941232 /run=221568kB;1941230;1941231;0;1941232 /sys/fs/cgroup=0kB;1941230;1941231;0;1941232 /boot=125456kB;508586;508587;0;508588 /run/user/0=0kB;388246;388247;0;388248 /run/user/1000=0kB;388246;388247;0;388248
The syntax is the same. The only thing that changes is the units. If you use percentages, it doesn't matter what unit is set as far as alerts are concerned.Code: Select all
[root@localhost libexec]# ./check_disk -u GB -w 75% -c 20% DISK WARNING - free space: / 14 GB (84% inode=99%); /dev 1 GB (100% inode=99%); /dev/shm 1 GB (100% inode=99%); /run 1 GB (88% inode=97%); /sys/fs/cgroup 1 GB (100% inode=99%); /boot 0 GB (75% inode=99%); /run/user/0 0 GB (100% inode=99%); /run/user/1000 0 GB (100% inode=99%);| /=2GB;4;13;0;17 /dev=0GB;0;0;0;1 /dev/shm=0GB;0;0;0;1 /run=0GB;0;0;0;1 /sys/fs/cgroup=0GB;0;0;0;1 /boot=0GB;0;0;0;0 /run/user/0=0GB;0;0;0;0 /run/user/1000=0GB;0;0;0;0 ... [root@localhost libexec]# ./check_disk -u kB -w 75% -c 20% DISK WARNING - free space: / 15471092 kB (84% inode=99%); /dev 1931056 kB (100% inode=99%); /dev/shm 1941232 kB (100% inode=99%); /run 1719856 kB (88% inode=97%); /sys/fs/cgroup 1941232 kB (100% inode=99%); /boot 383132 kB (75% inode=99%); /run/user/0 388248 kB (100% inode=99%); /run/user/1000 388248 kB (100% inode=99%);| /=2835980kB;4576768;14645657;0;18307072 /dev=0kB;482764;1544844;0;1931056 /dev/shm=0kB;485308;1552985;0;1941232 /run=221376kB;485308;1552985;0;1941232 /sys/fs/cgroup=0kB;485308;1552985;0;1941232 /boot=125456kB;127147;406870;0;508588 /run/user/0=0kB;97062;310598;0;388248 /run/user/1000=0kB;97062;310598;0;388248
How to check for something like 100 MB left : warning / 50 MB left: critical
Re: How to check for free/used space in GB with NRPE (Linux)
Locally:dlukinski wrote:How to check for something like 100 MB left : warning / 50 MB left: critical
Code: Select all
./check_disk -u MB -w 100 -c 50
Code: Select all
./check_nrpe -H x.x.x.x -c check_disk -a '-u MB -w 100 -c 50'
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: How to check for free/used space in GB with NRPE (Linux)
This worked, thank youmcapra wrote:Locally:dlukinski wrote:How to check for something like 100 MB left : warning / 50 MB left: criticalWith NRPE:Code: Select all
./check_disk -u MB -w 100 -c 50Keep in mind that this will check the remaining space of every mount point on the monitored machine.Code: Select all
./check_nrpe -H x.x.x.x -c check_disk -a '-u MB -w 100 -c 50'
Please close the case