Monitoring and Analyzing Performance on AWS
Webhooks can help you keep an eye on your metrics in AWS. Let's run through the configuration steps needed for Webhooks to post data to AWS Elasticsearch.
Join the DZone community and get the full member experience.
Join For Freewebhooks are http callbacks that are triggered by events specified in the code by the application developer; the event data is then recorded and pushed to an endpoint url. webhooks are a powerful way of exchanging data.
let’s take an example.
imagine that you go to your neighborhood grocery store to pick up mangoes, but unfortunately, today, the shop is out of the mangoes that you want. the delivery boy who is supposed to bring the mangoes to the store is stuck in traffic. so, the shop owner asks you to come back in an hour. you go back home and return to the shop after an hour, but the delivery boy has not yet arrived with the mangoes. the story repeats, and after multiple attempts, you finally get your beloved mangoes. this is exactly how apis work. you keep making requests, you keep wasting resources, but you won’t get data until it is available.
now imagine that, instead of you going to the shop, you leave your address with the shopkeeper and ask him to deliver the mangoes as soon as they arrive. this will help you save your time, effort and resources. this is exactly how webhooks work.
one of the advantages of webhooks is that, since there’s no request required for a webhook, it sends the data to the endpoint as soon as it’s available and, hence, the data is made available in near real time.
in this blog, we explore the idea of using webhooks to analyze web performance data from catchpoint in your amazon elasticsearch service.
step 1: setting up the aws instance
here are the steps to set up your own aws instance.
log into your aws account.
go to services and select elasticsearch service under the analytics section.
create a domain and select the elasticsearch version you want, then click next.
configure the cluster as per your requirements and click next.
set up your access policy, make sure you allow the catchpoint webhook domain/ip so that it can post data, then click next.
confirm your changes and create the aws es instance. wait for the domain status to change to active. that’s when the service is ready to ingest data. here, the endpoint url and kibana url are important.
create an index to push data to aws es.
for example: the following curl request will create an index called cpindex
curl -x put http://search-catchpoint-test-imwp2rphrbhue6k2gizw6c5afm.ap-south.es.amazonaws.com/cpindex -h 'cache-control: no-cache' -h 'content-length: 225' -h 'content-type: application/json'
while sending data, don’t forget to add a type to this index.
so, the new post url will look like, here data is the aws es type:
http://search-catchpoint-test-imwp2rphrbhue6k2gizw6c5afm.ap-south.es.amazonaws.com/cpindex /data
the following lines are taken from the elasticsearch documentation:
" for example , let’s assume you run a blogging platform and store all your data in a single index. in this index, you may define a type for user data, another type for blog data, and yet another type for comments data."
step 2: setting up the webhook to post data to the aws es instance endpoint
select a test for which you want to enable webhooks. go to advanced options in the test setup page and enable the test data webhook option.
in the webhook settings, copy the aws es endpoint url and save.
step 3: verifying the setup
once the test settings have been saved and a test run is executed, you can view the index in the aws es indices tab.
you should be able to view the results in kibana.
that’s how you can leverage the power of webhooks for your performance analysis.
Published at DZone with permission of Kameerath Abdul Kareem, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments