1NODEATTR(1)                        NODEATTR                        NODEATTR(1)
2
3
4

NAME

6       nodeattr - query genders file
7

SYNOPSIS

9       nodeattr [-f genders] [-q | -c | -n | -s] [-X exclude_query] query
10       nodeattr [-f genders] [-q | -c | -n | -s] -A
11       nodeattr [-f genders] [-v] [node] attr[=val]
12       nodeattr [-f genders] -Q [node] query
13       nodeattr [-f genders] -V [-U] attr
14       nodeattr [-f genders] -l [node]
15       nodeattr [-f genders] -k
16       nodeattr [-f genders] -d genders
17       nodeattr [-f genders] --expand
18       nodeattr [-f genders] --compress
19       nodeattr [-f genders] --compress-hosts
20

DESCRIPTION

22       When  invoked  with  the -q , -c , -n , or -s arguments, nodeattr reads
23       the genders file and outputs a list of nodes that match  the  specified
24       query.  The nodes are listed in hostlist format, comma separated lists,
25       newline separated lists, or space separated lists respectively.  The -q
26       form  is  returned  by default.  Genders queries will query the genders
27       database for a set of nodes based on the union,  intersection,  differ‐
28       ence,  or  complement of genders attributes and values.  The set opera‐
29       tion union is represented by two pipe symbols ('||'),  intersection  by
30       two  ampersand  symbols ('&&'), difference by two minus symbols ('--'),
31       and complement by a tilde ('~').  Parentheses may be used to change the
32       order  of operations.  The -X argument and query can be used to exclude
33       nodes from the resulting output.  A query can be replaced with  the  -A
34       option  to  cause nodeattr to print all the nodes listed in the genders
35       database.
36
37       When called with a node name (optional) and  attribute  name,  nodeattr
38       returns 0 to the environment if the node has the attribute; else 1.  If
39       -v is present, the attribute name and any value (see below) is  printed
40       on  the  standard  output.   If a node name is not specified, the local
41       host is assumed.
42
43       When called with the -Q argument, nodeattr will check if the node  name
44       (optional)  is  met  by the attribute and value conditions specified in
45       the query.  If the conditions are met, nodeattr returns 0 to the  envi‐
46       ronment;  else  1.   The query format is identical to the format listed
47       above.  If a node name is not specified, the local host is assumed.
48
49       The -V option causes nodeattr to print all of the values that exist for
50       a  particular  attribute.  Also specifing -U with -V causes nodeattr to
51       print out only unique values for the particular attribute.
52
53       The -l option causes nodeattr to print all of  the  attributes  of  the
54       specified  node or list of nodes.  If no node is listed, all attributes
55       in the genders file are listed.
56
57       The -k option checks the genders file for parse errors and proper  for‐
58       matting.  If errors are found, information about the error will be out‐
59       put to standard error.
60
61       Nodeattr will always check the default genders file,  but  a  different
62       genders file can be specified with the -f option.
63
64       The  -d  option allows the specified genders database to be compared to
65       the filename indicated by the -f option or the  default  genders  data‐
66       base.  The differences contained in the specified database will be out‐
67       put to standard error.  Attribute names may optionally  appear  in  the
68       genders  file with an equal sign followed by a value.  Nodeattr ignores
69       these values except when the -v option requests that the value, if any,
70       be  displayed;  and  when an attribute is specified on the command line
71       with a value, in which case only an attribute with the specified  value
72       in the genders file will match.
73
74       For --expand --compress --compress-attrs --compress-hosts see HOSTRANGE
75       EXPANSION AND COMPRESSION below.
76

HOSTRANGE EXPANSION AND COMPRESSION

78       The --expand option will take  a  genders  database,  expand  all  hos‐
79       tranges,  and  output  a new genders database.  The subsequent database
80       will be identical to the first, but every node will be listed on a sep‐
81       arate line.  This option may be useful for debugging or determining the
82       difference between databases.
83
84       The --compress option is the opposite of the --expand option.  It  will
85       output  a  new identical genders database with hostranges of nodes with
86       identical attributes.  Depending on the setup of your genders database,
87       the  resulting  database  may be longer or shorter.  This option may be
88       useful as a beginning step to compressing an existing genders database.
89
90       The --compress-hosts option is similar to the --compress option.   With
91       --compress  a  given  attr  only appears once.  With --compress-hosts a
92       given node only appears  once.  The  --compress-hosts  option  combines
93       attributes  for  each  node  first and then groups nodes with identical
94       attribute sets rather than creating a group of nodes for each attribute
95       and  then  merging common groups.  This is useful for identifying "dif‐
96       ferent" nodes.  For example:
97
98       for the genders file:
99           cluster[1-20]       attr1,attr2
100           cluster10           attr3
101           cluster20           attr3
102           cluster[2,5,10]     attr4
103           cluster[7,20]       attr5
104
105       The nodeattr --compress command produces:
106           cluster[2,5,10] attr4
107           cluster[10,20]  attr3
108           cluster[7,20]   attr5
109           cluster[1-20]   attr1,attr2
110
111       Where nodeattr --compress-hosts produces:
112           cluster[1,3-4,6,8-9,11-19] attr1,attr2
113           cluster[2,5]               attr1,attr2,attr4
114           cluster10                  attr1,attr2,attr3,attr4
115           cluster20                  attr1,attr2,attr3,attr5
116           cluster7                   attr1,attr2,attr5
117
118       In the --compress output, cluster7 appears  in  the  third  and  fourth
119       lines because it is a member of ranges with attr1,attr2 and ranges with
120       attr5.  In the --compress-hosts output, cluster7 appears on a new  line
121       because  there  are  no  other  nodes  with  the  same  combination  of
122       attributes.
123
124       The --compress-attrs option is identical to --compress .  It was  added
125       for consistency when --compress-hosts was added.
126

EXAMPLES

128       Retrieve a comma separated list of all login nodes:
129
130              nodeattr -c login
131
132       Retrieve a hostlist formatted list of all login nodes:
133
134              nodeattr -q login
135
136       Retrieve a comma separated list of nodes with 4 cpus:
137
138              nodeattr -c cpus=4
139
140       Retrieve a comma separated list of all login and management nodes:
141
142              nodeattr -c "login||mgmt"
143
144       Retrieve a comma separated list of all login nodes with 4 cpus:
145
146              nodeattr -c "login&&cpus=4"
147
148       Retrieve a comma separated list of all nodes that are not login or man‐
149       agement nodes:
150
151              nodeattr -c "~(login||mgmt)"
152
153       To use nodeattr with pdsh to run a command on all fddi nodes:
154
155              pdsh -w`nodeattr -c fddi` command
156
157       To use nodeattr in a ksh script to collect a list  of  users  on  login
158       nodes:
159
160              for i in `nodeattr -n login`; do rsh $i who; done
161
162       To verify whether or not this node is a head node:
163
164              nodeattr head && echo yes
165
166       To verify whether or not this node is a head node and ntpserver:
167
168              nodeattr -Q "head&&ntpserver" && echo yes
169

FILES

171       /etc/genders
172

SEE ALSO

174       libgenders(3)
175
176
177
178LLNL                              August 2003                      NODEATTR(1)
Impressum