-
Notifications
You must be signed in to change notification settings - Fork 121
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
Not possible to add user/pass as global to invoke PowerShell script with specific credentials #448
Comments
One solution could be to add native support for performance counters in YML. Something like this: integrations:
- name: nri-flex
interval: 120s
config:
name: getPerformanceCounter
global:
user: WindowsOrDomainUserWithAdminAccess
pass: password123
apis:
- event_type: getPerformanceCounter
performance_counters:
- \\ServerA\UDPv4\Datagrams No Port/sec
- \\ServerB\UDPv4\Datagrams Sent/sec Or something like this: integrations:
- name: nri-flex
interval: 120s
config:
name: getPerformanceCounter
global:
user: WindowsOrDomainUserWithAdminAccess
pass: password123
apis:
- event_type: getPerformanceCounter
performance_counters:
- name: Datagrams No Port/sec
counter: \\ServerA\UDPv4\Datagrams No Port/sec
- name: Datagrams Sent/sec
counter: \\ServerB\UDPv4\Datagrams Sent/sec The problem with my workaround is the execution time. Getting 20 counters from different machines takes 15-20 seconds. I assume this is a lot faster if not doing it via an external PowerShell file which also invokes a command as another user. |
There's no plan to include perfcounters in Flex. An alternative is the OTel collector receiver: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/windowsperfcountersreceiver that can be used to push metrics directly to the OTLP endpoint. |
@josemore OTel collector receiver is just a workaround for the Performance Counter example. |
Description
I have tried the below YML to execute a PowerShell script with a specific user and password:
I'm not 100% this is the correct syntax. I have tried putting the globals below "name: nri-flex" as well. Same result!
Error message in New Relic:
No errors in the newrelic-infra.log file. The integrations returns "Integration health check finished with success".
Expected Behavior
Should be possible to pass a username and password to a PowerShell script to invoke that script with the specified credentials.
Steps to Reproduce
\\COMPUTERNAME\PerformanceCounterPath
to the CounterPath attribut. Or just add the computer name as a parameter to the Get-Counter method, like:(Get-Counter -MaxSamples 1 -Counter $c.CounterPath -ComputerName COMPUTERNAME).CounterSamples
Example 1
Example 2
Workaround
I want to be able to get performance counters from different machines. This is because we're using a Windows Failover Cluster. So we don't work with unique server names. All performance counters should be targeted via the cluster node name.
Create a standard YML file for the integrations and call the PowerShell script. You can use the YML from the description (remove global).
Create the PowerShell script you're calling from the YML file. Since New Relic Infrastructure Agent is running as Local System we need to invoke a command with other credentials. This is why I want to be able to pass the username and password via the YML file so I don't need to invoke from the PowerShell script. See our example below:
Your Environment
Operating System: Windows Server 2019 OS Build 17763.4851
New Relic Infrastructure Agent: 1.47.2
Additional context
N/A
The text was updated successfully, but these errors were encountered: