Absent Member.
Absent Member.
792 views

OMi Policy - instance parameters

I Created a simple Scheduled Task policy which runs a script on the node with a parameter. I want to use this policy to run the script with different parameters. So I made the script parameter as instance parameter in the policy template. I deployed the policy on the node with multiple instance parameters but  for some reason the policy only executes with the first instance parameter. 

Here are some details of my policy.

It's a scheduled policy with the following command

ps -ef | grep %%SEARCH_STRING%% 

I declared SEARCH_STRING as an instance parameter in the policy. My intention is to use this policy to test different process on the system. 

I deployed the policy to a node with multiple instance parameters. I only get events for the first instance parameter. 

 

 

 

 

 

 

 

Labels (1)
0 Likes
3 Replies
Knowledge Partner Knowledge Partner
Knowledge Partner

Coudl you possibly share the script if its allowed and there is no sensitive info of course

Otherwise some screenhots and comments ect would help us to understand your problem better:)

0 Likes
Absent Member.
Absent Member.

Hi Mario, I have update the question

 

0 Likes
Absent Member.. Absent Member..
Absent Member..

Hello Mario,

Why don't you use split function on perl to separete string that you want to grep using comma separeted? 

for example:

Supose that you want to use instance to grep 3 strings:

1- java

2-tomcat

3-jboss

So you pass in a single string parameter (ex:Process) like this: java,tomcat,jboss.

In the script you use for example:

my $Processes;
$Processes= $OVOSystem->ParameterGetString("Processes","%%Processes%%");
$Session->Value("Processes", $Processes);

foreach my $process (split (/[,|]/,  $Processes))
{
        open PS, 'ps -ef | grep '.$process.' |' or die;
        while (<PS>)
        {
                tr/ //s;
                s/^ //;
                print;
        }

}

So you can check each ps and do what you want.

Is this what you want?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.