nickfloyd / newrelic-perfmon-plugin

The Perfmon Plugin for the New Relic Plugins - https://newrelic.com/plugins
MIT License
11 stars 22 forks source link

Custom PerfMon counters #7

Closed aalbertson closed 11 years ago

aalbertson commented 11 years ago

I'd like to see an option where we can select specific or custom perfmon counters. This could make it more flexible for other services and tools that integrate into perfmon directly.

For instance, Exchange pushes it's counters and metrics into performance counters. With your tool we could potentially gather all that data for numerous apps and services.

Of course I may be off base here, but figured it was worth a question.

sschwartzman commented 11 years ago

There is actually that ability built-in, but it will require you to fork the plugin. The reason being, if it reports with the same GUID as the standard one, you will get the standard dashboards, which are immutable (for all plugins). But if you change the GUID, you can make any changes to the counters list (see perfmon_counters.txt in the config directory) and then create dashboards for them.

I'm considering making the change-of-GUID process easier, in that it wouldn't require a rebuild of the EXE, but we may focus our efforts on porting this to native .NET code. I'll keep you posted.

Thanks for the suggestion, you're not off-base at all!

--Seth

sschwartzman commented 11 years ago

I've updated the code such that the GUID is now in the config file. I just have to do a little testing and rebuild the EXE, and you should be on your way! Stay tuned.

sschwartzman commented 11 years ago

Updated the standalone EXE to allow for custom counters. Please give it a try, re-open this ticket if there are any issues.

Thanks, Seth

aalbertson commented 11 years ago

Seth, thanks so much! I'll see about getting this deployed and tested out. You rock!

In particular what we were wanting to grab is specifically some of the .net thread contention metrics which you partially grabbed but wanted to select specific ones. This should help greatly! Cheers and I'll let you know how it goes.

coopr commented 11 years ago

@aalbertson when you fork this plugin, give it a new GUID, collect some new metrics, and whip up some dashboards to display those metrics in New Relic, I hope you'll consider publishing your plugin on Plugin Central so that others may share in your goodness.

Note that if you'd like any account other than yours to use your new plugin, you MUST publish it (un-published plugins cannot be shared).

Certainly let me know if you have any questions about what is involved with being a plugin publisher, not just a plugin author - thanks!

aalbertson commented 11 years ago

@coopr thanks for that! So what you're saying is that still even with the new changes, in order to report new metrics (or at least some additional standard ones) I would still need to fork it and roll that out to my systems?

Also, thanks for the help and offer for Q's.

coopr commented 11 years ago

Yes, at least almost certainly yes.

You could try forking the plugin, adding some metrics but leaving the GUID the same, and then run it - I believe what you'll see in New Relic's UI is... nothing - or at least nothing new. The new metrics you add will probably not appear on the charts in New Relic (though that depends on how you name your new metrics, and how the charts were configured by the original plugin author - it is tricky to ascertain in advance, so I suggest simply trying it).

Best case, you'll discover that the metrics you add appear automagically in New Relic - w00T! At that point, you'd be done, and there'd be no need to publish your "new" plugin (you actually couldn't, because it wouldn't be "new", because it uses the same old GUID).

Worst case, you'll discover that the metrics you add do NOT appear automatically in New Relic. At that point, you'd need to give the plugin a new GUID, then build the dashboards for that plugin "from scratch" (Sorry, there is currently no way to copy dashboards from one plugin to another).

aalbertson commented 11 years ago

Right, I believe with the updates that Seth applied, that we can now simply add a new metric to the perfmon_counters.txt file and they'll be automagically added.

For example, he has listed: .NET CLR LocksAndThreads()\

What I need is .NET CLR LocksAndThreads(w3wp)\Contention Rate / sec .NET CLR LocksAndThreads(w3wp)\Total # of Contentions Etc...

From what Seth indicated, I should now be able to add these individually and they should get auto populated. I'll be testing it out shortly.

sschwartzman commented 11 years ago

In fact, you don't need to fork the entire project to get the metrics to report in. What you will need to do though is change the GUID in the config file, as described in the README instructions. This will in effect make a new plugin, which will be a blank slate as far as dashboards and summary alerts are concerned.

On Thu, Sep 5, 2013 at 2:24 PM, aalbertson notifications@github.com wrote:

Right, I believe with the updates that Seth applied, that we can now simply add a new metric to the perfmon_counters.txt file and they'll be automagically added.

For example, he has listed: .NET CLR LocksAndThreads()

What I need is .NET CLR LocksAndThreads(w3wp)\Contention Rate / sec .NET CLR LocksAndThreads(w3wp)\Total # of Contentions Etc...

From what Seth indicated, I should now be able to add these individually and they should get auto populated. I'll be testing it out shortly.

— Reply to this email directly or view it on GitHubhttps://github.com/nickfloyd/newrelic-perfmon-plugin/issues/7#issuecomment-23902880 .

aalbertson commented 11 years ago

Hey lookee there, instructions and everything if one just reads...

Custom Perfmon Counters

BOTH steps are REQUIRED:

1. Uncomment "guid" and set to your own GUID

2. Uncomment "countersfile" and set to the

list of perfmon counters you wish to collect

#

guid: com.not52projects.myown.plugin.perfmon

countersfile: perfmon_totals_counters.txt

heh... Thank you sir! Will definitely be checking it out.

lawsonj2019 commented 11 years ago

Seth,

I've managed to get the standalone version working fine on a Windows box and this looks to be exactly what I need. However, when I try to implement the custom counters (with the latest version from git) I seem to be running into some problems.

I'm uncommenting both the GUID and countersfile properties and setting them to something sensible for my needs.

If I leave the perfmon_totals_counters.txt in the countersfile the standalone agent plugin works, but reports all the standard counters (even if I only specify one counter in the file).

If I change the filename to any other file I get the following error message when I start the plugin in standalone mode:

No Perfmon counters file named C:/Users/#username#/AppData/Local/Temp/18/ocrD0C8.tmp/src/config/counters.txt.

This is a Windows 2008R2 box.

I would like to report only the counters I specify in the file, but editing the perfmon_totals_counters.txt file seems to have no consequence, and trying my own file seems to result in the error.

Any ideas?

This is the contents of the newrlic_plugin.yml file:

newrelic:
  license_key: redacted
  verbose: 1
  proxy_host: proxyname:port
  guid: com.company.application.service
  countersfile: counters.txt
agents:
  perfmon:
      -
        local: yes
        hostname: hostname
        debug: false
        testrun: false

counters.txt

\Processor(_Total)\% Processor Time

output from typeperf for above counter

typeperf "\Processor(_Total)\% Processor Time"
"(PDH-CSV 4.0)","\\HOSTNAME\Processor(_Total)\% Processor Time"
"09/09/2013 16:29:08.396","0.000000"
"09/09/2013 16:29:09.410","0.000000"
"09/09/2013 16:29:10.424","0.768756"
"09/09/2013 16:29:11.438","0.000000"

The command completed successfully.
sschwartzman commented 11 years ago

Yeah, it's a bug in the Ruby code relating to OCRA, which is the package I use to turn it into an EXE. Working it out now, stay tuned. Thanks for the feedback to help me get this right!

--S

sschwartzman commented 11 years ago

Fixed it (I think) - had to determine the location of the EXE and use that. Give it another spin and let me know how it goes.

Thanks for bearing with!

lawsonj2019 commented 11 years ago

Thanks, Seth, this appears to have sorted the problem. All my metrics are reporting now into a custom dashboard. Great work!

J