Powershell Output via NCPA API missing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Powershell Output via NCPA API missing

Post by mbellerue »

What is the different way that the script query's the data? That could be the key here. Because this is what I'm seeing,
Note that if I run from the command line the following output is produced:
C:\DCOM\Nagios\ncpa_passive.exe C:\DCOM\Nagios\ C:\DCOM\Nagios\var\log\ displayEnv.ps1 displayEnv.ps1.seek C:\DCOM\Nagios\var\log\displayEnv.ps1.seek

But when executed through the NCPA API the following output is produced:
Using check_ncpa.py

var\log\ displayEnv.ps1 displayEnv.ps1.seek var\log\displayEnv.ps1.seek
You're right, we're basically missing %NCPA_HOME% (which is a great way to reference it, btw). The very first result when you run it from the command line is C:\DCOM\Nagios\ncpa_passive.exe. This is given to you by this bit of code,

Code: Select all

$NCPA_PATH = Get-Process -Name ncpa_passive | Select -expand Path
The entire rest of the script is derived from the $NCPA_PATH variable. For one reason or another, that Get-Process cmdlet just isn't returning data. If it were NCPA filtering the data for some reason, it would filter it for us as well, and it isn't. Something strange is happening at line 1 in the script, and $NCPA_PATH isn't getting set.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
onegative
Posts: 175
Joined: Tue Feb 17, 2015 12:06 pm

Re: Powershell Output via NCPA API missing

Post by onegative »

@mbellerue

You are correct...even though certain other PowerShell scripts are indeed operating as the svc_account something about the way Get-Process underlying permissions are prohibiting access to certain process objects. This is dang difficult to understand because there is no clear/easy way to determine what specific permission is missing due to the fact that the SYSTEM and Administrators rights supersede all permissions. I did see that certain processes can be queried successfully but others cannot. So that bites because trying to run the services as the svc_account to make things like check UNC Paths easy without credentials also creates permissions issues trying to ascertain other things I wanted to use PowerShell to extract.

I will go back to the drawing board and look for alternate methods...I was just trying to do it simple without much thought but then got sidetracked when it didn't work the way I expected it to.

Thanks for your help and you can lock this thread...

Danny
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Powershell Output via NCPA API missing

Post by scottwilkerson »

onegative wrote:@mbellerue

You are correct...even though certain other PowerShell scripts are indeed operating as the svc_account something about the way Get-Process underlying permissions are prohibiting access to certain process objects. This is dang difficult to understand because there is no clear/easy way to determine what specific permission is missing due to the fact that the SYSTEM and Administrators rights supersede all permissions. I did see that certain processes can be queried successfully but others cannot. So that bites because trying to run the services as the svc_account to make things like check UNC Paths easy without credentials also creates permissions issues trying to ascertain other things I wanted to use PowerShell to extract.

I will go back to the drawing board and look for alternate methods...I was just trying to do it simple without much thought but then got sidetracked when it didn't work the way I expected it to.

Thanks for your help and you can lock this thread...

Danny
Great!

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked