Is it possible to fetch data from stats.do or servicenow performance dashboard via script?

Ronald11
Tera Expert

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.

find_real_file.png

find_real_file.png

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

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

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);
}

find_real_file.png

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!

View solution in original post

13 REPLIES 13

Allen Andreas
Administrator
Administrator

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);
}

find_real_file.png

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!

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?

find_real_file.png

find_real_file.png

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

There is a difference, since these data is dynamic and real time

Even if you refresh stats.do page, you will notice those fluctutations.

Best Regards
Aman Kumar

Are the data fetch by the script not from stats.do itself?