Comment

Hi Nouha,

So the principal idea of you is that; you read the status of the power input of the esxi server.

Is that right ?

with the line 

vim-cmd vmsvc/power.getstate $config | grep -i "on" > /dev/null 2<&1

STATUS=$ ?

so the first line asks to the power and waits and answer and this answer is captured  by STATUS =$ ? variable in the next line

is that right ?

so than you can start another script or some commands to turn of the vms and server itself.

I have no experience in this vmsvc but looks like worth to learn it.

In this scenario, no need to read the SNMP agent messages from UPS master agent.

Actually my second question would also be, how can we read the SNMP messages broadcastetd by UPS  ?

so than we can start some other scripts in case we catch those messages.

BR

Volkan