You can programmatically power off an Object Matrix cluster by using its Management API v.4.2.
You can automate this action by integrating the attached python script (PowerOffOM.py) into your workflow engine or monitoring system.


There are two main things to make sure are set up before you run the script - the user, and the config file:



Creating the user


Step 1 is to create a user with the correct access for the script to function.


Create a new user called APIUser, with sign-in disabled:


Go the Permissions tab of the user you just created and select Cluster from the drop down.


Click Grant Access and tick the box next to Node Shutdown




Go back to the user and to the Access Keys tab. Generate new access and secret keys and make a note of them:



Updating the config.ini file


Before the script is able to be run, you must also populate the config.ini file with the correct details for the user we just created.



The config file looks like this:

[DEFAULT]
# IP address of the node
IP =
# Port number
port = 8443
# Login credentials (needs cluster access to power down nodes)
logUser = APIUser
# API access keys (for above user)
accessKey = 
secretKey =



You will need to adjust the IP to match the IP of any node in the cluster.


Port 8443 is the OM default, only change this if you are aware of your cluster using a non-standard port setup


Enter the access and secret keys generated earlier.

Save the config file to the same location as the script will be running from.


Test the script



** Once you've completed the two steps above, it is advisable to test the script functions correctly in a controlled environment. **



It is up to the end user on how to trigger the script during normal operations; for example when a PDU loses power/ a UPS has low battery remaining