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.
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Thu Nov 01, 2018 11:41 am
Nagios Core 4.3.4
Nsclient 5.1.44
I would like to see check_drivesize show the Volume Label on Windows Servers.
the check returns the Drive Letter.
Code: Select all
# z-drive.proto
define service{
use generic-service
host_name Hostnames
service_description Z:\ Drive Space
servicegroups disk_usage
is_volatile 0
check_period 24x7
max_check_attempts 3
check_interval 5
retry_interval 1
contact_groups NT-admins
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_win_disk!Z
}
Code: Select all
# Use for nrpe (Windows Server Check Disk)
define command{
command_name check_win_disk
command_line $USER1$/check_nrpe -A $USER5$/ca/anakin-ca.crt -C $USER5$/nagios_server/nagios_server.crt -K $USER5$/nagios_server/nagios_server.key -2 -P 8192 -H $HOSTADDRESS$ -t 30 -c check_drivesize -a drive=$ARG1$ "detail-syntax=%(drive) - Total: %(size) - Used: %(used) (%(used_pct)%) - Free: %(free) (%(free_pct)%)" show-all
}
Thank you
Tom
npolovenko
Support Tech
Posts: 3457 Joined: Mon May 15, 2017 5:00 pm
Post
by npolovenko » Fri Nov 02, 2018 2:10 pm
@kwhogster , Can you run and show me the current output of the command that you have?
You may need to add the ${drive_or_name} to the detail-syntax portion.
[root@centos7x64 libexec]# ./check_nrpe -H 192.168.3.145 -c check_drivesize -a drive=C: 'warning=free<20%' 'critical=free<10%' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
OK: {C: 66% free / 451.93GB total}|'C: free'=301.82408G;90.38594;45.19297;0;451.9297 'C: free %'=67%;20;10;0;100
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Fri Nov 02, 2018 4:00 pm
From my current command
I:\ Drive Space Notifications for this service have been disabled
CRITICAL 11-02-2018 16:53:48 31d 2h 56m 41s 3/3 CRITICAL critical(I: - Total: 2TB - Used: 1.974TB (99%) - Free: 26.088GB (1%))
Shows drive letter
I tried your check
/usr/lib64/nagios/plugins/check_nrpe -A /usr/local/nagios/certs/ca/anakin-ca.crt -C /usr/local/nagios/certs/nagios_server/nagios_server.crt -K /usr/local/nagios/certs/nagios_server/nagios_server.key -2 -P 8192 -H brandy -t 30 -c check_drivesize -a drive=i detail-syntax='{${drive_or_name} ${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
CRITICAL: {i: 1% free / 2TB total}|'i: used'=1.97439TB;1.5999;1.79988;0;1.99987 'i: used %'=99%;80;90;0;100
Drive Volumes Names
Thank you
npolovenko
Support Tech
Posts: 3457 Joined: Mon May 15, 2017 5:00 pm
Post
by npolovenko » Mon Nov 05, 2018 4:00 pm
@kwhogster , I see. In your command please change:
detail-syntax=%(drive)
to
detail-syntax=%(drive)%(name)
Or if you want to use my check instead:
/usr/lib64/nagios/plugins/check_nrpe -A /usr/local/nagios/certs/ca/anakin-ca.crt -C /usr/local/nagios/certs/nagios_server/nagios_server.crt -K /usr/local/nagios/certs/nagios_server/nagios_server.key -2 -P 8192 -H brandy -t 30 -c check_drivesize -a drive=i detail-syntax='{${name} ${drive}${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Mon Nov 05, 2018 4:57 pm
that still did not provide the name
/usr/lib64/nagios/plugins/check_nrpe -A /usr/local/nagios/certs/ca/anakin-ca.crt -C /usr/local/nagios/certs/nagios_server/nagios_server.crt -K /usr/local/nagios/certs/nagios_server/nagios_server.key -2 -P 8192 -H brandy -t 30 -c check_drivesize -a drive=i detail-syntax='{${name} ${drive}${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
CRITICAL: { i:1% free / 2TB total}|'i: used'=1.97439TB;1.5999;1.79988;0;1.99987 'i: used %'=99%;80;90;0;100
I should be getting back archiver-4 which is the I:\ drive
npolovenko
Support Tech
Posts: 3457 Joined: Mon May 15, 2017 5:00 pm
Post
by npolovenko » Mon Nov 05, 2018 5:56 pm
@kwhogster , For some reason, this check gives me volume labels only when I include "drive=all-volumes".
[root@centos7x64 libexec]# ./check_nrpe -H 192.168.3.145 -c check_drivesize -a 'drive=all-volumes' 'warning=free<20%' 'critical=free<10%' show-all 'perf-config=*(unit:G)' detail-syntax='{${name} ${drive} ${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
CRITICAL: critical({AXIS D:\ 0% free / 172.326MB total}), {OS C:\ 66% free / 451.93GB total}|'C:\ free'=302.77672G;90.38594;45.19297;0;451.9297 'C:\ free %'=67%;20;10;0;100 'D:\ free'=0G;0.03365;0.01682;0;0.16828 'D:\ free %'=0%;20;10;0;100
Can you check if that's the case with your command as well?
/usr/lib64/nagios/plugins/check_nrpe -A /usr/local/nagios/certs/ca/anakin-ca.crt -C /usr/local/nagios/certs/nagios_server/nagios_server.crt -K /usr/local/nagios/certs/nagios_server/nagios_server.key -2 -P 8192 -H brandy -t 30 -c check_drivesize -a drive=all-volumes detail-syntax='{${name} ${drive}${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Mon Nov 05, 2018 7:35 pm
/usr/lib64/nagios/plugins/check_nrpe -A /usr/local/nagios/certs/ca/anakin-ca.crt -C /usr/local/nagios/certs/nagios_server/nagios_server.crt -K /usr/local/nagios/certs/nagios_server/nagios_server.key -2 -P 8192 -H brandy -t 30 -c check_drivesize -a drive=all-volumes detail-syntax='{${name} ${drive}${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
CRITICAL: { F:\17% free / 2TB total}, {Archiver-2 G:\11% free / 2TB total}, {Archiver-4 I:\1% free / 2TB total}, {Archiver-5 J:\5% free / 2TB total}, {Archiver-6 K:\2% free / 2TB total}, {Archiver-7 L:\7% free / 2TB total}, {Archiver-8 M:\1% free / 2TB total}, {Archive-11 Q:\2% free / 2TB total}, {Archive-13 Z:\0% free / 19.766GB total}|'F:\ used'=1.64555TB;1.5999;1.79988;0;1.99987 'F:\ used %'=82%;80;90;0;100 'G:\ used'=1.7713TB;1.5999;1.79988;0;1.99987 'G:\ used %'=89%;80;90;0;100 'H:\ used'=0.95062TB;1.5999;1.79988;0;1.99987 'H:\ used %'=48%;80;90;0;100 'I:\ used'=1.97439TB;1.5999;1.79988;0;1.99987 'I:\ used %'=99%;80;90;0;100 'J:\ used'=1.89554TB;1.5999;1.79988;0;1.99987 'J:\ used %'=95%;80;90;0;100 'K:\ used'=1.94185TB;1.5999;1.79988;0;1.99987 'K:\ used %'=97%;80;90;0;100 'L:\ used'=1.84818TB;1.5999;1.79988;0;1.99987 'L:\ used %'=92%;80;90;0;100 'M:\ used'=1.97887TB;1.5999;1.79988;0;1.99987 'M:\ used %'=99%;80;90;0;100 'Q:\ used'=1.9419TB;1.59999;1.79999;0;1.99999 'Q:\ used %'=97%;80;90;0;100 'N:\ used'=1.22035TB;1.59999;1.79999;0;1.99999 'N:\ used %'=61%;80;90;0;100 'T:\ used'=0.36892TB;1.59999;1.79999;0;1.99999 'T:\ used %'=18%;80;90;0;100 'P:\ used'=0.01677TB;1.59999;1.79999;0;1.99999 'P:\ used %'=1%;80;90;0;100 'R:\ used'=33.13773GB;35.89843;40.38573;0;44.87304 'R:\ used %'=74%;80;90;0;100 'S:\ used'=10.05212GB;11.99765;13.49736;0;14.99706 'S:\ used %'=67%;80;90;0;100 'Z:\ used'=19.76556GB;15.81249;17.78905;0;19.76562 'Z:\ used %'=100%;80;90;0;100 'D:\ used'=9.34549GB;15.99999;17.99999;0;19.99999 'D:\ used %'=47%;80;90;0;100 'C:\ used'=30.15364GB;40.10702;45.1204;0;50.13378 'C:\ used %'=60%;80;90;0;100 'E:\ used'=19.06842GB;31.99765;35.99736;0;39.99706 'E:\ used %'=48%;80;90;0;100 'A:\ used'=0B;0;0;0;0 'B:\ used'=0B;0;0;0;0
That shows the volume name
So how do we get it on only one drive?
Thanks
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Tue Nov 06, 2018 8:13 am
Something like this for F
Code: Select all
/usr/lib64/nagios/plugins/check_nrpe -A /usr/local/nagios/certs/ca/anakin-ca.crt -C /usr/local/nagios/certs/nagios_server/nagios_server.crt -K /usr/local/nagios/certs/nagios_server/nagios_server.key -2 -P 8192 -H brandy -t 30 -c check_drivesize -a drive=F detail-syntax='{${name} ${drive}${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Tue Nov 06, 2018 9:21 am
/usr/lib64/nagios/plugins/check_nrpe -A /usr/local/nagios/certs/ca/anakin-ca.crt -C /usr/local/nagios/certs/nagios_server/nagios_server.crt -K /usr/local/nagios/certs/nagios_server/nagios_server.key -2 -P 8192 -H brandy -t 30 -c check_drivesize -a drive=F detail-syntax='{${name} ${drive}${free_pct}% free / ${size} total}' top-syntax='${status}: ${problem_list}'
WARNING: { F:17% free / 2TB total}|'F: used'=1.65251TB;1.5999;1.79988;0;1.99987 'F: used %'=83%;80;90;0;100
still not seeing the label?