andy_shev: (Default)
[personal profile] andy_shev
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 "<FILE>" "http://<ADDRESS>/power.cgi?mdu=0"
xmllint --xpath "//tr[td/input[@name=\"switch<PORT>\"]]/td[3]/text()" --html "<FILE>" 2>/dev/null

Turning OFF...
curl -s -L --noproxy '*' -o /dev/null -d switch<PORT>="1" -d d12="1" -d B1="Submit" http://<ADDRESS>/out_control.cgi

...and turning ON:
curl -s -L --noproxy '*' -o /dev/null -d switch<PORT>="1" -d d12="0" -d B1="Submit" http://<ADDRESS>/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 "<FILE>" -u "admin:admin" "http://<ADDRESS>/status.xml"
xmllint --xpath "//outletStat<PORT>/text()" "<FILE>" 2>/dev/null

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

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

In all cases:
  • <ADDRESS>: IP or FQDN address of the PDU

  • <PORT>: power switch port, usually from 0 to 7

  • <FILE>: temporary file to cache the results, so one can get info for all ports on per port basis
  • This account has disabled anonymous posting.
    If you don't have an account you can create one now.
    HTML doesn't work in the subject.
    More info about formatting

    If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

    Profile

    andy_shev: (Default)
    Andy Shevchenko

    March 2025

    S M T W T F S
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     

    Most Popular Tags

    Style Credit

    Expand Cut Tags

    No cut tags
    Page generated Jun. 24th, 2025 05:27 am
    Powered by Dreamwidth Studios