Using NSClient++ to obtain the Windows Version

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Using NSClient++ to obtain the Windows Version

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Using NSClient++ to obtain the Windows Version

Post 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.
Nicholas Scott
Former Nagios employee
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Using NSClient++ to obtain the Windows Version

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Using NSClient++ to obtain the Windows Version

Post 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.
Nicholas Scott
Former Nagios employee
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Using NSClient++ to obtain the Windows Version

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked