Monitor disk space by specific value

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
alex3105
Posts: 103
Joined: Sat Jul 28, 2018 10:54 am

Monitor disk space by specific value

Post by alex3105 »

Good Morning,

I want to monitor the free disk space of my Windows and Linux servers but configure the alerts when it is met not in percentage but in specific value in Gb of 5 for warning and 10 for critical.

I have reviewed the url https://support.nagios.com/kb/article.p ... free_value, in the Disk Free Space - Specified value section and I have found some plugins that can solve my problem but nevertheless I have the following doubts:
1. Can I not add my remote host with the check_disk plugin? I mean it doesn't have the host parameter or how I add it.
2. I installed nrpe by following the url: https://support.nagios.com/kb/article.php?id=515 but when executing the test command I get
./check_nrpe -H 192.168.32.16 -c check_drivesize -a drive=C: 'warning=free<10G' 'critical=free<5G' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${free} free / ${size} total}' top-syntax='${status}: ${problem_list}'
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).

With the same check_nrpe the following commands applied to a remote computer I get an answer

./check_nrpe -H 192.168.32.16 -c check_cpu
./check_nrpe -H 192.168.32.16 -c check_memory
./check_nrpe -H 192.168.32.16 -c check_drivesize

I would be grateful if you could indicate to me what would be the best way to monitor the disk of my equipment, or the plugin with some suitable argument.

Best regards
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Monitor disk space by specific value

Post by mbellerue »

1. The check_disk plugin is meant to be run on the remote host itself, and is called by an agent like NRPE or NCPA. It looks like you have NRPE installed already, so let's focus on that agent.

2. You linked to the document for installing NRPE from source, but it looks like you are trying to monitor a Windows machine. Is the remote machine a Windows machine? Is it running NSClient++ to provide the NRPE service?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
alex3105
Posts: 103
Joined: Sat Jul 28, 2018 10:54 am

Re: Monitor disk space by specific value

Post by alex3105 »

Hi,

The remote computer if it is a Windows, I am also using NSclient by enabling the Enable NRPE Server option (check_nrpe).

Best Regards,
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Monitor disk space by specific value

Post by mbellerue »

On your remote system, in the nsclient.ini file you should have a section titled [/settings/NRPE/server]. Make sure you have these entries.

Code: Select all

allow arguments = 1
allow nasty characters = true
Restart the NSClient service, and then try your check_nrpe command again.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
alex3105
Posts: 103
Joined: Sat Jul 28, 2018 10:54 am

Re: Monitor disk space by specific value

Post by alex3105 »

Hello,

Make the changes but now I get this:
[root@localhost libexec]# ./check_nrpe -H 192.168.32.16 -c check_drivesize -a drive=C: 'warning=free<10G' 'critical=free<5G' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${free} free / ${size} total}' top-syntax='${status}: ${problem_list}'
CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with 192.168.32.16: 1

I have verified that there is an rule in my firewall of my pc that allows access to port 5666, In addition to some possible solutions of:

https://support.nagios.com/forum/viewto ... =6&t=50275
https://support.nagios.com/forum/viewto ... =7&t=49392
------------------
define command {
command_name check_nrpe
command_line USER1$/check_nrpe -H $HOSTADDRESS$ -2 -t 30 -c $ARG1$ $ARG2$
}
-----------------------------
[root@localhost libexec]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v3.2.1
----------------------
[root@localhost libexec]# ps axuw | grep nrpe
nagios 992 0.0 0.1 42784 2748 ? Ss 21:29 0:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f
[root@localhost libexec]# netstat -apt | grep nrpe
tcp 0 0 0.0.0.0:nrpe 0.0.0.0:* LISTEN 992/nrpe
tcp6 0 0 [::]:nrpe [::]:* LISTEN 992/nrpe
-------------------------
[root@localhost libexec]# service nrpe restart; tail -f /var/log/messages
Redirecting to /bin/systemctl restart nrpe.service
Oct 14 23:01:46 localhost nagios: HOST NOTIFICATION: user3ctx;MGMT;DOWN;notify-host-by-email-html;CRITICAL - Host Unreachable (192.168.32.10)
Oct 14 23:02:14 localhost nagios: HOST NOTIFICATION: user1ctx;ENDIAN;DOWN;notify-host-by-email-html;CRITICAL - Host Unreachable (192.168.32.15)
Oct 14 23:02:14 localhost nagios: HOST NOTIFICATION: user3ctx;ENDIAN;DOWN;notify-host-by-email-html;CRITICAL - Host Unreachable (192.168.32.15)
Oct 14 23:02:14 localhost nagios: HOST NOTIFICATION: user2ctx;ENDIAN;DOWN;notify-host-by-email-html;CRITICAL - Host Unreachable (192.168.32.15)
Oct 14 23:02:14 localhost nagios: HOST NOTIFICATION: user4ctx;ENDIAN;DOWN;notify-host-by-email-html;CRITICAL - Host Unreachable (192.168.32.15)
Oct 14 23:04:23 localhost nrpe[992]: Caught SIGTERM - shutting down...
Oct 14 23:04:23 localhost systemd: Stopping Nagios Remote Plugin Executor...
Oct 14 23:04:23 localhost nrpe[992]: Daemon shutdown
Oct 14 23:04:23 localhost systemd: Started Nagios Remote Plugin Executor.
Oct 14 23:04:23 localhost systemd: Starting Nagios Remote Plugin Executor...
Oct 14 23:04:23 localhost nrpe[20625]: Starting up daemon
Oct 14 23:04:23 localhost nrpe[20625]: Server listening on 0.0.0.0 port 5666.
Oct 14 23:04:23 localhost nrpe[20625]: Server listening on :: port 5666.
Oct 14 23:04:23 localhost nrpe[20625]: Warning: Daemon is configured to accept command arguments from clients!
Oct 14 23:04:23 localhost nrpe[20625]: Listening for connections on port 5666
Oct 14 23:04:23 localhost nrpe[20625]: Allowing connections from: 127.0.0.1,::1,192.168.32.14
---------------
[root@localhost libexec]# rpm -qa | grep openssl
xmlsec1-openssl-1.2.20-7.el7_4.x86_64
openssl-1.0.2k-12.el7.x86_64
openssl-devel-1.0.2k-12.el7.x86_64
openssl-libs-1.0.2k-12.el7.x86_64


Best Regards
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Monitor disk space by specific value

Post by mbellerue »

Can you post the nsclient.ini file from your remote Windows machine? It should be located in C:\Program Files\NSClient++\nsclient.ini.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
alex3105
Posts: 103
Joined: Sat Jul 28, 2018 10:54 am

Re: Monitor disk space by specific value

Post by alex3105 »

A thousand apologies for the delay .. I attach the requested file

Support Edit: nsclient.log and nsclient.ini downloaded and shared with team.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Monitor disk space by specific value

Post by mbellerue »

Perfect, thank you!

Under [/settings/NRPE/server], if you change verify mode from peer-cert to either peer or none, you should be able to complete your service check. More information can be had here,
https://docs.nsclient.org/reference/win ... ify-mode_1
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
alex3105
Posts: 103
Joined: Sat Jul 28, 2018 10:54 am

Re: Monitor disk space by specific value

Post by alex3105 »

Make the change and restart the NsClient service and even restart my computer but the same error message appears, could you please help me.

CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with 192.168.32.16: 1
Attachments
nsclient.log
(2.63 KiB) Downloaded 176 times
nsclient.ini
(1.06 KiB) Downloaded 180 times
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Monitor disk space by specific value

Post by mbellerue »

Oh, there was an extra verify mode=peer-cert. I've removed that. Try using the config file attached to this post.
Attachments
nsclient.ini
(1.01 KiB) Downloaded 164 times
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked