mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
244 stars 94 forks source link

unable to get compound filter working with check_drivesize on windows #635

Closed cxc718 closed 4 years ago

cxc718 commented 5 years ago

Issue and Steps to Reproduce

I am using nsclient 0.5.2.039 running under windows 2k8,2k12, and 2k16. I am using check_drivesize. I'm trying to use the filter keyword to exclude non-fixed drives, system partitions, and volumes returned as a GUID. Seems I can exclude one, or the other but not both.

PLEASE PROVIDE COMMAND HERE

Running this against server with A (floppy), D,E(DVD drives), C,F, and L(fixed)  drives and a system partition with no volume name assigned.

check_nrpe  -H x.x.x.x -c check_drivesize -a  "perf-config=*(unit:G)'" "filter=type in ('fixed') and name not regexp '.*(System Reserved|SYSTEM RESE).*' and name not like '\\?\'" "warning=used>90%" "critical=used>95%" 
OUTPUT:
OK All 4 drive(s) are ok|'\\?\Volume{c81b41ff-e154-11df-b4b6-806e6f6e6963}\ used'=0G;0;0;0;0 'F:\ used'=377.25128G;377.99736;390.59727;0;419.99706 'F:\ used %'=90%;90;93;0;100 'L:\ used'=17.2678G;89.99736;92.99727;0;99.99706 'L:\ used %'=17%;90;93;0;100 'C:\ used'=51.27668G;53.90946;55.70645;0;59.89941 'C:\ used %'=86%;90;93;0;100

the actual values returned are correct. 

### Expected Behavior
returns data about only the fixed drives, C,F,L. 

### Actual Behavior
returns data about the fixed drives C,F,L, but also about the system partition /Volume GUID. 

### Details

* NSClient++ version: 0.5.2.39
* OS and Version: Windows Server 2008
* Checking from:  OP5.
* Checking with: check_nrpe

### Additional Details

NSClient++ log:

PLEASE PASTE LOG HERE this msg repeats in the nsclient.log:

2019-10-02 14:18:20: error:c:\source\master\include\socket/connection.hpp:273: Seems we other end is not using ssl: unknown protocol 2019-10-02 14:18:20: error:c:\source\master\include\socket/connection.hpp:274: Please review the ssl option as well as ssl options in settings. 2019-10-02 14:18:55: error:c:\source\master\include\socket/connection.hpp:273: Seems we other end is not using ssl: unknown protocol 2019-10-02 14:18:55: error:c:\source\master\include\socket/connection.hpp:274: Please review the ssl option as well as ssl options in settings. 2019-10-02 14:18:55: error:c:\source\master\include\socket/connection.hpp:273: Seems we other end is not using ssl: unknown protocol 2019-10-02 14:18:55: error:c:\source\master\include\socket/connection.hpp:274: Please review the ssl option as well as ssl options in settings. 2019-10-02 14:23:08: error:c:\source\master\include\socket/connection.hpp:273: Seems we other end is not using ssl: unknown protocol 2019-10-02 14:23:08: error:c:\source\master\include\socket/connection.hpp:274: Please review the ssl option as well as ssl options in settings.

cxc718 commented 5 years ago

after much trial and error, got it working by redoing the command as follows:

check_nrpe -H x.x.x.x -c check_drivesize -a "filter=type in ('fixed') and name not regexp '.(System Reserved|SYSTEM RESE).' and drive_or_id not like '?'" "warning=used>90%" "critical=used>95%"

OUTPUT: (expected and correct) Result code: 0 OK All 3 drive(s) are ok|'F:\ used'=377.33093GB;377.99736;398.99721;0;419.99706 'F:\ used %'=90%;90;95;0;100 'L:\ used'=17.26781GB;89.99736;94.99721;0;99.99706 'L:\ used %'=17%;90;95;0;100 'C:\ used'=51.45414GB;53.90946;56.90444;0;59.89941 'C:\ used %'=86%;90;95;0;100

I've seen the filter "name not like '\?\'" in several postings as the way to filter out \?\Volume disks, but that fails on every host I've tried it on, wondering if that is a bug that it does not work?