Skip to content

Commit 4357083

Browse files
Script to trigger quick discovery
Script to trigger quick discovery from workflow or flow
1 parent 424ee3c commit 4357083

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var midServer1 = 'SNOWMIDPRD01'; // Rename/input your MID server as per your organization
2+
var midServer2 = 'SNOWMIDPRD02'; // Rename/input your second MID server accordingly
3+
var ipAddressScan = current.variables.ip_address; // IP address to scan
4+
var discovery = new Discovery(); // Create a new Discovery object
5+
6+
// Attempt discovery using the first MID Server
7+
workflow.scratchpad.statusID = discovery.discoveryFromIP(ipAddressScan, midServer1);
8+
9+
// If the first attempt was unsuccessful, try the second MID Server
10+
if (workflow.scratchpad.statusID == null) {
11+
gs.info('Discovery using ' + midServer1 + ' failed. Trying ' + midServer2);
12+
workflow.scratchpad.statusID = discovery.discoveryFromIP(ipAddressScan, midServer2);
13+
}
14+
15+
// Log the results
16+
gs.log('DiscoveryStatusId: ' + workflow.scratchpad.statusID);
17+
gs.log('QuickDiscoveryIPAddress: ' + ipAddressScan);
18+
current.variables.discovery_status = workflow.scratchpad.statusID;

0 commit comments

Comments
 (0)