- 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-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:41 AM
Hello,
Thanks for the reply. I tested it in background scripts and it was able to get some data. Just a question though in the script it made reference to Diagnostics, are the data displayed the same displayed from stats.do page?
Though there is some slight difference, are these that same data? Because if this is does it mean that we can fetch data from stats.do through scripts but stats.do doesn't have its table?
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 12:49 AM
There is a difference, since these data is dynamic and real time
Even if you refresh stats.do page, you will notice those fluctutations.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 12:54 AM
Are the data fetch by the script not from stats.do itself?