NRPE Check for Windows Updates Help Needed

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:

NRPE Check for Windows Updates Help Needed

Post 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
Attachments
nsclient.ini
nsclient ini
(21.66 KiB) Downloaded 375 times
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE Check for Windows Updates Help Needed

Post 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.
Former Nagios Employee
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Check for Windows Updates Help Needed

Post 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
Attachments
Registry entry
Registry entry
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: NRPE Check for Windows Updates Help Needed

Post 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
Former Nagios employee
https://www.mcapra.com/
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Check for Windows Updates Help Needed

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: NRPE Check for Windows Updates Help Needed

Post 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/
Former Nagios employee
https://www.mcapra.com/
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Check for Windows Updates Help Needed

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: NRPE Check for Windows Updates Help Needed

Post 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/
Former Nagios employee
https://www.mcapra.com/
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Check for Windows Updates Help Needed

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE Check for Windows Updates Help Needed

Post by rkennedy »

The author of the plugin knows best since they wrote it.
Former Nagios Employee
Locked