This integration is capable of...
NOTE: If you are installing this integration (not building it from scratch), Download The Latest Release HERE instead of cloning this repo!
install-windows.ps1
, which will place the files in their proper locations and restart the Infra Agent.nri-perfmon
under C:\Program Files\New Relic\newrelic-infra\custom-integrations
.C:\Program Files\New Relic\newrelic-infra\custom-integrations\nri-perfmon
:
nri-perfmon.exe
nri-perfmon.exe.config
config.json
Newtonsoft.Json.dll
FluentCommandLineParser.dll
nri-perfmon-definition.yml
in C:\Program Files\New Relic\newrelic-infra\custom-integrations
(ALONGSIDE but NOT IN the nri-perfmon
folder)nri-perfmon-config.yml
in C:\Program Files\New Relic\newrelic-infra\integrations.d\
Upon installation, nri-perfmon should start reporting to your New Relic account with the default counters defined in config.json
. The following configurations are to suit advanced usage patterns, i.e. remote polling and custom counters.
If run at command line without anything, the executable should report JSON results from WMI queries specified in config.json
to stdout, and any error messages to stderr. This is useful for testing and debugging your counter/query configuration.
-c | --configFile [file]
: Config file to use (default: config.json
)-i | --pollInt [nnn]
: Frequency of polling (ms) (default: 10000ms, ignored if less than 10000ms)-n | --compName [name]
: Name of computer that you want to poll (default: local host)-r | --runOnce [true|false]
: Run this integration once and exit, instead of polling (default: false)-g | --ignoreInfoLogs [true|false]
: Ignores logs of log type Info (default: false)-v | --verbose [true|false]
: Verbose Logging Mode (default: false)Verbose Logging Mode is meant for testing your Counters and seeing if and how they will appear in NRDB. With Verbose Logging Mode enabled, the following occurs:
Because stderr messages arent picked up by the NRI Agent in Windows, it is best to use this mode at command line, like so:
C:\Program Files\New Relic\newrelic-infra\custom-integrations> nri-perfmon\nri-perfmon.exe -v -c C:\path\to\custom_config.json
To use any of the Command-Line Arguments listed above, edit nri-perfmon-definition.yml
and add them as argument lines, like so:
#
# New Relic Infrastructure Perfmon Integration
#
name: com.newrelic.perfmon
description: Perfmon On-Host Integration
protocol_version: 1
os: windows
commands:
metrics:
command:
- .\nri-perfmon\nri-perfmon.exe
- -i
- 60000
- -c
- custom_config.json
- -n
- MyCompName
prefix: integration/nri-perfmon
interval: 15
Note:
The interval:
field at the bottom does need to be there with a number, but it does not change the polling interval. To do that, add -i
and <interval_(ms)>
as consecutive lines to your command
arguments.
counterlist
in config.json
, or create your own config file and use -c your_config_file.json
at execution.config.json
Format{
"counterlist": [{
"provider": "provider_name|PerfCounter",
"category": "category_name",
"instance": "(optional) instance_name",
"counters": [{
"counter": "*|counter_name"
},
{
"counter": "another_counter_name"
}
]
},
{
"eventname": "(optional, default: 'WMIQueryResult') insights_event_name",
"query": "the_whole_WMI_Query",
"querynamespace": "(optional, default: 'root//cimv2') query_namespace",
"querytype": "(optional, default: 'wmi_query') wmi_query|wmi_eventlistener",
"counters": [{
"counter": "counter_name|counter_class.counter_name",
"attrname": "(optional) attribute_name_in_insights_event",
"parser": "regex_to_parse_attribute_value"
},
{
"counter": "another_counter_name"
}
]
}
]
}
For a walkthrough of creating a Simple Query, please see TIPS.md.
provider
, category
, (optional) instance
" form of the counter is for building simple queries, with the following limitations:
root/cimv2
)Win32_PerfFormattedData_{provider}_{category}
instance
property is optional and should only be used if you want to show a specific instance.
name
attribute of the event.counter
specified in counters
. You can use wildcard ('*') as the value to get all counters for that class.Example of usage:
{
"provider": "ASPNET",
"category": "ASPNETApplications",
"counters": [
{
"counter": "RequestsTotal"
}
]
}
If you specify the provider
as PerfCounter
, it will retrieve the Windows Performance Counter instead of running a WMI query. This can be useful if WMI is returning "all 0's" in a query or the appropriate Performance Counter is easier to find Click here for a good how-to on using Performance Monitor.
instance
property is optional and should only be used if you want to show a specific instance.
name
attribute of the event.counter
specified in counters
. You can use wildcard ('*') as the value to get all counters for that class.Example of usage:
{
"provider": "PerfCounter",
"category": "ASP.NET Apps v4.0.30319",
"counters": [
{
"counter": "Requests Total"
}
]
}
eventname
(optional) - The event name you wish to create in Insights with the results of your query.query
- The WMI query to be run.querytype
(optional) - only used to run an event listener instead of a typical WMI Query (set to wmi_eventlistener
)
querynamespace
(optional) - allows you to access any WMI namespace.
\
) must be doubled (\\
)eventtype
(optional) - set that query's result events in Insights to anything specified here.counters
(optional) - used to specify counters to extract from the query, and transformations to perform on them.
Select Name, Description, DeviceID from Win32_PNPEntity
) and out this section.counters
entries can be against the same counter (see example below).
counter
- the counter name you want to extract/match. Must be exact.attrname
(optional) - use to rename the counter.
parser
(optional) - use a regular expression to parse an attribute value.
\
) must be doubled (\\
)Example of usage:
{
"eventname": "HyperV_GuestNetworkAdapter",
"query": "SELECT InstanceId, DHCPEnabled, DNSServers, IPAddresses FROM Msvm_GuestNetworkAdapterConfiguration",
"querynamespace": "ROOT\\virtualization\\v2",
"counters": [{
"counter": "InstanceId",
"attrname": "Name",
"parser": "Microsoft:GuestNetwork\\\\([0-9A-F-]+)\\\\[0-9A-F-]+"
},
{
"counter": "InstanceId",
"attrname": "AdapterId",
"parser": "Microsoft:GuestNetwork\\\\[0-9A-F-]+\\\\([0-9A-F-]+)"
},
{ "counter": "DHCPEnabled" },
{ "counter": "DNSServers" },
{
"counter": "IPAddresses",
"attrName": "IPAddress",
"parser": "([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})"
},
{ "counter": "IPAddresses" }
]
},
Notes:
counter.property
, i.e. targetInstance.DeviceID
name
attribute of the event.Build your project for the selected platform:
In Visual Studio, under the Build
menu, select Configuration Manager
.
Use Build > Build Solution
to build the project for x86/x64.
Create a zip file of the build output:
After building the project, open File Explorer and navigate to your project folder.
Go to the bin/Release
folder (actual directory may differ based on your .NET version).
You should see separate output folders for each target platform.
New Relic has open-sourced this project. This project is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to the project here on GitHub. We encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.
We encourage your contributions to improve nri-perfmon! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com.
A note about vulnerabilities
As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.
nri-perfmon is licensed under the Apache 2.0 License.