NODEATTR(1)

πŸ’– NODEATTR(1) πŸ’–

okay bestie, pull up a chair, because nodeattr is literally the girl who knows everybody 🫢 she reads the genders file and tells you exactly which nodes are in the group chat. this is the nodeattr manual page, section 1, and we're gonna go through the whole thing together, no skipping, no cap ✨


🌸 NAME 🌸

nodeattr β€” query genders file

like. that's the whole job. she queries the genders file. iconic behavior honestly πŸ‘‘


✨ SYNOPSIS ✨

nodeattr [-f genders] [-q | -c | -n | -s] [-X exclude_query] query
nodeattr [-f genders] [-q | -c | -n | -s] -A
nodeattr [-f genders] [-v] [node] attr[=val]
nodeattr [-f genders] -Q [node] query
nodeattr [-f genders] -V [-U] attr
nodeattr [-f genders] -l [node]
nodeattr [-f genders] -k
nodeattr [-f genders] -d genders
nodeattr [-f genders] --expand
nodeattr [-f genders] --compress
nodeattr [-f genders] --compress-hosts

nine whole moods, bestie. she contains multitudes πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so when you call her with -q, -c, -n, or -s, nodeattr reads the genders file and outputs a list of nodes that match the query you gave her. and the format of that list depends on which one you picked:

  • -q β†’ hostlist format
  • -c β†’ comma separated lists
  • -n β†’ newline separated lists
  • -s β†’ space separated lists

and the -q form is what you get by default, so if you're not picky she's already got you πŸ’–

genders queries will query the genders database for a set of nodes based on the union, intersection, difference, or complement of genders attributes and values. the set operations are giving math class but make it cute:

  • union β†’ two pipe symbols: '||'
  • intersection β†’ two ampersand symbols: '&&'
  • difference β†’ two minus symbols: '--'
  • complement β†’ a tilde: '~'

parentheses may be used to change the order of operations β€” yes queen, respect the parentheses, they're the group chat admins πŸŽ€

the -X argument and query can be used to exclude nodes from the resulting output. and a query can be replaced with the -A option to cause nodeattr to print all the nodes listed in the genders database. all of them. the entire roster. periodt πŸ’€


when called with a node name (optional) and attribute name, nodeattr returns 0 to the environment if the node has the attribute; else 1. if -v is present, the attribute name and any value (see below) is printed on the standard output. and if a node name is not specified, the local host is assumed β€” she just assumes it's you, bestie, she knows you like that πŸ™ˆ


when called with the -Q argument, nodeattr will check if the node name (optional) is met by the attribute and value conditions specified in the query. if the conditions are met, nodeattr returns 0 to the environment; else 1. the query format is identical to the format listed above. again, if a node name is not specified, the local host is assumed πŸ’œ


the -V option causes nodeattr to print all of the values that exist for a particular attribute. also specifying -U with -V causes nodeattr to print out only unique values for that particular attribute. dedupe, slay ✨


the -l option causes nodeattr to print all of the attributes of the specified node or list of nodes. and if no node is listed, all attributes in the genders file are listed. she's an overachiever, we love her for it 🌈


the -k option checks the genders file for parse errors and proper formatting. if errors are found, information about the error will be output to standard error. vibe check on the genders file, fr fr πŸ”


nodeattr will always check the default genders file, but a different genders file can be specified with the -f option. your file, your rules πŸ’…


the -d option allows the specified genders database to be compared to the filename indicated by the -f option or the default genders database. the differences contained in the specified database will be output to standard error. (not standard out, bestie β€” standard error. don't get caught lacking πŸ‘€)

attribute names may optionally appear in the genders file with an equal sign followed by a value. nodeattr ignores these values except:

  • when the -v option requests that the value, if any, be displayed; and
  • when an attribute is specified on the command line with a value, in which case only an attribute with the specified value in the genders file will match.

for --expand, --compress, --compress-attrs, --compress-hosts see HOSTRANGE EXPANSION AND COMPRESSION below. ⬇️


πŸ‘‘ HOSTRANGE EXPANSION AND COMPRESSION πŸ‘‘

the --expand option will take a genders database, expand all hostranges, and output a new genders database. the subsequent database will be identical to the first, but every node will be listed on a separate line. this option may be useful for debugging or determining the difference between databases. one node per line, everyone gets their own moment ✨

the --compress option is the opposite of the --expand option. it will output a new identical genders database with hostranges of nodes with identical attributes. depending on the setup of your genders database, the resulting database may be longer or shorter. this option may be useful as a beginning step to compressing an existing genders database.

the --compress-hosts option is similar to the --compress option. with --compress a given attr only appears once. with --compress-hosts a given node only appears once. the --compress-hosts option combines attributes for each node first and then groups nodes with identical attribute sets rather than creating a group of nodes for each attribute and then merging common groups. this is useful for identifying "different" nodes. for example:

for the genders file:

cluster[1-20]       attr1,attr2
cluster10           attr3
cluster20           attr3
cluster[2,5,10]     attr4
cluster[7,20]       attr5

the nodeattr --compress command produces:

cluster[2,5,10] attr4
cluster[10,20]  attr3
cluster[7,20]   attr5
cluster[1-20]   attr1,attr2

where nodeattr --compress-hosts produces:

cluster[1,3-4,6,8-9,11-19] attr1,attr2
cluster[2,5]               attr1,attr2,attr4
cluster10                  attr1,attr2,attr3,attr4
cluster20                  attr1,attr2,attr3,attr5
cluster7                   attr1,attr2,attr5

in the --compress output, cluster7 appears in the third and fourth lines because it is a member of ranges with attr1,attr2 and ranges with attr5. in the --compress-hosts output, cluster7 appears on a new line because there are no other nodes with the same combination of attributes. she said "no twins, only me" πŸ’…

the --compress-attrs option is identical to --compress. it was added for consistency when --compress-hosts was added. it's the same girl, different name tag πŸŽ€


🌟 EXAMPLES 🌟

retrieve a comma separated list of all login nodes:

nodeattr -c login

retrieve a hostlist formatted list of all login nodes:

nodeattr -q login

retrieve a comma separated list of nodes with 4 cpus:

nodeattr -c cpus=4

retrieve a comma separated list of all login and management nodes:

nodeattr -c "login||mgmt"

retrieve a comma separated list of all login nodes with 4 cpus:

nodeattr -c "login&&cpus=4"

retrieve a comma separated list of all nodes that are not login or management nodes:

nodeattr -c "~(login||mgmt)"

to use nodeattr with pdsh to run a command on all fddi nodes:

pdsh -w`nodeattr -c fddi` command

to use nodeattr in a ksh script to collect a list of users on login nodes:

for i in `nodeattr -n login`; do rsh $i who; done

to verify whether or not this node is a head node:

nodeattr head && echo yes

to verify whether or not this node is a head node and ntpserver:

nodeattr -Q "head&&ntpserver" && echo yes

go off bestie, you got this πŸ’–


πŸŽ€ FILES πŸŽ€

  • /etc/genders

πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie!! πŸ’œ this was written by LLNL, and it's dated August 2003 β€” old enough to be vintage, still serving absolute main character energy in your terminal every single day. mwah 🫢✨

πŸ“¦ where this page comes from