- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 06:03 PM
Hello experts,
Through other community answers, we are advised that there is no table to query data from for stats.do and servicenow performance dashboard. But is there a possible script which can fetch this data specially for data displayed for memory.
We would like to be able to catch data that our instance is having high memory utilization if possible and be able to send us a notification when a certain memory is utilized before our instance throw an OOM error. Is this possible via scripts
Thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 06:30 PM
Hi,
You can use this example to get the ball rolling:
var diag = new Diagnostics();
while (diag.nextNode()) {
var diagNode = diag.getNode();
var nodeName = diagNode.name;
var memUse = diagNode.stats['system.memory.in.use'];
var memFree = diagNode.stats['system.memory.pct.free'];
gs.info("Node name: " + nodeName + " Memory in use: " + memUse + " Memory % Free: " + memFree);
}
You can also refer to the UI Page: system_diagnostic_page for more information.
Then sort of take it from here.
The above is just an example to get you started.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 12:52 AM
Thanks again for the help,
By the way, this line of code
var memUse = diagNode.stats['system.memory.in.use'];
were able to get the memory in use, how were you able to come up with the system.memory.use, do you have any reference for looking through stats.do. Because for example we want to also display the allocated memory, how do we write it.
Or we want to get the other processor transaction values how do we modify the script for that.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 12:58 AM
Hey,
All of the functions that are being used are all rolled into script include Diagnostics , you can review this once t o get all other details from the stats.do page
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 01:04 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 01:24 PM
Hello,
You're listening to other replies that are telling you slightly different information that what I used (which is why I wish people would simply reply in their own chain as my context is different than theirs). Please review my reply and the UI Page I mentioned which gives you additional information to consider.
There's multiple pieces to this that I covered already 🙂
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 01:18 PM
Hi,
It's a bit unfortunate I didn't see the notifications until now (my apologies for that) that you've responded and I wish others would reply to you in their own reply chain.
What I provided took a bit of time to gather and was not really found in any other thread on these forums. So I personally went and dug into this for you.
With that said, I've given example script as well as the UI Page. From there, you can surmise the API (Diagnostics()) and can look that up in the script include for further information and leverage what it's doing there 🙂
Please let me know if you still have any specific questions, but I felt I got you 90% of the way there. The rest was just up to you to format and use as you needed.
If so, and my reply above helped guide you Correctly, please mark it as Correct.
Thanks and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!