Sorting of the instances in the output

Every overall-check supports the option --sort-by to define in which order the instances appear in the message send to stdout.

The option --sort-by is an ordered list with the following possible elements:

  • name (of the instance)
  • value (or status of that instance)
  • exit (code; 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN)

Each of theses three elements can be suffixed with either ascending or descending.

Synopsis

--sort-by=value:ascending|descending,exit:ascending|descending,name:ascending|descending

Examples

$ check_netapp_volume usage ... 
NETAPP VOLUME USAGE WARNING - 5 volumes checked, 4 WARNING
vserv_b.vol1: 1.359MiB (WARNING)
vserv_b.vol0: 1.34MiB (WARNING)
vserv_a.vol1: 1.336MiB (WARNING)
vserv_b.vol2: 1.285MiB (WARNING)
vserv_a.vol0: 2KiB

The output ist sorted by exit-code and value, which is the default for this check.


$ check_netapp_volume usage ... --sort-by=exit:descending,name:ascending
NETAPP VOLUME USAGE WARNING - 5 volumes checked, 4 WARNING
vserv_a.vol1: 1.336MiB (WARNING)
vserv_b.vol0: 1.34MiB (WARNING)
vserv_b.vol1: 1.359MiB (WARNING)
vserv_b.vol2: 1.285MiB (WARNING)
vserv_a.vol0: 2KiB

Now the instances are still prioritized according to their exit code, but in the second level they are sorted by name and no longer by value.


$ check_netapp_volume usage ... --sort-by=name:ascending
NETAPP VOLUME USAGE WARNING - 5 volumes checked, 4 WARNING
vserv_a.vol0: 2KiB
vserv_a.vol1: 1.336MiB (WARNING)
vserv_b.vol0: 1.34MiB (WARNING)
vserv_b.vol1: 1.359MiB (WARNING)
vserv_b.vol2: 1.285MiB (WARNING)

Here the instances are sorted by name only – regardless of their exit-code or value.