Cmd line Ref | DigiPower | AMz-1623-SW-08-1 | 8 port Rack PDU, 16A 230V, IEC320 C20 Plug (7), C13 (1) | |
Cmd line Ref | Aviosys | IP Power 9258 SF | 8 port desktop,15A 230V, IEC320 C20 Plug (4), French (4) | |
As one of the networks I manage contained a mixture of these devices the challenge of automating control became very complex
because of the differenct interfaces. To make this simpler I created a script library (bash) that standardises the interface
so that the underlying complexity does not have to be dealt with. You can download this
library from here. This was designed to work under any environment that supports bash and the GNU tool set (Linux, BSD,
Cygwin etc).
Usage
The script supports two modes of operation, direct command line (params passed on command line of script) and calls to the embedded functions
/path/lib_msgcmdexec.sh test
Which should display details of your PDUs
Alternatively in script mode:
. /path/lib_msgcmdexec.sh
cmd_pduinfo
. /path/lib_msgcmdexec.sh
. /path/lib_msgcmdexec.sh test help
. /path/lib_msgcmdexec.sh test cmd_exec getpower P01
. /path/lib_msgcmdexec.sh test cmd_exec setpower P01=1 (or =on)
. /path/lib_msgcmdexec.sh test cmd_exec setpower P01=off (or =0)
Note on security: In the original environment this runs on a system which has no users and controlled access, anyone which can call this script is authorised to access the PDUs and would have the passwords. For less secure environments the script supports the concept of RO/RW access via the use of the "auth" command, which can either prefix other commands or be sent separately. This functionality is overridden by default in the header of the script; if you require this authentication then comment out the line that reads sIPPWR_AUTH_OK="RW". A second function is the ability to read in the entire parameter section, either from the environment of the calling script or from a config script. If you use this functionality it is suggested that you exec the dumpvars function to create the file then delete all the lines between the sections marked with "# SOT #" and "# EOT #". The config file may exist in the same directory as the script or in the calling users home directory.
Use at your own risk!.
. /path/lib_msgcmdexec.sh test cmd_exec auth password setpower P01=1