Perl / Java (Groovy) Language Policies

In addition to regular expressions, you can enter Config Terms that use either Perl or Java (Groovy) language capabilities for scans. The following sections describe these.

Perl

Java (Groovy)

These scans are compiled at runtime, and the Java scan uses the Groovy libraries, included with Open Manage Network Manager. As always, you must install Perl on Windows application servers if you want to use that type of Config Term (it typically comes with other supported operating systems).

Perl

When you select Perl as the type of Config term, an editor appears that lets you enter Perl scans.

As the screen says $input_source is what the code scans. The following is example of the type of Perl you can enter that scans for contents like description in shut down interfaces, and prints output “Success” visible in the Audit viewer when it finds a matching term like description in whatever source you select:

if($input_source =~ m/shutdown/){

print("Success");

}

elsif($input_source =~ m/description/){

print("Success");

}

else

{

print("Failure - no description found");

}

Notice that you can also combine these scans with the Edit Source Group Criteria regular expressions to streamline them.

Java (Groovy)

When you select Groovy as the type of Config term, an editor appears that lets you enter that type of scans.

As the screen says this implements ProScanGroovy or Groovy Java classes. The method should return ‘Success or ‘Failure -’ results, and assumes public String validate (String input) { precedes what you enter in the text editor. The following is example of the type of Java code you can enter that scans for contents like description in shut down interfaces, and prints output “Success” visible in the Audit viewer when it finds a matching term like description in whatever source you select:

if(input.contains("shutdown") || input.contains("description"))

{

return "Success";

}

else

{

return "Failure - no description found";

}

Notice that you can also combine these scans with the Edit Source Group Criteria regular expressions to streamline them.

Click Save to preserve the policy you have configured in these screens, or click Close (in the tool bar) to abandon your edits.