AddMonitor API


This API allows the user to configure monitors in Applications Manager. The different monitors supported are:

Request Parameters

The common parameters involved in the API request are described below:

Field Description
apikey * The key generated from the Generate API Key option in the 'Admin' tab.
displayname * The display name of the monitor.
subnet The subnet where the server is running. The default value is 225.225.225.0.
pollInterval The interval at which the server needs to be polled. This variable is optional. If no value is mentioned, the default value of 5 minutes will be taken.
groupID (haid)

The id of the monitor group. In Applications Manager, you can find the groupID of a monitor group using the following method:

  • Click on the Group Name in the monitor groups table. This will open the Monitor Group details page
  • The url of the Monitor Group details page will be in the following format:

    http://app-windows:9090/showapplication.do?&method=showApplication&haid=10000040

  • The haid in the URL is the Group ID that you require, in this case, 10000040.
resolvedns The value can be 'True' or 'False'. Do not resolve DNS name when you have multiple system IP addresses configured with single DNS name.
credentialID A unique identifier set by Applications Manager for a credential.
label Assign labels for a resource.

* - mandatory

Adding a new monitor as a Delegated Admin user

When adding a new monitor as a Delegated Admin user, the following parameters should be appended in the API URL:

Field Description        
addToGroup * Denotes if the monitor should be added to monitor group. Value is either true or false.
groupID * The group ID of the monitor group to which the monitor is to be added.

* - mandatory

Sample Request:

http://app-windows:9090/AppManager/AppManager/xml/AddMonitor?apikey=f746be1da5fb1a2668b00251742ccd2d&type=SilverStream&displayname=sliverstream&host=hostname&port=8081&ManagedServerID=1&addToGroup=true&groupID=10069

Adding a new monitor from an Admin server in the Enterprise Edition

When adding a new monitor from an admin server in the Enterprise Edition, the user can select the Managed server of his preference. To do so, the following parameters should be appended in the API URL:

Field Description        
ManagedServerID * The new monitor will be added in the Managed Server of which the ID is specified.
ManagedServerGroupName * The new monitor will be added in a Managed Server in the specified Group.

If these parameters are not specified, the managed server will be selected based on the load-factor.

Note:
HTML encoding will be required for parameters with special characters (For example: display name or password). For example, if a password contains a special character like " # , & , % or + :
# should be replaced with %23
& should be replaced with %26
% should be replaced with %25
+ should be replaced with %2B while passing the password in the RESTAPI.
For More information about HTML Encoding, refer the following document: http://www.w3schools.com/tags/ref_urlencode.asp
Invoking the Add Monitor API will change the display name for existing monitors.

Sample Request

This example helps you add a Windows server to Applications Manager:

http://app-windows:9090/AppManager/xml/AddMonitor?apikey=0b0fd47feeff9050d6a45dd7b5bb5791&type=servers&displayname=APM-Windows&host=hostname&snmptelnetport=161&os=WindowsXP&mode=SNMP&username=administrator&password=vembu

Example output:

<AppManager-response uri="/AppManager/xml/AddMonitor">
   <result>
      <response response-code="4000">
         <message>Monitor added successfully.</message>
      </response>
   </result>
</AppManager-response>

Sample Error

If the API is not executed correctly, the request will fail and errors will be thrown as shown below.

<Apm-response uri="/AppManager/xml/AddMonitor">
   <result>
      <response response-code="4225">
         <message>The Transaction mentioned in the request URL should be yes or no.</message>
      </response>     
    </result>
</Apm-response>

Samples for adding a new monitor from an Admin server

  • ManagedServerID

    Sample: http://app-windows:9090/AppManager/xml/AddMonitor?apikey=627b1432529fbace2867388e6abf15e&type=ms sql&displayname=mssql&username=sa&host=hostname&password=password@123&port=1433&instance=&authentication=SQL&ManagedServerID=2

  • ManagedServerGroupName

    Sample: http://app-windows:9090/AppManager/xml/AddMonitor?apikey=627bce9dvsdv0db9fbace2867388e6abf15e&type=ms sql&displayname=mssql&username=sa&host=hostname&password=password@123&port=1433&instance=&authentication=SQL& ManagedServerGroupName=WIN4

Refer this page for a list of common error conditions.  

REST API monitor

Syntax

http://[Host]:[Port]/AppManager/xml/AddMonitor?apikey=[API Key]&type=RESTAPIMonitor&displayname=[Display Name]&API=[REST API URL]&Timeout=[Timeout Value in Seconds]&Method=[GET/POST/PUT/DELETE]&RespType=[XML]&UserName=[Username]&Password=[Password]
Parameter Description
type The type of the monitor you want to add. Value should be RESTAPIMonitor
displayname The display name of the monitor.
API The API call to be monitored.
Timeout The amount of time spent by APM to establish a connection with the server hosting the API service. (in seconds)
Method The Form Submission method used to access the API. (GET/POST/PUT/DELETE)
RespType The type of response to be expected.(Text/XML/JSON).
payLoadType

The format in which request data will be sent (applicable only for POST & PUT methods). Value can be FORM, Text, XML or JSON.

payLoad The request data (the format should match the payLoadType specified).
customHeaders Specify the headers to establish a connection with the API server. Use sep to separate the header name and value. For specifying multiple headers, use the separator #(Please encode the request parameters if they are sent via GET).

Example

http://Prod-server7:9010/AppManager/xml/AddMonitor?apikey=8519e4fadfd79d5dc78bce7489bd9319&type=RESTAPIMonitor&displayname=Dummy&API=http://www.google.co.in/&Timeout=10&Method=POST&payLoadType=Text&payLoad=PayloadContent&customHeaders=Accept_sep_application/json; version=2.0#User-Agent_sep_Mozilla/5.0 (Windows NT 6.3;Win64; x64)&UserName=User1&Password=Pass_123