Werk #16149: New OrderBy header in livestatus
Komponente | Livestatus | ||||
Titel | New OrderBy header in livestatus | ||||
Datum | 29.01.2024 | ||||
Level | Kleine Änderung | ||||
Klasse | Neues Feature | ||||
Kompatibilität | Kompatibel - benötigt kein manuelles Eingreifen | ||||
Checkmk versions & editions |
|
We provide a new header for livestatus that returns the rows in sorted order.
For example, to sort host names in descending order
$ lq 'GET hosts\nColumns: name\nOrderBy: name desc'
zhost
yhost
xhost
...
in ascending order
$ lq 'GET hosts\nColumns: name\nOrderBy: name asc'
ahost
bhost
...
or, alternatively without asc
,
$ lq 'GET hosts\nColumns: name\nOrderBy: name'
ahost
bhost
...
The OrderBy
header can be combined with the Limit
header to
limit the number of results as expected.
$ lq 'GET hosts\nColumns: name\nOrderBy: name\nLimit: 1'
ahost
Furthermore, it is possible to sort on dictionary keys with the following syntax
$ lq << EOF
GET services
Columns: host_name description performance_data
OrderBy: performance_data.user_time
EOF
...