Windows OS Version

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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Windows OS Version

Post by slansing »

Can you show an example of what you are trying to define, and what it is throwing out? Maybe we can weasel it in.

We're actively developing a process for checking eventlogs with NCPA which should provide a much cleaner and easier to understand method than this one.
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Re: Windows OS Version

Post by peakyblinder »

slansing wrote:Can you show an example of what you are trying to define, and what it is throwing out? Maybe we can weasel it in.

We're actively developing a process for checking eventlogs with NCPA which should provide a much cleaner and easier to understand method than this one.
I'm not seven sure how to go about defining it to be honest.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Windows OS Version

Post by eloyd »

Aren't you just trying to figure out what OS version is being run on the remote side? You said you had a VB script that does what you want. You can use NSClient++ to execute it if you want. Info is at http://nsclient.org/nscp/wiki/guides/na ... al_scripts. But I don't see why you can't just update to the latest version and get the check_os_version method?
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Re: Windows OS Version

Post by peakyblinder »

eloyd wrote:Aren't you just trying to figure out what OS version is being run on the remote side? You said you had a VB script that does what you want. You can use NSClient++ to execute it if you want. Info is at http://nsclient.org/nscp/wiki/guides/na ... al_scripts. But I don't see why you can't just update to the latest version and get the check_os_version method?
Yes, that's correct. I will look into the external scripts option.

I'd like to upgrade but currently don't have a mechanism for updating hundreds of clients. Something I negated to consider when starting this (my bad).
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Windows OS Version

Post by eloyd »

I'd like to upgrade but currently don't have a mechanism for updating hundreds of clients. Something I negated to consider when starting this (my bad).
Ahhhh. It wasn't clear that you already had NSClient++ in place. I thought you were going to install it, and couldn't figure out why you didn't just install the latest version. :-)

Okay, good luck.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Windows OS Version

Post by slansing »

Yep, external scripts is the place to go, that is how you would be remotely executing plugins/scripts via NSClient++, let us know if you have issues!
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Re: Windows OS Version

Post by peakyblinder »

slansing wrote:Yep, external scripts is the place to go, that is how you would be remotely executing plugins/scripts via NSClient++, let us know if you have issues!
OK, had a go at configuring this although I think I'm missing something.

VB script sits in teh scripts folder under NSClient.

Add a command to the external scripts section of nscliet.ini
- check_os_version=script.exe //T:30 //NoLogo scripts\OS_Version.vbs

Running the command line:
- ./check_nrpe -H ipaddress -p 5666 -c check_os_version

I get the following:
ExternalCommands: failed to create process (script.exe //T:30 //NoLogo scripts\OS_Version.vbs): 2: The system cannot find the file specified.

Any ideas?

---------------------------------------------
I should also mention that my vb scripts is pretty simple. Here it is...
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.Caption & _
" " & objOperatingSystem.Version
Next



Thanks,
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows OS Version

Post by lmiltchev »

Can you post the "NSC.ini" (or "nsclient.ini") file for a review? I just tried your script, and I got a different output... :)

Code: Select all

[root@testbox libexec]# ./check_nrpe -H 192.168.x.x -c check_os_version
CRITICAL: Windows 7 (6.1.7601)|'version'=61;50;50
It has to be a problem with the config.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Windows OS Version

Post by Box293 »

peakyblinder wrote:- check_os_version=script.exe //T:30 //NoLogo scripts\OS_Version.vbs
This should be cscript.exe

Code: Select all

check_os_version=cscript.exe //T:30 //NoLogo scripts\OS_Version.vbs
Make the change, restart NSClient and test.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Re: Windows OS Version

Post by peakyblinder »

Box293 wrote:
peakyblinder wrote:- check_os_version=script.exe //T:30 //NoLogo scripts\OS_Version.vbs
This should be cscript.exe

Code: Select all

check_os_version=cscript.exe //T:30 //NoLogo scripts\OS_Version.vbs
Make the change, restart NSClient and test.
Curse of the typo!!! My bad... this works a treat if you call cscript properly. Thank you very much!
Locked