# Error in WMI input plugin

**URL:** <https://discuss.elastic.co/t/error-in-wmi-input-plugin/45779>\
**Category:** Logstash\
**Created:** [March 30, 2016, 11:00am UTC](https://discuss.elastic.co/t/error-in-wmi-input-plugin/45779 "2016-03-30T11:00:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suren92](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@Suren92](https://discuss.elastic.co/u/Suren92)\
**Post date:** [March 30, 2016, 11:00am UTC](https://discuss.elastic.co/t/error-in-wmi-input-plugin/45779/1 "2016-03-30T11:00:14Z")

</div>

Hi,

I am trying to collect the performance counters on the windows system using the below configuration. But I am getting the following error. Please suggest me any solution to overcome the error.

**The error reported is:**  
undefined method `value' for nil:NilClass

Here is my config file.

input {  
wmi {  
query =\> "select \* from Win32\_PerfFormattedData\_PerfOS\_Processor"  
}  
}  
output  
{  
stdout  
{  
codec =\> rubydebug  
}  
}  
Please suggest me if there is any other way through which I can collect the performance counters of the system.

Thanks,

---

<div class="post-metadata">

**Author:** ![Jagadish\_Manepalli](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@Jagadish\_Manepalli](https://discuss.elastic.co/u/Jagadish_Manepalli)\
**Post date:** [July 15, 2016, 8:14am UTC](https://discuss.elastic.co/t/error-in-wmi-input-plugin/45779/2 "2016-07-15T08:14:40Z")

</div>

Hi,

I also face the same issue and after debugging I figured out the root cause 🙂

In the file logstash-2.3.2\vendor\bundle\jruby\1.9\gems\logstash-input-wmi-2.0.5-java\lib\logstash\inputs\wmi.rb

line# 49 has statement @host = Socket.gethostname and the result is not either of 127.0.0.1 or localhost so the if condition is going to else and looking for password value

Fix:

modify the if condition to include the hostname of your mahcine, see below example:  
if (@host == "127.0.0.1" || @host == "localhost" || @host == "::1" || @host=="mymachinename")

Thanks,  
Jagadish

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:47am UTC](https://discuss.elastic.co/t/error-in-wmi-input-plugin/45779/3 "2017-07-06T04:47:52Z")

</div>

Closed on July 6, 2017, 4:47am UTC


