Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
ManualTools
Mjolnir-RaritanRPCtest.py
README
mjolnir.py
mjolnir.py.save
primer-mjolnir.py
test.sqlite
varsmjolnir.py

README

"Mjolnir" Power Cycle Automation Tool
(c) 2018 Ian Hill (Rego)

	This code is published under the MIT License
	You can find the MIT license in the source code
	This code is provided without any warranty of any kind.

Prerequisites:

python
urllib3
requets
slackclient
sqlite3
Raritan rpc sdk (found at https://www.raritan.com/support/product/px3) under SDK

PDUs must be networked on ethernet
It is suggested that your PDU infrastructure be on a seperate subnet from production (best practice)
Updated firmware on all of your px2/px3 units (current version as of writing is 3.4.0)

Mjolnir is intended to present an option for smart PDU automated troubleshooting for
cryptocurrency mining applications but can be applied to other hardware where performance
can be derived by current and systems can recover gracefully from power cycling.

Mjolnir cycles through each outlet at a number of user defined PDUS and records amperage
per outlet. If the outlet is drawing current, but below an acceptable threshold, Mjolnir
power cycles the outlet. Mjolnir records the state of outlets on each read. After a specifed
number of cycle attempts within a defined timeframe, Mjolnir cycles the outlet to the off state
and sends a notice of this action to a defined Slack channel by way of a Slack API bot.

The script sends an up-verification perodically upon completing one facility revolution (loop)
via Slack.

The script sends a startup ping as well.

It is intended to be deployed on a self contianed service and has been tested in the field
using a single Raspberry Pi 3 B running Raspian.


Instructions:
	* Meet prereqs.
	* Copy the files from this directory to your pdu_json_rpc_sdx_XXXXXXX directory
	* Alter the mjolnir code to reflect the absolute directory path to your pdu-python-api
	  (ex "/home/pi/pdu-rpc-VERSION/pdu-python-api")
	* Alter the vars file to include your slackbot api token, your user creds, and your site name, change your timeframe as desired
	* Copy the test.sqlite file and use a sqlitebrowser of some kind to alter the file and add your PDUS.
	 Rename it consistent for your site and move it to your operating directory.
	//* Alternatively, use the primer script to enter your pdus via barcode scan or manual input and map your infrastructure/build db
	* Reserve/static IPs your PDU addresses
	* Add this to your startup crontab or, on a pi, to your lxsession autostart file.
	* Reboot 
	//* Alternatively, run it manually and leave a monitor to watch it work
	* Let it work
You can’t perform that action at this time.