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

FILES

191       /etc/powerman/*.dev
192
193

ORIGIN

195       PowerMan  was  originally  developed  by Andrew Uselton on LLNL's Linux
196       clusters.  This software is open source and distributed under the terms
197       of the GNU GPL.
198
199

SEE ALSO

201       powerman(1),  powermand(8),  httppower(8), plmpower(8), vpcd(8), power‐
202       man.conf(5), powerman.dev(5), powerman-devices(7).
203
204       http://sourceforge.net/projects/powerman
205
206
207
208powerman-2.3.5                    2009-02-09                   powerman.dev(5)
Impressum