poxet / Influx-Capacitor

Influx-capacitor collects metrics from windows machines using Performance Counters. Data is sent to influxDB to be viewable by grafana.
http://influx-capacitor.com
MIT License
44 stars 13 forks source link

Performance counter not working #49

Closed fzavalloni closed 8 years ago

fzavalloni commented 8 years ago

Hi,

I am trying to set the Influx Capacitor to work with Exchange Server 2013 (Windows Server 2012 R2). However I got an issue with performance counter (MSExchange Database ==> Instances and Counter name = I/O Database Reads (Attached) Average Latency). When I start the service, it shows the errors below. 1- Engine MSExchange Database ==> Instances: Object reference not set to an instance of an object. 2- Unable to get performance counter MSExchange Database ==> Instances.I/O Database Reads (Attached) Average Latency.. Category does not exist.

I tried to use the escape characters ( >) but did not work.

All others performance counters worked well, only this one is not working.

Do you have any work around for this?

Tks

fzavalloni commented 8 years ago

I did the same test in another environment with Exchange Server 2010 and Windows Server 2008 R2 and the issue did not occurred.

fzavalloni commented 8 years ago

Hello, It´s me again. I think this error is something related to .NET or Operation System. I wrote a simple code that just list the categorys avaiable.

try
            {
                                PerformanceCounterCategory[] categories = PerformanceCounterCategory.GetCategories();
                List<string> msExchangeCategories = new List<string>();

                foreach (PerformanceCounterCategory obj in categories)
                {
                    if(obj.CategoryName.Contains("Instances"))
                    {
                        msExchangeCategories.Add(obj.CategoryName);

                    }

                }
                foreach (string obj in msExchangeCategories)
                {
                    Console.WriteLine(obj);
                }
            }
            catch (Exception err)
            {
                Console.WriteLine("Error: " + err.Message);
            }

```When I run this program in Windows Server 2008 R2 + Exchange Server 2010, it brings 2 categories.
1- Database ==> Instances
2- MSExchange Database ==> Instances
And running in Windows 2012 R2 + Exchange Server 2013, it brings only one category.
1- Database ==> Instances

Probably there is no workaround for it. If you have something, pls let me know.
poxet commented 8 years ago

It sounds like this is not easily fixed. Could it have something to do with 32 vs 64 bit versions?

fzavalloni commented 8 years ago

Hello,

I made it work. I got the same code I posted here before in Visual Studio and compiled it in .NET 3.5 and after that started working. I switched back to .NET 4.5 and compiled again and it worked again. My second test was doing the same steps but with your project Tharga.Influx-Capacitor.Service. I copied the new .exe file to a production server and those errors gone.

I have to admit that I do not know what cause this, but I found a workaround for this.

Have you ever seen it before?

poxet commented 8 years ago

I have not seen this before... So, now you are running a version of Influx-Capacitor that you compiled your self and it works? That soulds great in that case. The question that appears then is; if you where to run the version compiled by the build server and posted at http://influx-capacitor.com/

Do you think we can consider this bug fixed?

fzavalloni commented 8 years ago

Yes. Of course, probably it was a compilation issue of my side.

Tks