Skip to content

Instantly share code, notes, and snippets.

@rkhozinov
Last active April 7, 2017 12:41
Show Gist options
  • Save rkhozinov/b1c72488f070de99cdad8a84679a80f2 to your computer and use it in GitHub Desktop.
Save rkhozinov/b1c72488f070de99cdad8a84679a80f2 to your computer and use it in GitHub Desktop.
Pushkin elastic fake notification generator
# https://pypi.python.org/pypi/RandomWords/0.1.5
host=172.16.10.254
port=9200
title=$(python -c "import random_words; print ' '.join(random_words.RandomWords().random_words(count=2))")
content=$(python -c "import random_words; print ' '.join(random_words.RandomWords().random_words(count=10))")
app=$(($RANDOM % 3 + 1))
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
data="
\"title\": \"${title}\",
\"content\": \"${content}\",
\"applicationId\": ${app},
\"level\": \"WARNING\",
\"read\": false,
\"timestamp\": \"${timestamp}\"
"
# curl -XDELETE http://$host:$port/_all
curl -svv -XPOST "http://$host:$port/notifications/notification?pretty&pretty" -H 'Content-Type: application/json' -d "{${data}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment