Add documentation for running live queries with GET request (#2755)

This commit is contained in:
Lucas Manuel Rodriguez
2021-11-03 14:35:17 -03:00
committed by GitHub
parent 0fbb9ab45f
commit 660796bf72
2 changed files with 18 additions and 0 deletions
+3
View File
@@ -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]"
```
+15
View File
@@ -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@-