Page 1 of 1

Using NSClient++ to obtain the Windows Version

Posted: Mon Oct 24, 2011 10:37 pm
by Box293
I've done this in the past with SNMP in my Dell OpenManage script. The result I get is as follows:

OK: <servername>, Microsoft Windows Server 2003 R2, Standard Edition, Version 5.2 (Build 3790 : Service Pack 2) (x86)

Question: Is there a built in check in check_nrpe or check_nt for NSClient that will report the same information above. I know I could write a simple .vbs script and deploy it to all my NSClient++ hosts, I just thought this would be one of those built in features of NSClient++

I've tried google and also Altavista ( :lol: ) but couldn't find much

Re: Using NSClient++ to obtain the Windows Version

Posted: Tue Oct 25, 2011 11:49 am
by nscott
Box,

I looked at the NSClient++ built in plugins and I don't think there is one that deal explicitly with your task. However, I'm not a WMI pro, but I bet you could use NSClient's CheckWMI built-in and use that to fetch the operating system value.

Re: Using NSClient++ to obtain the Windows Version

Posted: Wed Oct 26, 2011 12:30 am
by Box293
Thanks for that Nick, it seems this is what I am after. I can get a result using the following command:

Code: Select all

./check_nrpe -H <host> -p 5666 -c CheckWMI -a "Query=Select Version,Caption,CSDVersion,BuildNumber from win32_OperatingSystem" columnSyntax="%value%" columnSeparator=", "

3790, Service Pack 2, Microsoft(R) Windows(R) Server 2003, Standard Edition, 5.2.3790|'wmi query'=1
The problem I am having now is trying to re-order the output. I want to format it similarly to my example in my first post. It doesn't matter how I type the query in it always comes back the same i.e.
  • Query=Select Version,Caption,CSDVersion,BuildNumber
    or
    Query=Select Caption,CSDVersion,Version,BuildNumber
Any ideas?

Re: Using NSClient++ to obtain the Windows Version

Posted: Wed Oct 26, 2011 11:46 am
by nscott
Box,

Thats strange the plugin behaves that way. I think the only way around it is a rather ugly hack of the plugin results.

Code: Select all

./check_nrpe -H <host> -p 5666 -c CheckWMI -a "Query=Select Version,Caption,CSDVersion,BuildNumber from win32_OperatingSystem" columnSyntax="%value%" columnSeparator=", " | awk -F'[|,,]' '{print $3,",",$4,"Version",$5,"(Build",$1,":",$2,")|",$6}'
I'm not sure how the quotes will be handled, but a hack like this may or may not work for you. But otherwise I'm not sure how to restructure the output.

Re: Using NSClient++ to obtain the Windows Version

Posted: Wed Oct 26, 2011 6:22 pm
by Box293
Thanks for that, I'll have a play. I've also created a thread on the NSClient++ Forums so I'll see if I get a response there.

http://www.nsclient.org/nscp/discussion/topic/878#topic