Page 1 of 2

NRPE Check for Windows Updates Help Needed

Posted: Tue Feb 21, 2017 11:06 pm
by kwhogster
:D Nagios 4.1 Core
Windows 10 Pro
NSclient 4.4.19

Trying to get this to work on my Windows 10 Pro found this here https://outsideit.net/monitoring-windows-updates/
Have it working on a Window 7 Pro and a Windows 2012 R2 server so far

I have other check_nrpe services defined for this computer that work fine.

The nsclient log is complaining about the allowed arguments. not sure where

TGKW001 WSUS Notifications for this service have been disabled UNKNOWN 02-21-2017 22:36:30 0d 0h 56m 17s 3/3 Arguments not allowed see nsclient.log for details


My nsclient log shows this

2017-02-21 21:49:02: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 21:51:02: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 21:53:02: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 21:56:29: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 22:06:29: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 22:16:29: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 22:26:30: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 22:36:30: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true



My command

Code: Select all

define command{
        command_name    check_ms_win_updates2
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -t 60 -c check_ms_win_updates -a '-wd 45 -cd 90 -M PSWindowsUpdate'
}
My service

Code: Select all

define service{
        use                     generic-service
        host_name               TGKW001
        service_description     WSUS
        check_command           check_ms_win_updates2
        servicegroups           Windows Updates
        }
I made this change in the nsclient.ini file

Code: Select all

; Section for external scripts configuration options (CheckExternalScripts).
[/settings/external scripts]

; COMMAND TIMEOUT - The maximum time in seconds that a command can execute. (if more then this execution will be aborted). NOTICE this only affects external commands not internal ones.
timeout = 60

; 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
allow arguments = 1
I now get this

TGKW001 WSUS Notifications for this service have been disabled UNKNOWN 02-21-2017 22:59:00 0d 1h 12m 50s 3/3 CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

The latest nsclient log entries after that change

2017-02-21 22:46:30: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 22:56:30: error:c:\source\nscp\modules\CheckExternalScripts\CheckExternalScripts.cpp:451: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true
2017-02-21 22:58:30: error:c:\source\nscp\include\socket/connection.hpp:149: Failed to send data: The file handle supplied is not valid
2017-02-21 23:00:00: error:c:\source\nscp\include\socket/connection.hpp:149: Failed to send data: The file handle supplied is not valid



Something not correct in my nsclient ini ??????

Thoughts?

Thanks

Tom

Re: NRPE Check for Windows Updates Help Needed

Posted: Tue Feb 21, 2017 11:10 pm
by rkennedy
Try testing the script alone through Powershell and see what the results are, as well as check the registry key file.

Willem writes great articles so I tend to trust what's been presented.

Re: NRPE Check for Windows Updates Help Needed

Posted: Tue Feb 21, 2017 11:26 pm
by kwhogster
Rkennedy

I did that before forgot to post those results here it is

PS C:\program files\nsclient++\scripts\powershell> .\check_ms_win_updates.ps1
UNKNOWN: Windows 10 or later detected. Please use PSWindowsUpdate method.

Checked the registry

Re: NRPE Check for Windows Updates Help Needed

Posted: Wed Feb 22, 2017 1:36 pm
by mcapra
Can you try running the script again with the arguments it suggested:

Code: Select all

PS C:\program files\nsclient++\scripts\powershell> .\check_ms_win_updates.ps1 -M PSWindowsUpdate

Re: NRPE Check for Windows Updates Help Needed

Posted: Wed Feb 22, 2017 8:58 pm
by kwhogster
OK that worked sort of

Results

PS C:\program files\nsclient++\scripts\powershell> .\check_ms_win_updates.ps1 -M PSWindowsUpdate
CRITICAL: Last successful update at 2016/01/13 18:26:22 exceeded critical threshold of 150 days. Pending updates {Total: 1}
PS C:\program files\nsclient++\scripts\powershell>

Problem is it took a very long and I mean a long time to run
I tried it again and after hitting enter sever times it started to Get update history for my Computer {2700/7758}

PS C:\program files\nsclient++\scripts\powershell> .\check_ms_win_updates.ps1 -M PSWindowsUpdate
CRITICAL: Last successful update at 2016/01/13 18:26:22 exceeded critical threshold of 150 days. Pending updates {Total: 0}

Again hitting enter it then finished.

Just applied the pending update going to restart now.

So if it sort of works form the powershell then whats up with my command?

Will try again after restart.

Thanks


After restart same results it takes a very long time to process

And it thinks the last update was 2016 1/13


PS C:\program files\nsclient++\scripts\powershell> .\check_ms_win_updates.ps1 -M PSWindowsUpdate
CRITICAL: Last successful update at 2016/01/13 18:26:22 exceeded critical threshold of 150 days. Pending updates {Total:

Thoughts

Re: NRPE Check for Windows Updates Help Needed

Posted: Thu Feb 23, 2017 3:28 pm
by mcapra
WMI based checks traditionally tend to run pretty slowly. Though I can't say why this particular plugin is returning inaccurate information. You'd probably have better lucky raising an issue on the github page for the plugin itself:
https://github.com/willemdh/check_ms_win_updates/

Re: NRPE Check for Windows Updates Help Needed

Posted: Fri Feb 24, 2017 8:03 pm
by kwhogster
I posted on that site but no response

see my link

https://github.com/PowerShell/xWindowsUpdate/issues/50

Hope someone has a Windows 10 machine doing this

Still stuck

Re: NRPE Check for Windows Updates Help Needed

Posted: Mon Feb 27, 2017 11:51 am
by mcapra
That's actually the official Powershell github. You'd probably have more luck contacting the maintainer of this plugin specifically:
https://github.com/willemdh/check_ms_win_updates/

Re: NRPE Check for Windows Updates Help Needed

Posted: Mon Feb 27, 2017 9:00 pm
by kwhogster
I posted on that site now

My guess no reply but I will give a few days

Also dont know why no one on here has this answer either

Re: NRPE Check for Windows Updates Help Needed

Posted: Tue Feb 28, 2017 12:52 am
by rkennedy
The author of the plugin knows best since they wrote it.