0
votes

I have the following curl command which should run 900 times and then do a curl to push data to splunk.

CURL: SITEINFO=curl -H "Authorization: Token <Token>" -H "Accept: application/json; indent=4" "https://netbox.n.com/api/dcim/devices/?limit=1&offest=0&site=a5s"

After running the command for 900 times (there are 900 devices) .I want to push the data to splunk using another curl.

curl -k http://localhost:8088/services/collector/event -H 'Authorization: Splunk ' -d '{"sourcetype": "Netbox","event": '"$SITEINFO"'}'

1
what shell are you using? - Daniel A. White

1 Answers

0
votes

Via looping

i=0
while ["$i" -lt 90]
   curl -H "Authorization: Token <Token>" -H "Accept: application/json; indent=4" "https://netbox.n.com/api/dcim/devices/?limit=1&offest=0&site=a5s"
   i = `expr $a + 1`
done