Add documentation for running live queries with GET request (#2755)
This commit is contained in:
@@ -64,4 +64,7 @@ export FLEET_ENV_PATH=/Users/victor/fleet_env
|
||||
|
||||
# get scheduled queries in a pack
|
||||
./tools/api/fleet/packs/scheduled 2 | jq '.scheduled[]|{"name": .name, "schedule_id": .id, "query_id": .query_id}'
|
||||
|
||||
# run a live queries on hosts (queries with id=1 and id=2 on hosts with id=3 and id=4)
|
||||
./tools/api/fleet/queries/run "[1,2]" "[3,4]"
|
||||
```
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
source $FLEET_ENV_PATH
|
||||
endpoint="api/v1/fleet/queries/run"
|
||||
echo "By default, $endpoint will take 90 seconds..."
|
||||
jq -n \
|
||||
--argjson query_ids "$1" \
|
||||
--argjson host_ids "$2" \
|
||||
'.query_ids = $query_ids
|
||||
|.host_ids = $host_ids
|
||||
'|\
|
||||
curl $CURL_FLAGS --request GET \
|
||||
--max-time 100 \
|
||||
--header "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
"$SERVER_URL/$endpoint" -d@-
|
||||
Reference in New Issue
Block a user