Page 1 of 1

monitoring ps1 script on linux

Posted: Thu Nov 18, 2021 2:58 pm
by localit
is there a way to monitor or run a .ps1 script on a centos/linux server using ncpa client or another tool?

i have ps1 installed on my centos server and the script is working. i am trying to set this up as service in Nagios to monitor.

can anyone help me achieve this ?

Image

Re: monitoring ps1 script on linux

Posted: Thu Nov 18, 2021 3:15 pm
by jdunitz
At the end of your ncpa.cfg file, you probably have something like this:

Code: Select all

# Windows
.ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo
.wsf = cscript $plugin_name $plugin_args //NoLogo
.bat = cmd /c $plugin_name $plugin_args
change the .ps1 one to be like:

Code: Select all

.ps1 = pwsh -ExecutionPolicy Bypass -File $plugin_name $plugin_args
Restart ncpa (systemctl restart ncpa_listener) to make your change take effect and give it a try.

--Jeffrey

Re: monitoring ps1 script on linux

Posted: Thu Nov 18, 2021 3:54 pm
by localit
ty very much, that's exactly what i needed to know. Works perfect!

Re: monitoring ps1 script on linux

Posted: Thu Nov 18, 2021 4:12 pm
by benjaminsmith
ty very much, that's exactly what i needed to know. Works perfect!
Excellent! We'll go ahead close this out, but feel free to open another if you have any new questions.