Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port perfmon to branching doc format #17387

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/install/config/perfmon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
agentName: perfmon
agentType: integration
title: 'PerfMon monitoring integration'
metaDescription: 'Install the PerfMon integration'
introFilePath: 'src/install/perfmon/intro.mdx'
appInfo:
- optionType: dropdown1
label: ''
placeholder: 'Choose your install method'
options:
- value: 'installer'
displayName: 'Installer'
- value: 'manual'
displayName: 'Manual'


steps:
- filePath: 'src/install/perfmon/install-infra.mdx'
- filePath: 'src/install/perfmon/installer.mdx'
overrides:
- filePath: 'src/install/perfmon/installer.mdx'
selectedOptions:
- optionType: dropdown1
options:
- value: 'installer'
- filePath: 'src/install/perfmon/manual.mdx'
selectedOptions:
- optionType: dropdown1
options:
- value: 'manual'
- filePath: 'src/install/perfmon/find-data.mdx'
whatsNextFilePath: 'src/install/perfmon/whatsNext.mdx'
9 changes: 9 additions & 0 deletions src/install/perfmon/appInfo.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
componentType: appInfoConfig
headingText: Choose your framework
---





34 changes: 34 additions & 0 deletions src/install/perfmon/configure-integration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
componentType: default
headingText: Configure the integration
---

Upon installation, the integration should start reporting to your New Relic account with the default counters defined in `config.json`.

To further configure your integration, use any of the command-line arguments listed at the bottom of this doc. You'll need to edit `nri-perfmon-definition.yml` and add them as argument lines, like so:

```yaml
#
# 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
```

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.

More complex examples and options, such as remote polling and custom counters, are found at the bottom of this doc.
6 changes: 6 additions & 0 deletions src/install/perfmon/install-infra.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
componentType: default
headingText: Install the infrastructure agent
---

To use the PerfMon integration, you need to first [install the infrastructure agent](/docs/infrastructure/install-infrastructure-agent/get-started/install-infrastructure-agent-new-relic/) on the same host. The agent collects data from PerfMon and sends it to New Relic.
30 changes: 30 additions & 0 deletions src/install/perfmon/installer.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
componentType: default
headingText: Install the integration
---

To install the integration using the installer:

<Steps>
<Step>
[Download the latest release](https://github.com/newrelic/nri-perfmon/releases/latest) from the integration repo.
</Step>
<Step>
Unzip `nri-perfmon` to a temporary location on the host
</Step>
<Step>
Open Powershell in *8Run As Administrator** mode
</Step>
<Step>
In Powershell, change to the directory where you unzipped nri-perfmon:

```powershell
cd path/to/integration
```
</Step>
Run `install-windows.ps1`, which will place the files in their proper locations and restart the infrastructure agent.
</Step>
</Steps>



26 changes: 26 additions & 0 deletions src/install/perfmon/intro.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
headingText: Before we start
componentType: default
---

import infrastructureSnowflakeDashboard from 'images/infrastructure_screenshot-full_snowflake-dashboard.webp'

Our Snowflake integration lets you collect query performance data. You can also collect data on the health of your storage systems and warehouses. The integration then presents this data in a set of pre-built <InlinePopover type="dashboards" /> so you can view your most important query data in one place.

<figcaption>
After setting up the Snowflake integration with New Relic, see your data in dashboards like these, right out of the box.

</figcaption>
<Callout variant="tip">
This integration falls under the <DoNotTranslate>**Community project**</DoNotTranslate> designation in our [Open Source categories](https://opensource.newrelic.com/oss-category). The community provides input through issues and PRs to develop this code openly. There is an active maintainer team within New Relic, as well as troubleshooting support in the New Relic Explorers Hub and documentation available in the project repository.
</Callout>

<img
src={infrastructureSnowflakeDashboard}
title="Snowflake dashboard"
alt="A screenshot of a dashboard with Snowflake query metrics."
/>

## Requirements

* .NET Framework 3.5 and greater
35 changes: 35 additions & 0 deletions src/install/perfmon/manual.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
componentType: default
headingText: Install the integration manually
---

To install the integration manually:

<Steps>
<Step>
[Download the latest release](https://github.com/newrelic/nri-perfmon/releases/latest) from the integration repo.
</Step>
<Step>
Create `nri-perfmon` under `C:\Program Files\New Relic\newrelic-infra\custom-integrations`.
</Step>
<Step>
Place the following files in `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`
</Step>
<Step>
Place `nri-perfmon-definition.yml` in `C:\Program Files\New Relic\newrelic-infra\custom-integrations`. It should be in the same directory as, but not in, the `nri-perfmon` directory.
</Step>
<Step>
Place `nri-perfmon-config.yml` in `C:\Program Files\New Relic\newrelic-infra\integrations.d\`
</Step>
<Step>
Restart the infrastrucure agent
</Step>
</Steps>



190 changes: 190 additions & 0 deletions src/install/perfmon/whatsNext.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
---
componentType: default
headingText: What's next?
---

## Configuration options [#config-options]

The following are various configuration options for your integration.

### Command-line arguments

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](#verbose-logging-mode) (default: false)

<CollapserGroup>
<Collapser
id="verbose"
title="Verbose logging mode"
>

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:
* All log messages are written to stderr
* Metrics are pretty-printed to stderr
* No messages will appear in Event Logs
* No metrics are written to stdout
* **NRDB will not show any data from this Integration when running it in Verbose Logging Mode.**

Because stderr messages arent picked up by the NRI Agent in Windows, it is best to use this mode at command line, like so:
```batch
C:\Program Files\New Relic\newrelic-infra\custom-integrations> nri-perfmon\nri-perfmon.exe -v -c C:\path\to\custom_config.json
```

</Collapser>
</CollapserGroup>

## Counters

* Out-of-the-box, we have collected a set of Perfmon counters that pertain to .NET applications.
* We have a library of pre-built config files that you can use, **[found here.](nri-perfmon/config)** Contributions to this library by way of Pull Request are welcome!
* If you would like to collect your own counters, customize the `counterlist` in `config.json`, or create your own config file and use `-c your_config_file.json` at execution.

### `config.json` Format

```json
{
"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"
}
]
}
]
}
```

### Simple queries

_**For a walkthrough of creating a Simple Query, please see [TIPS.md](TIPS.md).**_

* The "`provider`, `category`, (optional) `instance`" form of the counter is for building simple queries, with the following limitations:
* Uses the default namespace (`root/cimv2`)
* Limited to Select statements against classes with the name `Win32_PerfFormattedData_{provider}_{category}`
* No custom names for individual attributes
* Uses the category name as the Insights event type.
* The `instance` property is optional and should *only* be used if you want to show a specific instance.
* If left out, all instances will be polled automatically.
* If there are multiple instances returned by the counter|query, each instance name will appear in the `name` attribute of the event.
* You must have at least one `counter` specified in `counters`. You can use wildcard ('\*') as the value to get all counters for that class.

Example of usage:
```json
{
"provider": "ASPNET",
"category": "ASPNETApplications",
"counters": [
{
"counter": "RequestsTotal"
}
]
}
```

### Performance counters

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.](https://techcommunity.microsoft.com/t5/Ask-The-Performance-Team/Windows-Performance-Monitor-Overview/ba-p/375481)

* No custom names for individual attributes
* Uses the category name as the Insights event type.
* The `instance` property is optional and should *only* be used if you want to show a specific instance.
* If left out, all instances will be polled automatically.
* If there are multiple instances returned by the counter|query, each instance name will appear in the `name` attribute of the event.
* You must have at least one `counter` specified in `counters`. You can use wildcard ('\*') as the value to get all counters for that class.

Example of usage:
```json
{
"provider": "PerfCounter",
"category": "ASP.NET Apps v4.0.30319",
"counters": [
{
"counter": "Requests Total"
}
]
}
```

### Complex queries & event listeners

* `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`)
* This listener will operate as a separate thread, so that it doesn't impede other queries from running.
* `querynamespace` (optional) - allows you to access any WMI namespace.
* If set, this query will operate as a separate thread, so that it doesn't impede other queries that use the default namespace.
* Any escape characters (`\`) 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.
* If not performing any transformations, you can specify counters in the query itself (i.e. "`Select Name, Description, DeviceID from Win32_PNPEntity`) and out this section.
* Multiple `counters` entries *can* be against the same counter (see example below).
* They will need to write to different attributes, otherwise they will overwrite one another.
* `counter` - the counter name you want to extract/match. Must be exact.
* `attrname` (optional) - use to rename the counter.
* If used, that counter name will be renamed in the Insights event to the value set here.
* If left out, the attribute in Insights will be named with the original name of that counter.
* `parser` (optional) - use a regular expression to parse an attribute value.
* It can only be used on Strings. It will be ignored for all other counter types.
* Any escape characters (`\`) must be doubled (`\\`)
* If used, the counter value will be matched against the regular expression provided here.
* If it doesn't match, the original value of the counter will be returned.
* If it matches and you used groups, the result will be a concatenized string of all of the groups.
* If it matches and you didn't use groups, the result will be the portion of the string that matched.

Example of usage:
```json
{
"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:
* To retrieve properties from within a counter object, use the format `counter.property`, i.e. `targetInstance.DeviceID`
* If there are multiple instances returned by the counter|query, each instance name will appear in the `name` attribute of the event.
Loading