Monitoring Windows Disk Load issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Monitoring Windows Disk Load issue

Post by lpereira »

Hello all:
I'm having issues trying to configure this script "Monitoring Windows Disk Load" i have founded here: http://exchange.nagios.org/directory/Pl ... ad/details
Put the script in the NSClient++ scripts folder, preferably in a subfolder Powershell.
In the nsclient.ini configuration file, define the script like this:

check_ms_win_disk_load = cmd /c echo scripts\powershell\check_ms_win_disk_load.ps1 $ARG1$; exit $LastExitCode | powershell.exe /noprofile -command -

Make a command in Nagios like this:

check_ms_win_disk_load => $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 60 -c check_ms_win_disk_load $ARG1$

Configure your service in Nagios. Make use of the above created command. Configure something similar like this as $ARG1$:

-a '-dl C -ms 5 -rqw 20 -rqc 50'
i have created edited the nsclient++ file and restarted the service... here is where the output:
; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]

check_ms_win_disk_load = cmd /c echo scripts\powershell\check_ms_win_disk_load.ps1 $ARG1$; exit $LastExitCode | powershell.exe /noprofile -command -

; A list of wrapped scripts (ie. scruts using a template mechanism). The template used will be defined by the extension of the script.
[/settings/external scripts/wrapped scripts]

check_ms_win_disk_load = check_ms_win_disk_load
when i run the script with PowerShell on the windows Machine, it works:
PS C:\Program Files\NSClient++\scripts\PowerShell> .\check_ms_win_disk_load.ps1
OK: Drive C: Avg of 2 samples: {Rate (Read: 0.00000MB/s)(Write: 0.08783MB/s)} {Avg Nr of (Reads: 0.00000r/s)(Writes: 3.99644w/s)} {Latency (Read: 0.00000ms)(Write: 0.51248ms)} {Queue Length (Read: 0.00000ql)(Write: 0.00204ql)} | 'Read_Latency'=0.00000ms 'Write_Latency'=0.51248ms 'Read_Queue'=0.00000ql 'Write_Queue'=0.00204ql 'Number_of_Reads'=0.00000r/s 'Number_of_Writes'=3.99644w/s 'Read_Rate'=0.00000MB/s 'Write_Rate'=0.08783MB/s
I have also added the command and service in Nagios
check_ms_win_disk_load => $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 60 -c check_ms_win_disk_load $ARG1$ $ARG2$
But when i run the command from Nagios or Command line, i have no output
[root@nagios libexec]# ./check_nrpe -H 172.X.X.X -p 5666 -t 60 -c check_ms_win_disk_load -dl C -ms 5 -rqw 20 -rqc 50
[root@nagios libexec]#
NsClient log on the windows machine only shows the following output
2017-11-30 08:04:01: error:c:\source\master\modules\CheckExternalScripts\CheckExternalScripts.cpp:541: Failed to find wrapping for type: none
Can anyone please assist?

thanks!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitoring Windows Disk Load issue

Post by mcapra »

Get rid of this section (specifically the check_ms_win_disk_load definition):

Code: Select all

; A list of wrapped scripts (ie. scruts using a template mechanism). The template used will be defined by the extension of the script.
[/settings/external scripts/wrapped scripts]

check_ms_win_disk_load = check_ms_win_disk_load
Restart the NSClient++ service, then try again.

The "wrapped scripts" functionality is to save you time from defining an executable for each individual script. It's not really applicable here unless you're using a non-native version of Powershell.

If I were running a bunch of PHP scripts within NSClient++, but didn't define any PHP paths in my Windows environment variables, I could leverage the "wrapped scripts" functionality to point all of my .php files at the necessary executable.

Or maybe I have Powershell scripts that need to run on a specific version with a specific cmdlet. I could leverage "wrapped scripts" to do that instead of mucking with the environment variables or including specific executable paths in each command definition.
Former Nagios employee
https://www.mcapra.com/
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Monitoring Windows Disk Load issue

Post by npolovenko »

@lpereira, Also don't forget to wrap the arguments with -a ' ', check out the corrected command below:

Code: Select all

./check_nrpe -H 192.168.4.2 -p 5666 -t 60 -c check_ms_win_disk_load -a '-dl C -ms 5 -rqw 20 -rqc 50'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitoring Windows Disk Load issue

Post by lpereira »

I modified as requested, but i still having no response from CLI

Code: Select all

; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]

check_ms_win_disk_load = cmd /c echo scripts\powershell\check_ms_win_disk_load.ps1 $ARG1$; exit $LastExitCode | powershell.exe /noprofile -command -

; A list of wrapped scripts (ie. scruts using a template mechanism). The template used will be defined by the extension of the script.
[/settings/external scripts/wrapped scripts]

i have created also a subfolder called "powershell" and placed the script there. Still no response
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Monitoring Windows Disk Load issue

Post by npolovenko »

@lpereira, Have you restarted NSClient service after you made those changes? Can you upload the whole nsclient.ini file here so that I could go over every setting?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitoring Windows Disk Load issue

Post by lpereira »

npolovenko wrote:@lpereira, Have you restarted NSClient service after you made those changes? Can you upload the whole nsclient.ini file here so that I could go over every setting?
@npolovenko here is the file
You do not have the required permissions to view the files attached to this post.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitoring Windows Disk Load issue

Post by lpereira »

I found what one issue was. for some reason the check_nrpe script was empty. i resoterd a backup and now is working.

BUT...

i'm facing a different issue now..

when i run the command from CLI like this, i got the following error

Code: Select all

[root@nagios libexec]# ./check_nrpe -H 17X.XXX.XXX -p 5666 -t 60 -c check_ms_win_disk_load -a '-dl C -ms 5 -rqw 20 -rqc 50' -n
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).
But if i run it without arguments, i got the proper output

Code: Select all

[root@nagios libexec]# ./check_nrpe -H 17X.XXX.XXX -p 5666 -t 60 -c check_ms_win_disk_load -n
OK: Drive C: Avg of 2 samples: {Rate (Read: 0.00000MB/s)(Write: 0.08947MB/s)} {Avg Nr of (Reads: 0.00000r/s)(Writes: 12.81153w/s)} {Latency (Read: 0.00000ms)(Write: 0.49202ms)} {Queue Length (Read: 0.00000ql)(Write: 0.00621ql)} |'Read_Latency'=0ms 'Write_Latency'=0.49202ms 'Read_Queue'=0ql 'Write_Queue'=0.00621ql 'Number_of_Reads'=0r/s 'Number_of_Writes'=12.81153w/s 'Read_Rate'=0MB/s 'Write_Rate'=0.08946MB/s
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Monitoring Windows Disk Load issue

Post by npolovenko »

@lpereira, I made some changes in you nsclient.ini file to allow arguments. The file is in the attachment. Don't forget to replace the password field and allowed hosts field.
*Also, this file needs to be saved with .ini extension.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: Monitoring Windows Disk Load issue

Post by lpereira »

npolovenko wrote:@lpereira, I made some changes in you nsclient.ini file to allow arguments. The file is in the attachment. Don't forget to replace the password field and allowed hosts field.
*Also, this file needs to be saved with .ini extension.
Thanks, i have modified as requested, now i'm having this error

Code: Select all

[root@nagios libexec]# ./check_nrpe -H 17X.XXX.XXX -p 5666 -t 60 -c check_ms_win_disk_load -a '-dl D -ms 5 -rqw 20 -rqc 50' -n
CHECK_NRPE: Invalid packet type received from server.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Monitoring Windows Disk Load issue

Post by npolovenko »

@lpereira, In nsclient.ini file can you change:

Code: Select all

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = 0

; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = 0
To this:

Code: Select all

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = 1

; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = 1
After that please restart NSClient service and try to run the command:

Code: Select all

./check_nrpe -H 17X.XXX.XXX -p 5666 -t 60 -c check_ms_win_disk_load -a '-dl D -ms 5 -rqw 20 -rqc 50' -n
Notice that in your original you're attempting to check drive D. Please try the same with the drive C:

Code: Select all

./check_nrpe -H 17X.XXX.XXX -p 5666 -t 60 -c check_ms_win_disk_load -a '-dl C -ms 5 -rqw 20 -rqc 50' -n
Let us know if that fixed it.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked