What Input parameters are available during a Pre Execution pattern script

Patrick Oudshoo
Tera Contributor

Hi all,

Does anybody know what Input parameters are available during a Pre Execution script?

I would like to know the IP Address (hostIP) before the execution of the Pattern and based on this IP make the Pattern execute specific steps.

The Pre Execution script 'Lightweight Process Info' is for example check 2 input parameters; 'pre_exe_computer' and 'pre_exe_pid'.

Anyway to get a hold on the hostIP in the Pre Execution?

Cheers, Patrick

1 ACCEPTED SOLUTION

So not sure if this something good but I was able to get below to work. 

 

var test = g_probe.getEccQueueRecord();
gs.info('PD: JSON == '+test.source);

View solution in original post

8 REPLIES 8

Patrick DeCarl1
ServiceNow Employee
ServiceNow Employee

Does the temp variables computer_system not give you the host ip during the start?

 

find_real_file.png

Hi Patrick,

Thanks for your response.

However, the pre-execution script is BEFORE you go into your pattern and THERE I would like to know some details like the IP address of the discovered device.

Based on that IP I'll be able to do some last minute checks and set some parameters to pass on to the Pattern itself. Based on these parameters some parts of the pattern will or will not be executed.

Cheers, Patrick 

I understand what the pre and post script do. However, your use-case is before this point right? You want to know what IP address is before any pattern runs. The pre execution script will only run if pattern tied to it will kick off from the classification class triggers. 

Would it be fair to say you need to know IP address for classifier probe "Condition script"?

Or Classification criteria has ip address par. 

 

https://docs.servicenow.com/bundle/geneva-it-operations-management/page/product/discovery/reference/r_ClassificationCriteria.html

Yes and No 🙂

Normally indeed what I would do is use the condition script.
However, the problem is that the Pattern I would like to pass certain variables to, based on the discovered IP address, is the Credentialless Discovery pattern.

And as far as I know that pattern is not triggered from a classifier probe and therefore I can not use the condition script.

Key is that I ONLY wish to run Credentialless Discocery on IP addresses that I do NOT yet have registered in my CMDB. This since Credentialless Discocery creates duplicate records when only IP is disovered without any MAC address.
Now by checking in the 'pre-execution' script whether the IP address already exists, I can terminate the Credentialless Discovery in step 1 when I have a parameter passed on to that Pattern indicating the IP already exists in my CMDB.

But perhaps you know a better/different way to 'kill' Credentialless Discovery when the IP is already in the CMDB??

Cheers, Patrick