HowTo Parse or Capture xMatters Event ID from Integration Agent

Not Yet Reviewed

When pasting the URL
http://servername:2010/agent?message=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3Ctransaction%20id%3D%221%22%3E%3Cheader%3E%3Cmethod%3Eadd%3C%2Fmethod%3E%3Csubclass%3Eevent%3C%2Fsubclass%3E%3C%2Fheader%3E%3Cdata%3E%3Cent_priority%20type%3D%22string%22%3E0%3C%2Fent_priority%3E%3Creporter%20type%3D%22string%22%3Esendpage%3C%2Freporter%3E%3Caction_script_set%20type%3D%22string%22%3Esendpage%3C%2Faction_script_set%3E%3Cincident_id%20type%3D%22string%22%3E12345%3C%2Fincident_id%3E%3Cdescription%20type%3D%22string%22%3ExMatters%20IA%20Monitoring%20Event%3C%2Fdescription%3E%3Ccontact_type%20type%3D%22string%22%3Eall%3C%2Fcontact_type%3E%3Cperson_or_group_id%20type%3D%22string%22%3Ehoudx%3C%2Fperson_or_group_id%3E%3Cagent_client_id%3Esendpage%3C%2Fagent_client_id%3E%3C%2Fdata%3E%3C%2Ftransaction%3E

it's only displaying "AgentOK". Is it possible to configure in the Integration Agent to display the Event ID?

<transaction id="1">
<header>
<method>Agent</method>
<subclass>OK</subclass>
</header>
<data/>
</transaction>

0

Comments

6 comments
Date Votes

Please sign in to leave a comment.

  • Hi Aris!
    Sounds like you are having some fun with the IA! As of IA 5.1.5, all of the Integration Endpoints insert the request into a queue and run the code asynchronously. This helps with high availability so the agent doesn't get overwhelmed with requests while waiting on the code to complete. One option would be to make a web service call from within the apia_input function to the management system.
    However, if you wanted to downgrade, the apia_http method of the IA in 5.1.4 does not run asynchronously and you can craft the http response. I've only ever tried this with HTTP POST, but you might be able to do a GET. A good starter article for using the http endpoint (as opposed to the agent endpoint you are using above, which calls apia_input) is here.

    What are you looking to integrate to or why do you need the event ID on the response?

    Happy Tuesday!
    --- Travis

    0
  • Aris, one way to do what you are asking about is to send the queryIncident request after submitting the incident. The returned information will include the eventID associated with the incident. However, you will have to find a way to cause a small delay between sending the incident and sending the queryIncident request (ie, to allow time for the event to be created by the xMatters server). One way to do this would be to invoke apclient.bin via a batch script, which would send the incident, wait a second or so, and then send the queryIncident request. I can provide some sample code to do these things. Let me know if you're interested in the specifics.

    0
  • Hi Guys, Thanks for the respone.

    Hi Travis,
    The reason why I need the Event ID is because that is the only accepted search parameter in xMatters SOAP (QueryEventAuditTrail).
    I have created a Web Site that displays the Event using SOAP but the only accepted search parameter is "eventIdentifier" which is the Event ID.

    Hi Jeremy,
    Looks like the method you are suggesting is a little complicated on my part because I don't know where to start.

    Another method I'm thinking is to call the external ".js" file to my Web Site.
    Is it possible to access the integration agent's ".js" through HTTP?

    An example is the Integration Agent "ping"
    I can see that there's a "ping.js" file and on that file, I can see "var id = apxml.getTransactionId();" and I can just call this variable if my Web Site can access the "ping.js" file like "http://server:port/integrationagent/ping/ping.js"

    0
  • Aris, you asked "Is it possible to access the integration agent's ".js" through HTTP?" The answer is yes, you can put the code that you want to execute in a method called "apia_http" and then invoke it via an http post. The code can send a getIncident request to xMatters, parse the eventID out of the reply, and then return the eventID in the http response.

    You would just need to ensure that your application sends the http post a few seconds after the incident was created. This is necessary because the IA sends its messages to xMatters in batches, with 3-second intervals between the batches. It's possible to construct your code so that the incident creation message and the http request are enqueued together in the same batch, but much simpler to wait 3 seconds before you request the eventID via an http post.

    0
  • Thanks. I was busy with PHP, SOAP, LiveSearch and Migration from On-Prem to On-Demand.

    Travis, can you send me the HTTP Example for the IA file again? The compressed file that you have sent was empty. Thanks.

    0
  • Hey Aris,
    I did send it, but there was a .js and a .xml file, so maybe it got caught by your mail server. Anyway, I wrote up a full blog post about this here: https://support.xmatters.com/hc/en-us/articles/207883883
    The files are attached at the end.
    Let us know how it goes!
    --- Travis

    0

Didn't find what you were looking for?

New post