I want to start a VM on ESXI with powercli script.
My nagios is installed on CestOs.
Also, i installed powershell and powercli on the CentOs.
my script to power on a vm from the centos is working good.
however, i seems that when i want to call it from nagios it doesnt work.
what do i do wrong?
the scrips:
Code: Select all
#!/usr/bin/pwsh -Command
connect-VIServer -Server *SOME IP* -User *SOME USER* -Password *SOME PASSWORD*
Start-VM -VM "SOME SERVER"
Code: Select all
define command {
command_name restart-server
command_line /usr/local/nagios/libexec/eventhandlers/test1.ps1
}
Code: Select all
define host {
contact_groups Regular
use windows-server ; Inherit default values from a template
host_name test ; The name we're giving to this host
alias test ; A longer name associated with the host
address *SOME IP* ; IP address of the host
event_handler restart-server
}