The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Access and use data provided in xmlstats.do

tdinkov
Mega Contributor

Hi Community, 

I need to create a scheduled job that monitors the health of the instsance (for example the memory that is currently in use) and creates notification when certain threshold is reached.

As far as I know  such info is accessible in xml format when loading the 'https://<INSTANCE_NAME>.service-now.com/xmlstats.do'  endpoint.

Can you please suggest how can I call this endpoint in a script and get the values of specific fields ( for example 

<system.memory.in.use>)? 

 

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@tdinkov 

Hope you are doing good.

Let me know if that answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

Regards
Ankur

Nick Folz
Tera Contributor

Here is an example code snippet.  I had a similar requirement to check the Available progress workers on the instance.  From here you can index the variables you need.  Alternatively, there is also an OOB script include called 'Diagnostics' that you can reference for some of the Node related data.  (This Script Include is used to populate the System Diagnostics UI Page/Dashboard).


try{
var rm = new sn_ws.RESTMessageV2();
var endpoint = gs.getProperty('glide.servlet.uri') + "xmlstats.do";
rm.setEndpoint(endpoint);
rm.setHttpMethod('GET');
rm.setRequestHeader('content-type', 'application/json');
var response = rm.execute();
var responseObj = new XMLHelper(response.getBody()).toObject();
gs.print("response=" + response.getBody());
gs.print("errorMsg=" + response.getErrorMessage());
}
catch(err){
gs.print("err=" + err);
}