Created
April 3, 2018 17:09
-
-
Save tmuth/6782a6563d4d1d08c58e1a062a57b322 to your computer and use it in GitHub Desktop.
Run fio and send results to splunk HTTP Event Collector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SPLUNK_HOST=localhost | |
HEC_PORT=8088 | |
HEC_TOKEN=ba8e11d0-0a1f-4f41-a5c6-c660e8655b02 | |
HEC_PROTOCOL=http | |
file_name=`hostname`"_"$(date '+%Y-%m-%d_%H.%M.%S')".json" | |
host_name=`hostname` | |
epoc_time=`date +%s` | |
fio splunk-1.fio --output=${file_name} --output-format=terse | |
echo -e "{\"host\": \"${host_name}\",\"time\": \"${epoc_time}\",\"source\": \"${file_name}\",\"event\":\n $(cat ${file_name}) \n }" > ${file_name} | |
curl -k ${HEC_PROTOCOL}://${SPLUNK_HOST}:${HEC_PORT}/services/collector/event -H "Authorization: Splunk ${HEC_TOKEN}" -H "Content-Type: application/json" -X POST -d @${file_name} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment