HTTP-only accessible PDU (Power Delivery Units)

Sep 07, 2021 15:51

In our lab we are using a lot of different DUTs and most of them are connected via PDUs for the remote power cycle. The biggest part of PDUs are APC 7820B or similar (from APC). APC is controllable via SNMP and everything is so far, so good.

Couple of years ago I have got Keil Systems EnviroBot PDU (not produced anymore) from e-waste, which is 12 ports and quite an interesting device in a sense that it's accessible via HTTP only.

After a few hours of experimenting (yeah, I'm not a ninja in HTML/XML + shell) I have nailed it down to make it accessible via our scripts that in their turn are for users logged via SSH.

So, to show the state of the certain port:

curl -s -L --noproxy '*' -o "" "http:///power.cgi?mdu=0" xmllint --xpath "//tr[td/input[@name=\"switch
\"]]/td[3]/text()" --html "" 2>/dev/null
Turning OFF...

curl -s -L --noproxy '*' -o /dev/null -d switch
="1" -d d12="1" -d B1="Submit" http:///out_control.cgi
...and turning ON:

curl -s -L --noproxy '*' -o /dev/null -d switch
="1" -d d12="0" -d B1="Submit" http:///out_control.cgi
Couple of weeks ago, due to some changes, we have ordered another PDU from IntelliNet, which appears a new device also accessible via HTTP-only.

For it it looks slightly different.

State:

curl -s -L --noproxy '*' -o "" -u "admin:admin" "http:///status.xml" xmllint --xpath "//outletStat
/text()" "" 2>/dev/null
OFF:

curl -s -L --noproxy '*' -o /dev/null -u admin:admin -X POST "http:///control_outlet.htm?op=1&outlet
=1&submit=Anwenden"
ON:

curl -s -L --noproxy '*' -o /dev/null -u admin:admin -X POST "http:///control_outlet.htm?op=0&outlet
=1&submit=Anwenden"
In all cases:
  • : IP or FQDN address of the PDU


  • : power switch port, usually from 0 to 7

  • : temporary file to cache the results, so one can get info for all ports on per port basis


  • This entry was originally posted at https://andy-shev.dreamwidth.org/152095.html. Please comment there using OpenID.

    hardware, opensource, howto

    Previous post Next post
    Up