Page 1 of 1

Windows 2003 and NCPA-1.8.1.exe Plugin Issue

Posted: Thu Nov 29, 2018 8:49 am
by FrontlineIT
Hello,

We're transitioning from NSClient to NCPA. We've been using NCPA-2.1.6.exe for Windows 2008 and above servers which has gone smooth. Unfortunately, we have a few Windows 2003 servers and are utilizing NCPA-1.8.1.exe which we're able to get up and running with the basic services (cpu, memory, disk, etc). The problem we're facing with NCPA-1.8.1.exe is getting a custom plugin (C:\Program Files\Nagios\NCPA\plugins\check_log_file.ps1) working. We're using check command check_xi_ncpa and below is the argument that's being passed, the error message, and the powershell script code. Any idea what may be going wrong? Thanks ahead of time.

Argument:
-t 'mytoken' -P 5693 -M 'plugins/check_log_file.ps1' -a 'E:\web\production\cache\scripterrorlog.txt'

Error Message:
Unable to run check on non-child node. Revise your query.

Powershell Script:
param(
[Parameter(Mandatory=$true)][string]$logfile
)

$ok = 0
$warning = 1
$critical = 2
$content = "Out of memory"
$content1 = "Out of string space"
$content2 = "Not enough storage"
$logresult = get-childitem $logfile | select-string $content -quiet
$logresult1 = get-childitem $logfile | select-string $content1 -quiet
$logresult2 = get-childitem $logfile | select-string $content2 -quiet

if (($logresult) -or ($logresult1) -or ($logresult2)){
Clear-Content $logfile
Write-Host "Critical: Content match within the log file"
exit $critical
}
Else {
Write-Host "OK: No content matches"
exit $ok
}

Re: Windows 2003 and NCPA-1.8.1.exe Plugin Issue

Posted: Thu Nov 29, 2018 1:52 pm
by lmiltchev
On the machines with the older ncpa agent installed (1.8.1), you would need to change your command from this:

Code: Select all

-t 'mytoken' -P 5693 -M 'plugins/check_log_file.ps1' -a 'E:\web\production\cache\scripterrorlog.txt'
to this:

Code: Select all

-t 'mytoken' -P 5693 -M 'agent/plugin/check_log_file.ps1' -a 'E:\web\production\cache\scripterrorlog.txt'
Let us know if this helped.

Re: Windows 2003 and NCPA-1.8.1.exe Plugin Issue

Posted: Thu Nov 29, 2018 3:34 pm
by FrontlineIT
This change worked! Thank you

Re: Windows 2003 and NCPA-1.8.1.exe Plugin Issue

Posted: Thu Nov 29, 2018 4:16 pm
by lmiltchev
I am glad I could help! :)