- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 12:40 PM
'Active Transactions (all nodes)' dynamically creates a list of transactions from all nodes. Every time you hit refresh, the same thread will get a new sys_id. With this in mind, I want a script that will identify long-running transactions to alert our platform support team, but a script can't see transactions on all nodes. It will only see transactions on the current node. Does anyone know how to script getting active transactions from all nodes?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 07:54 AM
I was able to find an answer here. I put the following in a scheduled job that runs every couple hours
refreshTransactions();
findLongRunning();
function refreshTransactions() {
var vct = new VClusterTransaction('v_cluster_transaction');
vct.deleteTransactions();
var id = vct.informOtherNodes();
vct.refreshTransactions(gs.getSessionID());
gs.sleep(35000);
}
function findLongRunning() {
var tran = new GlideRecord('v_cluster_transaction');
tran.addEncodedQuery("age>javascript:gs.getDurationDate('0 10:0:0')");
tran.query();
while(tran.next()) {
createIncident(tran);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2022 02:29 AM
Apologise, don't have the answer - but I'd like to bump this thread, having the same question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 07:54 AM
I was able to find an answer here. I put the following in a scheduled job that runs every couple hours
refreshTransactions();
findLongRunning();
function refreshTransactions() {
var vct = new VClusterTransaction('v_cluster_transaction');
vct.deleteTransactions();
var id = vct.informOtherNodes();
vct.refreshTransactions(gs.getSessionID());
gs.sleep(35000);
}
function findLongRunning() {
var tran = new GlideRecord('v_cluster_transaction');
tran.addEncodedQuery("age>javascript:gs.getDurationDate('0 10:0:0')");
tran.query();
while(tran.next()) {
createIncident(tran);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 02:30 AM
Hi matt_kean,
would you mind the sharing the script include VClusterTransaction what you call or the entire functionality?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 06:32 AM
VClusterTransaction is an out-of-box backend script that we don't have access to. However, calling it should work in your instance.