rasti.hil@hilandco.com +41 79 367-9677

Search This Blog

How to create your first Management Plug-in in Grid Control

1) Adding a Target Instance to the targets.xml File

Add this following line to %AGENT_HOME%\sysman\emd\targets.xml file:

<Target TYPE="first_task_type" NAME="first_task"/>

After that you have to reload:

%AGENT_HOME%\BIN> emctl reload

Or restart the agent:

%AGENT_HOME%\BIN> emctl stop agent
%AGENT_HOME%\BIN> emctl start agent

You can upload and see the status:

%AGENT_HOME%\BIN> emctl upload agent
%AGENT_HOME%\BIN> emctl status agent

2) Create target type metadata


<?xml version="1.0" ?>
<!DOCTYPE TargetMetadata SYSTEM "../dtds/TargetMetadata.dtd">

<TargetMetadata META_VER="1.0" TYPE="first_task_type">
<Label NLSID="my_name">first_task_type_label</Label>

<AltSkipCondition METRIC="Response" COLUMN="State" />

<Metric NAME="Response" TYPE="TABLE">
<Label NLSID="resp">Response</Label>

<ColumnDescriptor NAME="Status" TYPE="NUMBER" IS_KEY="FALSE">
<Label NLSID="resp_status">Status</Label>

<QueryDescriptor FETCHLET_ID="OSLineToken">
<Property NAME="scriptsDir" SCOPE="SYSTEMGLOBAL">scriptsDir</Property>
<Property NAME="perlBin" SCOPE="SYSTEMGLOBAL">perlBin</Property>
<Property NAME="command" SCOPE="GLOBAL">
%perlBin%/perl %scriptsDir%/first_task_script.pl
<Property NAME="startsWith" SCOPE="GLOBAL">em_result=</Property>
<!-- <Property NAME="delimiter" SCOPE="GLOBAL">|</Property>-->




3) Create perl script which is used by the target type metadata file.


# first_task_script.pl
# first_task_script.pl - Returns an always up value
# Returns an always true value for every evaluation.

print "em_result=1\n";

4) Define the schedule of metric collection:


<!DOCTYPE TargetCollection SYSTEM "../dtds/TargetCollection.dtd">
<TargetCollection TYPE="first_task_type" >
<CollectionItem NAME = "Response" REQUIRED="TRUE">
<IntervalSchedule INTERVAL="5" TIME_UNIT="Min"/>

5) Validation with ILint
Go to the directory:%AGENT_HOME%\BIN and run the following command:

emctl ilint
-m %AGENT_HOME%\sysman\admin\metadata\first_task_type.xml
-i %AGENT_HOME%\sysman\emd\targets.xml
-c %AGENT_HOME%\sysman\admin\default_collection\first_task_collection.xml
-t first_task
–r Response

6) Validation with emPDK
Go to the directory where you have installed emPDK.jar and run the following command:

emcli check_mp

7) At finally you can see it in Grid Control
(go to Targets -> Host -> select the host -> Targets -> first_task

You can read more:
Developing a Management Plug-in