Not a clue, actually. The references I’ve been reading are all about manually ending the partitions.
But I’ve got a few ideas.
I’m assuming that you are running a fairly simple monitoring program that looks at the UPS message queue to determine the UPS status. The “standard” procedure is to run in a timed loop and if after “X” time initiate the power down. ( “X” being determined by how long it takes to shut down and what your UPS capacity is.) So, at some point in this timed loop you are running the remote command to shut down partition #2. Assuming you issued a pwrdwnsys controlled with a lime limit for the partition, you can probably make a guess as to how long it takes to shut down that partition. And, at some point after that you shut down the primary. You could also have your secondary partition shutdown insure that all “user” programs have ended normally, then send an acknowledgement to the primary that it is about to shut down. You could also do something simple like PING the secondary partition – but that only really tells you that the TCPIP services are down, not the partition.
There is likely some API for it – commercial programs like R