Setup Event_handler with OpenSSH & PowerShell

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Setup Event_handler with OpenSSH & PowerShell

Post by kwhogster »

Nagios Core 4.3.4
Ubuntu 18.04
Windows 2012R2, 2016, 2019
PowerShell 7.0
OpenSSH
I can now run Powershell commands on my Ubuntu Server which I use for Nagios Core.

I would like to setup and Event Handler to run a script on the Ubuntu Server that will start a service on the windows server
Example of powershell command

invoke-command -hostname server01 -scriptblock {start-service nscp}

I know I need to define a service which I already have but I need to add the the event_handler to the service.
Also need to define a command for the event_handler

I am working and that command now so that I can run a powershell command from the Linux script.

My question now is which account is used by Nagios to run commands?

Using OpenSSH and Powershell 7.0 I need to create a SSH Key and copy it to the Windows server so that I can run the invoke-command without credentials.

Currently on my Ubuntu I logon as Thomas then I su - to root to perform Nagios config changes.

Any ideas.
Locked