Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

Performance counters are not collecting data

$
0
0

Hi,

I am a bit unsure how to explain my problem, so bear with me.

I Building synthetic user simulation for integration into a monitoring system (SCOM 2012). To do this I write small tests of a proprietary application that simulates certain actions. For these tests I use AutoIT - a scripting Tool that lets you automate Windows interaction. In AutoIT I then call a small program I wrote. This program has 3 parameters:

install: installs my performance counters

list: lists the counters

publish: take an additional 2 params, name of the counter, value to publish to the counter

This Works fine when I run it manually. I can see in perfmon that the data is correctly published.

Now, I need to run these simulations on a Schedule, so I changed the Task Scheduler service to allow interact with desktop and then I run the AutoIT scripts from a task Schedule. I see the programs are running fine with no problems - only a small exception... no data is published to the performance counters. Leave the machine on which I run these tests, logged on and not locked (some issues with automation block me from running this on a locked machine).

The Schedule is set to run with my account, so from that perspective Things *should* be fine.

The bomb for me right now is that, if I log on to the machine, start perfmon and the manually run the autoit scripts one time - the perfcounters get the published data ... AND the scheduled task correctly publishes data to the counters too. I'm confused :)

I Wonder if there is something around initialization or something else I'm missing in my code - which is super simple. I have these pieces of VB.NET:

Init a counter looks like this:

        Dim CounterDatas As New CounterCreationDataCollection()
        ' Create the counters and set their properties.
        Dim cdCounter1 As New CounterCreationData()
        cdCounter1.CounterName = "OpenApp_1_Open"
        cdCounter1.CounterHelp = "Help"
        cdCounter1.CounterType = PerformanceCounterType.NumberOfItems64
        CounterDatas.Add(cdCounter1)
        PerformanceCounterCategory.Create("ProArc", _
            "ProArc Category Help", PerformanceCounterCategoryType.SingleInstance, _
            CounterDatas)

Writing to a counter looks like this:

        Try
            Dim PC As New PerformanceCounter("ProArc", countername, False)
            PC.RawValue = datavalue
            PC.NextValue()
            Console.WriteLine(countername & " < " & datavalue)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>