Active Performance Monitor Support

You can monitor Adaptive CLI execution results with Active Performance Monitor. To do this, you must select Adaptive CLI as the monitored type when creating a new performance monitor (see Resource Monitors), then select a target entities (with the Add button in the top panel) and a particular Adaptive CLI (with the green plus [+] in the Adaptive CLI Properties panel at the bottom of this screen. Click the Edit (page) icon to select the Input Parameters to monitor once you have selected an Adaptive CLI.

The user can choose an Adaptive CLI to monitor and may have to configure both its input values and metric type for each output attribute. The Input data depends on what is configured in the Adaptive CLI attributes.

Input Parameters

In Active Monitoring, all attributes of the schema appear in the Input Data for user-entered values. You must enter the data necessary for all selected targets’ scripts. To enter data, click Edit and then enter values. Clicking Apply switches the panel back to read-only mode. You must click Save to preserve input or output data configurations.

Monitor Attributes

Configure Adaptive CLI output attributes for monitoring in this tab in the lower panel of the Monitor Editor screen. You can monitor only exposed attributes of numeric or boolean types. To change metric type, select the row and click the Edit button to its right.

An Adaptive CLI Properties screen appears that reminds you of the Attribute Name, and Attribute Type, where you can Enable the attribute monitoring, and select Gauge, Counter or Boolean buttons to the right of this panel to configure the metric type of the selected output data.

These attributes default to the metric type Gauge. Adaptive CLI is where you define these attributes, but you must select their metric type settings on this screen if it is something other than the default.

Click Save to preserve your configuration, or Cancel to abandon it and close the editor screen.

Create a Monitor for an External Script

The following steps describe creating a monitor for an external command configured as an Adaptive CLI (ACLI). Several Perl scripts appear in this performance\scripts directory by default. You can try others in addition to the http_test.pl script in the example.

Create the Adaptive CLI

1. Right click in the Actions portlet, and create a new External Command ACLI

2. Make a new attribute schema with attribute: Status (integer)

3. In Scripts, enter the following as Script Content:

perl "C:\Dorado\owareapps\performance\scripts\http_test.pl"[_EquipmentManager_IP_Address]

The variable [_EquipmentManager_IP_Address] provides the target device’s IP address, and comes from the Target Params tab, where you can find other such variables. If you want to test this script on an HTTP process on a device not under management, just to see the outcome, enter a known URL instead of that variable (like www.doradosoftware.com), and run the script to see its output. (You will still have to select a target managed object to run the script, even though it is not part of the command line.)

4. In the Value Extraction panel enter the following:

^\{(\d+)\}.*

5. Click Apply

6. Click Save

7. Right click and Execute the ACLI to test it.

The following monitors an external Adaptive CLI example of setting up a simple process monitor using ACLI:

1. Make sure Perl is installed (and Windows has restarted after installing it), and check that the required libraries (Info.pm and WMI.pm) are in place. Your directory may vary; with 64-bit Strawberry Perl the locations are:

For Info.pm:

C:\strawberry\perl\vendor\lib\Win32\Process

and for WMI.pm:

C:\strawberry\perl\vendor\lib\Win32\Process\Info

The process folder is attached to this document with proper structure. Put it in C:\strawberry\perl\vendor\lib\Win32 and you are ready to go.

Here are the URLs where you can download these libraries:
http://search.cpan.org/~wyant/Win32-Process-Info-1.018/lib/Win32/Process/Info.pm
http://search.cpan.org/~wyant/Win32-Process-Info-1.019/lib/Win32/Process/Info/WMI.pm

2. Put process_check.pl in the proper directory. For Windows the default is

C:\Dorado\owareapps\performance\scripts.

3. In your actions portlet, import TEST_ACTION.xml.

4. In your monitors portlet, import PROCESS_UPTIME_MONITOR.xml.

5. Even though the monitor and Adaptive CLI do not need one, select any target a dashboard can track.

6. In your dashboard views portlet, create a new custom Monitor Dashboard for whatever device(s) you decided to monitor, you will see Status as one of the tracked metrics (1 for up, 0 for down). You can use it as you would any other metric in Open Manage Network Manager to track, graph, and so on.

By default this script and monitor track whether notepad.exe is running, but you can have it track anything by editing the monitor. Go to Monitor Options > Adaptive CLI Properties, and you can edit the Process Name variable to be any other process.

Extra credit: Modify the script to track multiple applications.

process_check.pl

#!/usr/bin/env perl

use Win32::Process::Info;

$processname=$ARGV[0];

$found = 0;

$pi = Win32::Process::Info->new ();

@info = $pi->GetProcInfo (); # Get the max

@info = grep {

print $_->{Name};

print "\n";

if ($_->{Name})

{

if ($_->{Name} eq $processname)

{

$found = 1;

}

}

} $pi->GetProcInfo ();

if ($found == 1)

{

print "Process " . $processname . " is running! 1";

}

else

{

print "Process " . $processname . " is not running! 0";

}

TEST_ACTION

This action’s name is TestExternalScript. It has two attributes, Process Name, a string, and Status, an integer. It stores the retrieved process’ status in the Status integer, and takes Process Name as a required input. It refers to the process_check.pl script as an external command in its Scripts tab. Here is the syntax:

perl C:\Dorado\owareapps\performance\scripts\process_check.pl <Process_Name>

In addition to referring to the script, this Adaptive CLI extracts the status from the script’s run. Essentially it looks for 0 (down) or 1 (up) with the following regular expression in the Value Extractions tab:

(\d)$

PROCESS_UPTIME_MONITOR

This monitor’s name is ProcessUptimeMonitor. It refers to the TestExternalScript (TEST_ACTION) Adaptive CLI. Notice that the Process Name attribute defaults to notepad.exe, and the Monitor Attributes tab contains the Status attribute.

Monitor Dashboard

To see the result of your monitoring, create a custom monitor dashboard with the PROCESS_UPTIME_MONITOR as its target monitor, and the desired target device as its target device.

You can then see the process’ activity over time when you launch the dashboard.

7. Look in Job Viewer for the results.

Click Set attribute extraction results, click here to see the results appear in the bottom panel. Notice also that you must check informational messages for all these to appear, and that several additional sets of messages besides the extraction results appear.

Create a Monitor for the External Script Adaptive ACLI

Now that you have verified the script is working, you can create a monitor to see how this attribute is doing.

1. In the Monitors portlet, create a new ACLI Monitor

2. Uncheck Update Network Status (recommended since the ICMP monitor is already doing this)

3. You may want to test your monitor, in which case, change the monitoring interval to 30 seconds. Re-edit it to configure it with the interval needed for your production system.

4. In Monitor Options select your example monitor configured previously.

5. Confirm that Monitor Attributes displays the Status attribute configured previously.

6. In the Conditions tab of the Monitor Editor, create “Status Up” condition, with the severity of Informational, and check Alert.

7. Create a criterion which is Status = 0.

8. Save this condition

9. Create a new Condition called “Status Down”

10. The criterion is Status = 1

11. Apply and Save

12. Save your monitor.

13. Right-click to select View Monitor Data, and you can see the results of your efforts.

Add Action -- This opens an Action Editor where you can select the Action that is to be a member of the group, its Target devices and any Parameters associated with the Action.Use the Add button to add Associated Targets, and the Delete this entry icon to delete any added by mistake. Click Apply to accept an added (or edited) Action.

Remove All -- Delete all Actions.

Click Save to create the Action Group. Once you have saved the group, you can right-click to Execute it manually. You can also click Add Schedule to schedule its execution. Clicking Close ends your editor session without saving any new Action Group, or changes you may have made to an existing one.

When you execute an Action Group, the Results view displays a list of targets on the left, and results for the selected target on the right. Click on a different target to see the target’s results.