Can't Get "alias_disk" to use GB instead of % when checking

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.
Nighthawkz
Posts: 27
Joined: Fri Oct 20, 2017 7:05 am

Can't Get "alias_disk" to use GB instead of % when checking

Post by Nighthawkz »

I have the current check as follows on a windows 2008 r2 server:

Code: Select all

; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
alias_disk = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED
pretty standard

so i wanted it to check usign disk size ratehr than percentage. So changed it to this:

Code: Select all

; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
alias_disk = CheckDriveSize MinWarn=35GB MinCrit=30GB CheckAll FilterType=FIXED
and restarted the remote servers NSclient.

running a manual check from nagios :

Code: Select all

 /usr/local/nagios/libexec/check_nrpe -H pod-pl-iis2 -c alias_disk
successfully reports "CRITICAL: C:\: Total: 49.7G - Used: 20.6G (41%) - Free: 29.1G (59%) < critical|'C:\ %'=59%;29;39 'C:\'=20.57G;35;30;0;49.65"

The problem is when nagios automatically runs a schdueled check it reports back as "OK: all drives within bounds

I did a bit of digging to see how it is set up and the disk space check i think is set up as follows:


define service{
use generic-service
host_name !mail.poad
hostgroup_name pod-pl-iis2
service_description Drive Space
check_command check_nrpe!alias_disk_loose
servicegroups drivespace
}


define servicegroup{
servicegroup_name drivespace
alias Drive_Space
}

so i changed the alias_disk_loose as well to match (and restarted the remote windows NSclient)

Code: Select all

; alias_disk_loose - Alias for alias_disk_loose. To configure this item add a section called: /settings/external scripts/alias/alias_disk_loose
alias_disk_loose = CheckDriveSize MinWarn=35GB MinCrit=30GB CheckAll FilterType=FIXED ignore-unreadable
Again. manual run of the check reports correctly. nagios automatic nrpe check of it reports no errors.

apologise if i've missed anythign vital off - Still working my way around this application and i'm not sure where to look next

any help would be appreciated

Regards
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by npolovenko »

Hello, @Nighthawkz. You can add ShowAll=long argument to the command definition:

define service{
use generic-service
host_name !mail.poad
hostgroup_name pod-pl-iis2
service_description Drive Space
check_command check_nrpe!alias_disk_loose!ShowAll=long
servicegroups drivespace
}

After that please restart Nagios with

Code: Select all

 service nagios restart
Let us know if that helped.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Nighthawkz
Posts: 27
Joined: Fri Oct 20, 2017 7:05 am

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by Nighthawkz »

npolovenko wrote:Hello, @Nighthawkz. You can add ShowAll=long argument to the command definition:

define service{
use generic-service
host_name !mail.poad
hostgroup_name pod-pl-iis2
service_description Drive Space
check_command check_nrpe!alias_disk_loose!ShowAll=long
servicegroups drivespace
}

After that please restart Nagios with

Code: Select all

 service nagios restart
Let us know if that helped.
hi @npolovenko

thank you for your response! i did as you suggested and restarted nagios.

Interestingly, when i added this to the end of the command definition, it changed the particular line to yellow.

but more importantly it unfortunately did not change anything. Nagios core still reports the disk space as within thresholds even though if i query manual using :

/usr/local/nagios/libexec/check_nrpe -H pod-pl-iis2 -c alias_disk_loose

it reports the disk space as a warning (as i'd expect it to)
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by lmiltchev »

What is the NSClient++ version that you are currently using?

You can try the following (if the version of your agent supports it):

In the nsclient.ini file:

Code: Select all

alias_disk_loose = check_drivesize warning=free<35G critical=free<30G show-all perf-config=*(unit:G)
Test it from your nagios server:

Code: Select all

./check_nrpe -H <remote ip> -c alias_disk_loose
Be sure to check out our Knowledgebase for helpful articles and solutions!
Nighthawkz
Posts: 27
Joined: Fri Oct 20, 2017 7:05 am

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by Nighthawkz »

@lmiltchev

thanks for the response

I'm using NSCLIENT++ version 0.4.1.90 (2013-02-04)


I added the line you suggested and it threw the following error:

Code: Select all

nagios:~ # /usr/local/nagios/libexec/check_nrpe -H pod-pl-iis2 -c alias_disk_loose
CRITICAL: Could not get free space for: warning warning reason: 3: The system cannot find the path specified.
I tried changing the letter from G to C but it threw the same error.

I also then tried usning just

Code: Select all

alias_disk_loose = CheckDriveSize MinWarn=35GB MinCrit=30G
if I query from my nagios server I get the correct warning back:
WARNING: C:\: Total: 49.7G - Used: 16.4G (33%) - Free: 33.2G (67%) < warning|'C:\ %'=67%;29;39 'C:\'=16.42G;35;30;0;49.65
but nagiso core still shows the service as ok despite restarts etc (image in below link)

https://postimg.org/image/hgi4via4n/
Last edited by Nighthawkz on Tue Dec 12, 2017 8:23 am, edited 1 time in total.
Nighthawkz
Posts: 27
Joined: Fri Oct 20, 2017 7:05 am

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by Nighthawkz »

I didn't even notice the file upload option....so i've uploaded the image rather than you having to go to that link if preferred!
Attachments
nagiso core
nagiso core
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by lmiltchev »

Other users reported similar errors ("The system cannot find the path specified."), and here's what Michael Medin (the developer of NSClient++) had to say:
I fixed a few of these recently so try upgrading to latest 0.4.4. or 0.5.0
https://forums.nsclient.org/t/the-syste ... olved/4113

Try upgrading your NSClient++ version to see if this is going to fix the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Nighthawkz
Posts: 27
Joined: Fri Oct 20, 2017 7:05 am

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by Nighthawkz »

@lmiltchev



I upgraded to the latest version of the NSclient++

copied my old config ini back in, changed the disk space command to your suggested and it is now successfully reporting back!

thank you for your help!

*edit - i got a bit too excited. it did correctly display a critical warning properly but I then changed the threshold to somethign mroe reasonable, and the check does not pick it up (i've bounced oth the client AND the box to make sure). it's still displaying a critical but i don't believe it should be.

warning=free<35G critical=free<25G

to

warning=free<8G critical=free<5G

(whole line

Code: Select all

 alias_disk_loose = check_drivesize warning=free<8G critical=free<5G show-all perf-config=*(unit:G)
)

still at least nagios core is now actually displaying! I don't believe the check is wrong as none of my drives are below either 8 or 5 GB.

Code: Select all

CRITICAL critical(D:\: 0B/0B used, A:\: 0B/0B used), C:\: 38.665GB/68.326GB used, S:\: 737.347GB/899.996GB used, F:\: 177.932GB/299.996GB used|'C:\ free'=29.66141G;8;5;0;68.32616 'C:\ free %'=43%;12;7;0;100 'S:\ free'=162.64929G;8;5;0;899.99608 'S:\ free %'=18%;1;1;0;100 'D:\ free'=0G;8;5;0;0 'A:\ free'=0G;8;5;0;0 'F:\ free'=122.06395G;8;5;0;299.99609 'F:\ free %'=41%;3;2;0;100
unless I am reading this out put wrong?

*EDIT i didn't realise it was also checking the A and D drive. i've since excluded them - all is good!
kyang

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by kyang »

Sounds good then!

Are we okay to lock this up?
Nighthawkz
Posts: 27
Joined: Fri Oct 20, 2017 7:05 am

Re: Can't Get "alias_disk" to use GB instead of % when check

Post by Nighthawkz »

@kyang

Yes thank you - happy for this to be closed/locked :)
Locked