NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
177 stars 95 forks source link

Windows NCPA v2.4.1->3.0.0 Upgrade Sometimes Has Performance Counter Issues #976

Open SNapier opened 11 months ago

SNapier commented 11 months ago

When installed and configured with passive checks enabled only 3 of the deployed passive checks function. CPU DISK HOST

This is due to a failure in the API for Memory/Swap referenced by the check. { "swap": { "total": "Error retrieving child: 'PdhAddEnglishCounterW failed. Performance counters may be disabled.'", "free": "Error retrieving child: 'PdhAddEnglishCounterW failed. Performance counters may be disabled.'", "percent": "Error retrieving child: 'PdhAddEnglishCounterW failed. Performance counters may be disabled.'", "used": "Error retrieving child: 'PdhAddEnglishCounterW failed. Performance counters may be disabled.'" } }

ne-bbahn commented 11 months ago

Hello SNapier,

I suspect your machine has performance counters disabled or not properly configured. I have tested this endpoint on several machines and it is working on all of them.

ne-bbahn commented 11 months ago

If I don't get another response in the next few days I'm going to presume that this was indeed an issue with the performance counter configuration and I will close this issue.

SNapier commented 11 months ago

What performance counter needs to be present? This is an upgrade from 2.4.1 on Win10 I will try on a fresh install

On Tue, Oct 3, 2023 at 11:11 AM bb @.***> wrote:

If I don't get another response in the next few days I'm going to presume that this was indeed an issue with the performance counter configuration and I will close this issue.

— Reply to this email directly, view it on GitHub https://github.com/NagiosEnterprises/ncpa/issues/976#issuecomment-1745298116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMCUBVQO2IWPW4PAW4G4M7DX5Q2JPAVCNFSM6AAAAAA46TYK6SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBVGI4TQMJRGY . You are receiving this because you authored the thread.Message ID: @.***>

SNapier commented 11 months ago

This is again on upgrade of 2.4.1 to 3-Beta What performance counter needs be present?

ne-bbahn commented 11 months ago

NCPA uses Python's psutil library to get memory information. Based on your error information, I'm pretty sure it has to do with the swap_memory() which goes down to psutil_swap_percent(). The performance counter used for this is \\Paging File(_Total)\\% Usage. In the performance monitor it should be listed as Paging File \ % Usage.

In all likelihood the problem is either that this counter doesn't exist or that performance counters are disabled.

SNapier commented 11 months ago

2.4.1 "Silent" uninstall artifacts maybe?

  1. Uninstall via the graphical interface for NCPA. This worked fine no issues, system was clean post execution.
  2. NCPA 2.4.1 silently uninstalled via command line. CICD or local execution

This did not cleanly remove the NCPA service from the system. I had to manually remove the entry for NCPA from the registry.