The nc hosts -rule option


Regarding how to use the 'nc hosts -rule' command, -h returns:

-rule <SELRULE> -- Show only slaves that match the given selection
                             rule. Use "vovselect fieldname from slaves" for
                             the complete list of fields that can be used in
                             the rule. Example rules:
                                 "status==READY"
                                 "status!=OVRLD slots>8"
                             Can accept multiple constraints.

Example:

nc hosts -rule "cores>4 ramtotal<20000" -O "@name@ @corestotal@ @ramtotal@"

Please see this page explaining selection rules (SELRUL). It has operators AND and OR, precedence of operators, string comparisons and many more.

nc cmd vovbrowser -url /doc/NetworkComputer_UserGuide/selrules.html

The available fields for the selection rule are retrieved with this nc command:

nc cmd vovselect fieldname from slaves

In my case it returns 67 fieldnames, see the full list below.

Please keep in mind that these fieldnames may or may not be available in the list of fields, available for printout in the formatted string, specified with -O. These fields are retrieved with nc hosts -f

In my case 44 fields. Please see the full list below.

Example (please note 'version' in -rule vs. VOVVERSION in the -O option:

nc hosts -rule "version~Linux64/2016.09" -O "@VOVVERSION@"

Example with matching names:

nc ho -rule "status==FULL" -O "@status@"

When using string comparisons please note how the vovselect command returns the content of the fieldname, to be compared in -rule.

Example: nc cmd vovselect status from slaves

Here the fieldname 'status' can be given in both small and capital letters. Both are specifying the same fieldname in the context of vovselect.

Both are specifying the same fieldname in the context of nc hosts -rule.

When checking the output of 'vovselect status from slaves' we find that the content is printed in capital letters, ie READY,SICK,FULL, etc. Hence in order to compare the status of slaves in -rule, we need to compare with the capital letter version of the status nc ho -rule "status==FULL" -O "@status@"

Or use case insensitive match nc ho -rule "status~~full" -O "@status@"

> nc cmd vovselect fieldname from slaves
ID
IDINT
STATUS
NAME
HOST
PID
SLAVENAME
SLAVEGROUP
SLAVESLOTSUSED
SLAVESLOTSSUSPENDED
SLAVESLOTSSUSPENDABLE
STATSVISITS
STATSREJECTRAM
STATSREJECTSLOTS
STATSREJECTCORES
STATSREJECTRESERVED
STATSREJECTOTHER
FULLINFO
RESOURCES
PROPERTIES
PROP
PROPDUMP
TYPE
CAPACITY
VERSION
LASTUPDATE
RAM
RAMTOTAL
CORES
CPUS
PERCENT
SWAP
SLOTS
MESSAGESYS
MESSAGEUSER
ARCH
CLASSRESOURCES
DOEXEC
DONETINFO
DOPROCINFO
DORTTRACING
RESOURCESEXTRA
RESOURCESPEC
RESOURCECMD
POWER
RAWPOWER
MANUALPOWER
CURLOAD
EFFLOAD
MAXLOAD
RUNNINGJOBS
LIFETIMEJOBS
RESERVEDBY
RESERVEUSER
RESERVEGROUP
RESERVEOSGROUP
RESERVEJOBCLASS
RESERVEJOBPROJ
RESERVEFORBUCKETID
RESERVEFORID
RESERVESTART
RESERVEEND
HEARTBEAT
LASTJOBID
ROWCOUNT
CORESUSED
CORESAVAIL

nc ho -f
         arch
         clock
         consumables
         cores
         corestotal
         extras
         group
         hb
         hbpp
         host
         id
         load1
         load15
         load5
         loadeff
         machine
         maxload
         message
         model
         name
         numjobs
         osclass
         percent
         power
         ram
         ramfree
         ramtotal
         rawpower
         release
         resources
         slavetype
         slots
         slotstotal
         status
         swap
         swapfree
         swaptotal
         timeleft
         timeleftpp
         tmp
         uptime
         uptimepp
         user
         vovversion