1POWERMAN.DEV(1)                  POWERMAN.DEV                  POWERMAN.DEV(1)
2
3
4

NAME

6       powerman.dev - PowerMan device specification files
7
8

DESCRIPTION

10       PowerMan  device  specifications are rather wierd.  For this reason, we
11       suggest that you leave the writing of these  scripts  to  the  PowerMan
12       authors.  However, if you insist, here is how they work.
13
14       Note: the authors do not guarantee that the PowerMan specification lan‐
15       guage will not change, however we are open to taking on maintenance  of
16       scripts  submitted by PowerMan users.  We can't guarantee that we'll be
17       able to test new releases against all devices but we'll do our best not
18       to break anything.
19
20       By  convention, device scripts are one device per file and are included
21       as needed from a powerman.conf file, like this:
22
23              include "/etc/powerman/icebox3.dev"
24
25       A device script is surrounded by an outer block:
26
27              specification "my_device_name" {
28                  # configuration settings
29                  # script blocks
30              }
31
32       The possible configuration settings are:
33
34       timeout <float>
35              (optional) device script timeout in seconds -  applies  to  each
36              script, the whole thing, not just a particular "expect".
37
38       plug name { <string list> }
39              (optional)  if  plug  names  are static, they should be defined.
40              Any reference to a plug name in the powerman.conf must match one
41              of the defined plug names.
42
43       pingperiod <float>
44              (optional)  if  a  ping  script  is  defined,  and pingperiod is
45              nonzero, the ping script will be  executed  periodically,  every
46              <float> seconds.
47
48       Script blocks have the form:
49
50              script <script_name> {
51                  # statements
52              }
53
54       Script  blocks  should  all be grouped together with no config lines in
55       between.  Scripts are for  performing  particular  operations  such  as
56       power  on,  get power status, etc.  The various script names are listed
57       below.  Those marked with [%s] are called with a plug name  "argument",
58       which  can  be  included in a send statements by including a %s (printf
59       style).  Warning: all the send strings are processed  with  printf  and
60       you  can  cause  powermand to segfault if you include any printf tokens
61       other than the appropriate zero or one %s.
62
63       login  Executed immediately on (re-)connect.  If you need to  login  to
64              the  box,  do  it  here.   This  is also a good place to descend
65              through a first layer of menus.  Caveat: %  occurring  in  pass‐
66              words  must  be escaped as %%.  Caveat: occurs outside of client
67              session so cannot be debugged with -T.  A trick  when  debugging
68              is  to  move this code into the status script temporarily so you
69              can see what is going on.
70
71       logout Executed prior to disconnect.  Get device in a  state  so  login
72              script  will  work  (though hopefully disconnecting will do that
73              too).
74
75       status_all, status[%s]
76              Obtain plug state for all plugs  or  only  the  specified  plug.
77              When  all plugs of a device are involved in a plug status query,
78              the status_all script, if defined, will be called in  preference
79              to  the status script; otherwise the status script is called for
80              each plug.
81
82       on_all, on[%s]
83              Power on all plugs or the specified plug.
84
85       off_all, off[%s]
86              Power off all plugs or the specified plug.
87
88       cycle_all, cycle[%s]
89              Power cycle all plugs or the specified plug.  The intent of this
90              command  was  to map to the RPC's cycle command; however, device
91              script are increasingly implementing this in terms  of  a  power
92              off/delay/power so the off time can be controlled by the script.
93
94       status_soft_all, status_soft[%s]
95              Obtain  soft  power  state  for  all plugs or only the specified
96              plug.  Soft Power refers to the "standby state" of the node.  On
97              means the node is powered up.  Off means either the node is pow‐
98              ered off at the plug or is powered on at the plug and in standby
99              mode.  This is really only useful on devices that include both a
100              plug relay and a probe into the node attached to  a  non-standby
101              power source.
102
103       status_temp_all, status_temp[%s]
104              Obtain  temperature  reading for all plugs or only the specified
105              plug.  Temperature is obtained by sampling a thermocouple in the
106              node.   Results  are reported as a text string - not interpreted
107              by Powerman beyond any regex chopping done by the script.
108
109       status_beacon_all, status_beacon[%s]
110              Obtain beacon state for all plugs or only  the  specified  plug.
111              Some RPC's include a way to flash a light on a node.
112
113       beacon_on[%s]
114              Flash beacon on the specified plug.
115
116       beacon_off[%s]
117              Clear beacon on the specified plug.
118
119       reset_all, reset[%s]
120              Reset  all  plugs  or  only the specified plug.  Reset refers to
121              signaling a motherboard reset butten header, not a plug cycle.
122
123       Within a script, the following statements can be used:
124
125       send <string>
126              Send <string> to the device.
127
128       delay <float>
129              Pause script for <float> seconds.
130
131       expect <string>
132              <string> is compiled as a regular  expression  with  regcomp(3).
133              The  regular  expression  is  matched against device input.  The
134              script blocks until the regex is matched or the  device  timeout
135              occurs  (in  which  case the script is aborted).  Upon matching,
136              any parenthesized expressiones are assigned to variables: $1 for
137              the  first  match, $2 for the second match, and so on.  Warning:
138              some implementations of regex(3) silently fail  if  the  regular
139              expression exceeds available static storage.
140
141       setplugstate     [<string>|<regmatch>]     <regmatch>    [off=<string>]
142       [on=<string>]
143              Set the plug state.  The first argument, if present, is the lit‐
144              eral  plug  name  or a <regmatch> from the previous expect which
145              contains the plug name.  If omitted, the plug name  is  presumed
146              to  be the script argument.  The off and on strings are compiled
147              regexes, which if matched by the second argument, result in  the
148              plug  state being set to off or on.  Yes we are applying regexes
149              to regmatches!  If no off or on strings are provided, state will
150              be unknown.
151
152       ifoff, ifon
153              Script  statements  enclosed  in  an ifon/ifoff block are condi‐
154              tional executed based on the state of the plug passed in  as  an
155              argument.   Ifon/ifoff  blocks  can  only be used in single plug
156              scripts that take an argument.
157
158       foreachplug
159              Script statements enclosed in a foreachplug block  are  executed
160              iteratively  with  a  %s  argument defined for each target plug.
161              Foreachplug blocks can only be used in  all  plug  scripts  that
162              take no argument.
163
164       Script terminals are  defined as follows:
165
166       <float>
167              decimal number - exponent forms not supported
168
169       <string>
170              Text  surrounded  by  double  quotes.  May contain C style back‐
171              slash-escaped characters, including three  digit  octal  values,
172              and most common backslash-escaped single character values.
173
174       <string list>
175              Multiple <string> values seperated by white space.
176
177       <script_name>
178              Name of script (see above).
179
180       <regmatch>
181              Results of a parenthesized regular expression match are assigned
182              to $1, $2, ... $N.
183
184

FILES

186       /etc/powerman/*.dev
187

ORIGIN

189       Developed by Andrew  Uselton <useton2@llnl.gov> on LLNL's  Linux  clus‐
190       ters.   This software is open source and distributed under the terms of
191       the Gnu GPL.
192

SEE ALSO

194       powerman(1), powerman.conf(5), powermand(1), powerman-devices(7)
195
196
197
198LLNL                              Release 1.0                  POWERMAN.DEV(1)
Impressum