In addition to what
@tgriep requested, I've actually been looking at alternatives to WMIC since the output it provides isn't always useful and the documentation is limited. Though I suspect the FQDN vs IP is the key.
With the understanding that this is in the early testing stages and doesn't come with a particular guarantee, you might try leveraging the python script I have attached to execute WQL queries by hand and get the results. This is an option we're exploring beyond WMIC due to the availability of better debugging tools within Python. On a regular Nagios XI installation, you'll need to install the following dependencies:
Code: Select all
pip install impacket
pip install pyasn1
pip install pycrypto
Usage examples:
Code: Select all
[root@xi-rev tmp]# python send_wql.py -h
usage: send_wql.py [-h] -H HOST -u USERNAME -p PASSWORD -q QUERY
Executes WQL queries and gets object descriptions using Windows Management
Instrumentation.
optional arguments:
-h, --help show this help message and exit
-H HOST, --host HOST The host name or logical address of the remote Windows
machine.
-u USERNAME, --username USERNAME
The host name or logical address of the remote Windows
machine.
-p PASSWORD, --password PASSWORD
The host name or logical address of the remote Windows
machine.
-q QUERY, --query QUERY
The WQL query you wish to execute and get results for.
...
[root@xi-stable ~]# python send_wql.py -H 192.168.67.99 -u admin -p welcome123 -q 'select * from Win32_OperatingSystem'
{'MaxProcessMemorySize': 137438953344, 'WindowsDirectory': 'C:\\Windows', 'LastBootUpTime': '20170207132751.492051-360', 'SizeStoredInPagingFiles': 720896, 'MaxNumberOfProcesses': None, 'FreePhysicalMemory': 2201228, 'DataExecutionPrevention_Available': 'True', 'CSName': 'WIN-NFRUUIO4D46', 'MUILanguages': ['en-US'], 'SerialNumber': '00258-20571-39419-AA346', 'Distributed': 0, 'Primary': 'True', 'EncryptionLevel': 256, 'Debug': 0, 'SystemDrive': 'C:', 'Version': '6.3.9600', 'FreeSpaceInPagingFiles': 632944, 'NumberOfProcesses': 77, 'SystemDevice': '\\Device\\HarddiskVolume1', 'OSType': 18, 'CurrentTimeZone': -360, 'SystemDirectory': 'C:\\Windows\\system32', 'PlusProductID': 0, 'RegisteredUser': 'admin', 'Status': 'OK', 'ServicePackMajorVersion': 0, 'Description': 'My business server', 'CountryCode': '1', 'OSArchitecture': '64-bit', 'ForegroundApplicationBoost': 2, 'OperatingSystemSKU': 50, 'ServicePackMinorVersion': 0, 'SuiteMask': 305, 'OSProductSuite': 305, 'OSLanguage': 1033, 'DataExecutionPrevention_Drivers': 'True', 'TotalVirtualMemorySize': 4914608, 'NumberOfLicensedUsers': 0, 'DataExecutionPrevention_SupportPolicy': 3, 'TotalSwapSpaceSize': 0, 'Manufacturer': 'Microsoft Corporation', 'BuildType': 'Multiprocessor Free', 'CSDVersion': 0, 'FreeVirtualMemory': 2614940, 'Name': 'Microsoft Windows Server 2012 R2 Essentials|C:\\Windows|\\Device\\Harddisk0\\Partition1', 'InstallDate': '20160623112408.000000-300', 'NumberOfUsers': 8, 'Caption': 'Microsoft Windows Server 2012 R2 Essentials', 'TotalVisibleMemorySize': 4193712, 'LocalDateTime': '20170215113649.383000-360', 'OtherTypeDescription': 0, 'Organization': '', 'PortableOperatingSystem': 0, 'PAEEnabled': 0, 'PlusVersionNumber': 0, 'Locale': '0409', 'CSCreationClassName': 'Win32_ComputerSystem', 'BuildNumber': '9600', 'LargeSystemCache': 0, 'CodeSet': '1252', 'CreationClassName': 'Win32_OperatingSystem', 'DataExecutionPrevention_32BitApplications': 'True', 'BootDevice': '\\Device\\HarddiskVolume1', 'ProductType': 2}
...
[root@xi-rev ~]# python send_wql.py -H 192.168.67.99 -u admin -p welcome123 -q 'select PercentProcessorTime,Timestamp_Sys100NS from Win32_PerfRawData_PerfOS_Processor where Name="_Total";'
{'Timestamp_Sys100NS': 131316538434507891, 'PercentProcessorTime': 6172579140625}