Page 1 of 1

New NCPA Agents won't start - V 3.1.1

Posted: Mon Sep 23, 2024 1:37 pm
by JimKeating
Several of our Windows servers received an automatic upgrade of the NCPA client yesterday. The client was updated from Version 3.1.0 to version 3.1.1. The NCPA Agent on the servers that were upgraded to version 3.1.1 via ManageEngine Endpoint Central yesterday won't start. Has anyone else experienced the same issue? Thanks, JK


C:\Program Files\Nagios\NCPA>ncpa
Traceback (most recent call last):
File "__startup__.py", line 141, in run
File "console.py", line 25, in run
File "ncpa.py", line 73, in <module>
File "listener\server.py", line 12, in <module>
File "listener\psapi.py", line 9, in <module>
File "listener\nodes.py", line 11, in <module>
File "listener\database.py", line 7, in <module>
File "ncpa.py", line 85, in <module>
ImportError: Module use of python311.dll conflicts with this version of Python.

Re: New NCPA Agents won't start - V 3.1.1

Posted: Mon Sep 23, 2024 2:28 pm
by bbahn
Hello @JimKeating,

Can you let me know what version of Windows you are working with? I just tried an update (both the GUI and silent installs) with our build from https://www.nagios.org/ncpa/ and it upgraded and is working fine.

Does the ManageEngine Endpoint Central have logs that you could reference to see if something went wrong? Where did you source your NCPA 3.1.1 exe from?

Re: New NCPA Agents won't start - V 3.1.1

Posted: Mon Sep 23, 2024 3:40 pm
by JimKeating
Thanks for the reply, The Windows Server versions are Windows Server 2022 and Windows Server 2016. Some of the new upgraded agents are working OK. ManageEngine downloads the patches and upgrades from your website. We've been updating with ManageEngine for several years now and the patches, Nagios Agents, have always previously upgraded OK. I'm trying to do a manual uninstall and replace on one of the servers now. The removal is taking a long time. I'll let you know how it goes. If you have any other Ideas please let me know. We have about 15 upgraded servers that are not sending to Nagios at the moment. Thx

Re: New NCPA Agents won't start - V 3.1.1

Posted: Mon Sep 23, 2024 3:46 pm
by JimKeating
The manual reinstallation worked OK and all is good with the server now. It looks like I'll be writing a PowerShell script to remove and replace the program for all the problem servers. Please let me know if you can think of anything else. Thanks, JK

Re: New NCPA Agents won't start - V 3.1.1

Posted: Tue Sep 24, 2024 12:55 am
by JohnBoden11
I am also having the same issue.

The main issue I can see is the service does not want to start. Is you try and install over the top it won't let you uninstall it either as I believe it's getting stuck trying to uninstall the service.

A reboot seems to fix the issue and then I can run the installer but reboots of a production server and multiple ones are a major pain as this can only be done after hours and when have 100 servers....

Jim if you have a power shell script you would like to share? :-)

Re: New NCPA Agents won't start - V 3.1.1

Posted: Tue Sep 24, 2024 8:54 am
by bbahn
Do you see anything in your NCPA or Windows event logs? That might give some insight as to what is going wrong. It sounds to me like something is hanging, which would explain why it's taking a long time on those systems that are having issues and a restart is fixing them.

Re: New NCPA Agents won't start - V 3.1.1

Posted: Tue Sep 24, 2024 10:27 am
by JimKeating
Remote Removal: This script removed the failed program pretty quickly. I had about 15-20 servers where the agent was failing so I did not loop the script to do many servers in one run. I would have used Invoke-Command only but it would not work so I found an article that said to used New-PSSession for the Uninstall.exe. That did work!
https://stackoverflow.com/questions/556 ... oke-comman
Here's the script:


$ErrorActionPreference= 'SilentlyContinue'

$Server = Read-Host -Prompt 'Enter the Computer Name'

if (!(Test-Connection $Server -Count 1 -Quiet)){

Write-Host "$Server Offline"
Exit
}

$Cred = Get-Credential
$Session = New-PSSession -ComputerName $Server -Credential $Cred

Write-Output "Trying...Remove old NCPA Client from $Server"

Invoke-Command -Session $Session -ScriptBlock {Start-Process -FilePath "C:\Program Files\Nagios\NCPA\uninstall.exe" -ArgumentList "/S" -Wait}
$Session | Exit-PSSession

Re: New NCPA Agents won't start - V 3.1.1

Posted: Tue Sep 24, 2024 10:30 am
by JimKeating
JohnBoden11 wrote: Tue Sep 24, 2024 12:55 am I am also having the same issue.

The main issue I can see is the service does not want to start. Is you try and install over the top it won't let you uninstall it either as I believe it's getting stuck trying to uninstall the service.

A reboot seems to fix the issue and then I can run the installer but reboots of a production server and multiple ones are a major pain as this can only be done after hours and when have 100 servers....

Jim if you have a power shell script you would like to share? :-)
I've posted a couple of basic scripts. One to remove and one to install. Hope it helps.
BTW: Did not have to restart any of the servers doing it with the scripts! Yes! :-)
If I would have had more servers to do I would have probably combined them and looped the script to do all at once. JK

Re: New NCPA Agents won't start - V 3.1.1

Posted: Tue Sep 24, 2024 10:34 am
by JimKeating
Remote Installation: Here is the PowerShell installation script. Only set as a single install. Please run loop if you have many servers to do. Notice the NCPA service has to be stopped to replace the NCPA.cfg file after the installation. Had to set some Sleep timers:

$ErrorActionPreference= 'SilentlyContinue'

$Server = Read-Host -Prompt 'Enter the Computer Name'


if (!(Test-Connection $Server -Count 1 -Quiet)){

Write-Host "$Server Offline"
Exit
}

########## Copy new Files and Installation Program ##########

New-Item -ItemType directory -Path "\\$Server\c$\temp\isfiles\NCPA"

Copy-Item "\\dc\data\ITApps\NagiosXi - NCPA - 3.0\ncpa-3.1.1.exe" "\\$Server\c$\temp\isfiles\NCPA" -Recurse
Copy-Item "\\dc\data\ITApps\NagiosXi - NCPA - 3.0\ConfigFile\ncpa.cfg" "\\$Server\c$\temp\isfiles\NCPA" -Recurse

########## Install and start NCPA Agent ##########

Write-Host " Installing NCPA on $Server"

Invoke-Command -cn $Server -ScriptBlock {&cmd.exe /c "c:\temp\isfiles\NCPA\ncpa-3.1.1.exe /S"}

$Service = "Nagios Cross-Platform Agent"
$SVC = Get-Service $Service -ComputerName $Server
$SVC | Format-Wide

Start-Sleep -Seconds "5"

########## Stop Service and Copy Config File ##########

Get-Service -Name $Service -ComputerName $Server | Stop-Service -Force
$AgentStatus = Get-Service -Name $Service -ComputerName $Server
$AgentStatus

Start-Sleep -Seconds "7"

Invoke-Command -cn $Server -ScriptBlock {
Copy-Item "c:\temp\isfiles\NCPA\ncpa.cfg" -Destination "c:\program files\Nagios\NCPA\etc" -Force
}

Start-Sleep -Seconds "5"

Get-Service -Name $Service -ComputerName $Server | Start-Service
$AgentStatus = Get-Service -Name $Service -ComputerName $Server
$AgentStatus

Start-Sleep -Seconds "5"

########## Remove temporary files and folder on Server ##########

Write-Host "Removing Temporary files on $Server"
$RemovalPath = "\\$Server\c$\temp\isfiles\NCPA"
Get-ChildItem -Path $RemovalPath -Recurse | Remove-Item -Force -Recurse
Remove-Item $RemovalPath -Force -Recurse