Discovery Patterns: Where and how to set "onLoad" Temporary variables

Brent Sutton
Mega Sage

Hi All,

I recently reviewed the OOB "Network Switch" infrastructure pattern to get some inspiration for how I might expand some of my companies custom network appliance patterns.

When exploring this pattern I noticed that there are a number of temporary variables available upon load of the pattern i.e. "fqdnRegex" and "hostnameCase".

find_real_file.png

My question is how and where are these variables defined and set? I thought it may have been in the SNMP classification using the "On classification script" but this is empty for Standard Network Switch classifier.

Any help on this would be much appreciated.

Brent

 

1 ACCEPTED SOLUTION

Andrew Westerv4
Mega Guru

Those are Discovery Properties: glide.discovery.fqdn.regex and glide.discovery.hostname.case.

They are called during the pre-script "Fetch Hostname Formatting Attributes".

View solution in original post

2 REPLIES 2

Andrew Westerv4
Mega Guru

Those are Discovery Properties: glide.discovery.fqdn.regex and glide.discovery.hostname.case.

They are called during the pre-script "Fetch Hostname Formatting Attributes".

Brent Sutton
Mega Sage

Thanks for the information @Andrew Westervelt , it was enough for me to work out where the temporary variables are being set.

The pattern pre/post scripts, that set the temporary variables (amongst other things) are held in the [sa_pattern_prepost_script] table.

You can navigate to it through the application menu - Pattern Designer >> Pre Post Processing or use the shortcut sa_pattern_prepost_script.list

The pre-execution script I needed was as follows:

AttributeValue
Name<name of script>
Pattern/s<g_list link to your pattern>
Execution Type1 - Horizontal Discovery
When to execute3 - Pre execution

 

Script:

/* 
* Pre execution: This script will run before the execution of the assigned pattern/s
* it allows the user to add data that can be accessed by the running the pattern
 *this is done by adding variables to the scriptable PrePatternExecutionData object
* below is an example of the possible variables that can be added.
*/

var data = new SNC.PrePatternExecutionData();

data.addString('shouldIncludeDomain',gs.getProperty('glide.discovery.hostname.include_domain', 'false'));
data.addString('hostnameCase',gs.getProperty('glide.discovery.hostname.case', 'No change'));
data.addString('fqdnRegex',gs.getProperty('glide.discovery.fqdn.regex', "^([^.]+)\\.((?:[^.]+\\.)+[^.]+)$"));

//must return the data at end
rtrn = data;

Hopes this helps other people,

Brent

P.S. If you found this information useful then please mark this post as helpful so other community members can benefit from this information.