Closed jgrammen-agilitypr closed 5 years ago
That sounds more like a connection problem with the time of execution. Is that reproducible with every call that happens e.g. in a loop?
The check fails inconsistently within icinga. Here is the ouput for a number of sequential manual attempts. Interestingly the first one works.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
check_drivesize OK All 1 drive(s) are ok | 'c: used'=12.580624GB;39.569528;44.515719;0;49.461910 'c: used %'=25%;80;90;0;100
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
C:\Program Files\ICINGA2\sbin>check_nscp_api.exe --password somepass -P 8443 -H localhost -a drive=c -q check_drivesize
Caught exception: Error: Tried to read/write from a closed socket.
UNKNOWN: No data received.
Scrolling over the code I found us not closing the connection. Is it possible for the socket to stay open after the program terminates :thinking:
We're a little short on resources at the moment but we try to help you as soon as possible.
Will be solved as part of the network stack rewrite.
This is fixed in git master.
Expected Behavior
querying check_nscp_api.exe with -a drive=c should return results
Current Behavior
running a query with drive= almost anything causes a strange error.
Possible Solution
Steps to Reproduce (for bugs)
-a drive=*
works but-a drive=c
does notContext
cannot use nscp queries as per the documentation examples https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#nsclient-with-check_nscp_api
Your Environment
icinga2 --version
):Copyright (c) 2012-2018 Icinga Development Team (https://icinga.com/) License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl2.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
System information: Platform: Windows Platform version: 8 Kernel: Windows Kernel version: 6.2 Architecture: x86_64
Build information: Compiler: MSVC 19.0.24215.1 Build host: ICINGA-BUILD-WI
Application information:
General paths: Config directory: C:\ProgramData\icinga2\etc\icinga2 Data directory: C:\ProgramData\icinga2\var\lib\icinga2 Log directory: C:\ProgramData\icinga2\var\log\icinga2 Cache directory: C:\ProgramData\icinga2\var\cache\icinga2 Spool directory: C:\ProgramData\icinga2\var\spool\icinga2 Run directory: C:\ProgramData\icinga2\var\run\icinga2
Old paths (deprecated): Installation root: C:\Program Files\ICINGA2\ Sysconf directory: C:\ProgramData\icinga2\etc Run directory (base): C:\ProgramData\icinga2\var\run Local state directory: C:\ProgramData\icinga2\var
Internal paths: Package data directory: C:\Program Files\ICINGA2\share\icinga2 State path: C:\ProgramData\icinga2\var\lib\icinga2/icinga2.state Modified attributes path: C:\ProgramData\icinga2\var\lib\icinga2/modified-attributes.conf Objects path: C:\ProgramData\icinga2\var\cache\icinga2/icinga2.debug Vars path: C:\ProgramData\icinga2\var\cache\icinga2/icinga2.vars PID path: C:\ProgramData\icinga2\var\run\icinga2/icinga2.pid
C:\Program Files\ICINGA2\sbin>icinga2.exe feature list Disabled features: command compatlog elasticsearch gelf graphite ido-mysql ido-pgsql influxdb livestatus notification opentsdb perfdata statusdata Enabled features: api checker debuglog mainlog
C:\Program Files\ICINGA2\sbin>icinga2.exe daemon -C [2018-12-20 09:57:32 -0800] information/cli: Icinga application loader (version: v2.10.2) [2018-12-20 09:57:32 -0800] information/cli: Loading configuration file(s). [2018-12-20 09:57:32 -0800] information/ConfigItem: Committing config item(s). [2018-12-20 09:57:32 -0800] information/ApiListener: My API identity: DESKTOP-S8J0OKI [2018-12-20 09:57:34 -0800] information/ConfigItem: Instantiated 1 ApiListener. [2018-12-20 09:57:34 -0800] information/ConfigItem: Instantiated 1 IcingaApplication. [2018-12-20 09:57:34 -0800] information/ConfigItem: Instantiated 2 Endpoints. [2018-12-20 09:57:34 -0800] information/ConfigItem: Instantiated 4 Zones. [2018-12-20 09:57:34 -0800] information/ConfigItem: Instantiated 1 CheckerComponent. [2018-12-20 09:57:34 -0800] information/ConfigItem: Instantiated 2 FileLoggers. [2018-12-20 09:57:34 -0800] information/ConfigItem: Instantiated 215 CheckCommands. [2018-12-20 09:57:34 -0800] information/ScriptGlobal: Dumping variables to file 'C:\ProgramData\icinga2\var\cache\icinga2/icinga2.vars' [2018-12-20 09:57:34 -0800] information/cli: Finished validating the configuration file(s).
C:\Program Files\ICINGA2\sbin>icinga2.exe object list --type Endpoint Object 'icinga.vagrant' of type 'Endpoint': % declared in 'C:\ProgramData\icinga2\etc\icinga2/zones.conf', lines 6:1-6:32
Object 'DESKTOP-S8J0OKI' of type 'Endpoint': % declared in 'C:\ProgramData\icinga2\etc\icinga2/zones.conf', lines 15:1-15:33