Servers - General
1753536 Members
5775 Online
108795 Solutions
New Discussion

HP power protector does not run a script

 
SOLVED
Go to solution
John2
Occasional Contributor

HP power protector does not run a script

Hello everyone,

 

I'm currently trying to use a script on HP power protector for running some commands on my ESXi server in case of power failure from my ups and I need some help.

 

I made a script for a SSH connection to the server which looks like :

 

plink -v -I c:\...\****.ppk root@192.168.1.1 <command>

 (-v for the detail or the connection, -I for an authentication key, the .ppk)

 

If I launch the script on windows or I run the command on the console it work fine but when I use the "test shutdown" link on hppp nothing seems to work.

 

I tried to use an another bat for a test with these commands :

shutdown : OK

mkdir : OK

calc : KO

plink,putty : KO

 

Is there something that block my command ?

What can I do ?

 

--

 

best regards

John

 

 

 

EDIT :

vm with hppp : windows 7

server ESXi : hp proliant ml110

ups : hp T750 g2

4 REPLIES 4
John2
Occasional Contributor

Re: HP power protector doesn't run my batch file

Hello

 

I tried with a .js script based on the sample of hppp :

UserScript =
{
  name: "shutdownvm",
  enabled: true,     // Set this property to true to enable the script.
  onEvent: true,      // If true the script is called each time an event occurs.
  delay: 0,           // This property can be used to delay first execution of the action in milliseconds.
  interval: 10000,    // and every 10s from that
  onStart: function() // Startup function (optional)
  {
    // Use this place to insert initialization code
  },
  action: function()  // Script action definition
  {
	exec("plink -v -i c:\...\****.ppk root@192.168.1.1 /sbin/shutdown.sh && /sbin/poweroff");  
  	
  },
  onStop: function() // Ender function (optional)
  {
    // Use this place to insert finalization code
  }
}

KO, don't work

 

if i change the command :

exec("shutdown -s -t 30");                                            KO

exec("shutdown -m \\192.168.1.2 -t 30 -t 30);    KO

 

if you know something wich can help me don't be shy please :)

 

--

 

best regards

John

Lincy_Zachariah
Valued Contributor
Solution

Re: HP power protector doesn't run my batch file

Hi,

 

Please refer to the following document  - HP Power Protector Software - Shutdown Script Does Not Work

 

 

Thanks & regards,

 

Lincy

John2
Occasional Contributor

Re: HP power protector doesn't run my batch file

Hello,

 

woooo thank you very much !

It work now :)

 

just two details

first, the path specified 3 time at the end of the document is wrong for me :

/usr/local/HP/PowerProtector/bin/virt_tools/shtdownESXi.pl

-> /usr/local/HP/PowerProtector/bin/shutdownESXi.pl (no virt_tools and u to shutdownESXi.pl)


and second, there is a bug with perl when the shutdownESXi.pl run :

'https://<xx.xx.xx.xx>:443/sdk/vimService.wsdl'; at /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 545.

There is a simple way to correct it : just add at the top of the shutdownESXi.pl script :

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

 

[EDIT] third, ssh is not allowed on VMa after an installation we need to edit /etc/hosts.allow and add a ligne :

sshd: ALL: ALLOW

 


It work fine for me now :)

 

 

Best regards

John

opedro
Senior Member

Re: HP power protector doesn't run my batch file

Hi john, 

how do you do it.

i have same problem using the sample script.

on my case i realy need to use this sample script to shutdown ESX 6.0 with all vms, 3par and  storeonce.

i have 1 script based in powershell, to do the job but all the options that i try do execute failed.