Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

SPM allows you to see events which happen in your system (application or server restarts, deployments, alerts...). Event chart is available on all reports, so you can easily see effects various events have on your application performance.

To start seeing events, you will have to send HTTP messages to our Event Receiver. Endpoint URL has the following format:

http://event-receiver.sematext.com/receive/YOUR_SPM_APPLICATION_TOKEN/EVENT_TYPE

 

Only one application token can be specified in URL, so if you have events which are relevant for multiple SPM application, you will have to send one request for each of them. EVENT_TYPE can basically have any value (few examples: alert, app_restart, server_restart, reboot...), but we suggest having a smaller number of event types (1-10).

 

Each event must conform to specific structure. Here is a set of possible fields:

 

Field NameField TypeMandatoryNotes
tokenstringnoYour SPM application token. If you don't populate it, Event Receiver will automatically fill it with token from request URL.
timestampdatenoRepresents time when event happened (if not specified, Event Receiver will populate it with current time). The format is dateOptionalTime e.g.: 2014-02-17T14:15:01.534471+02:00
messagestringyesShort description of event, e.g. "Elasticsearch node03 on host somehost06 restarted". This is a default search field in SPM UI, so it is good to keep it concise
namestringnoEvent name, can be used as a short label for event, e.g. "Elasticsearch restart"
tagsstring arraynoMultivalued field, each tag should be specified in separate array value (e.g. "tags":[ "elasticsearch", "restart", "weekend"])
prioritystringnoYou can use any values that make sense to you, like "high", "very high" or 7
creatorstringnoPerson,application or component which created event. E.g. "John Smith", "Elasticsearch", "Some Batch Job"
datastringnoAdditional event data. It can be anything you may find useful to have along inside of event object. E.g., it could be stacktrace in case of "app_error" event,  base64 encoded content of file generated during "user_registered" event, etc.

 

Event Receiver supports Elasticsearch JSON API, so event data must be represented with JSON.

 

Example 1: Consider some SPM Solr application whose token (you can find token for your apps here: https://apps.sematext.com/users-web/services.do) is fd6b851b-0997-444f-af22-c792417722e4. Sending a server_restart event would mean we have to send HTTP post to URL:

http://event-receiver.sematext.com/receive/fd6b851b-0997-444f-af22-c792417722e4/server_restart/

with JSON content like this:

{
  "timestamp" : "2014-02-17T15:29:04+0100",
  "message": "Solr on myhost04 restarted"
}

 

The easiest way to quickly send an event is using curl, so the same event would be sent with the following command:

curl -XPOST "http://event-receiver.sematext.com/receive/fd6b851b-0997-444f-af22-c792417722e4/server_restart/" -d '{"timestamp" : "2014-02-17T15:29:04+0100", "message" : "Solr on somehost04 restarted"}'

 

Example 2: Same SPM Solr application, but we want to send deployment event which should have more event properties populated. HTTP post would in that case be sent to:

http://event-receiver.sematext.com/receive/fd6b851b-0997-444f-af22-c792417722e4/server_restart/

with content like:

{
  "timestamp" : "2014-02-17T15:58:04+0100",
  "message": "Solr 4.6.1 version deployed on prodhost06",
  "name" : "Solr 4.6.1 deployment",
  "tags" : ["solr", "4.6.1", "deployment", "upgrade"],
  "priority" : "High",
  "creator" : "John Smith"
}

 

or again with curl:

curl -XPOST "http://event-receiver.sematext.com/receive/fd6b851b-0997-444f-af22-c792417722e4/deployment/" -d '{"timestamp" : "2014-02-17T15:58:04+0100", "message" : "Solr 4.6.1 version deployed on prodhost06", "name" : "Solr 4.6.1 deployment", "tags" : ["solr", "4.6.1", "deployment", "upgrade"], "priority" : "High", "creator" : "John Smith"}'

 

 

  • No labels