Schedule demo

AddMonitor APIs - Custom Monitors


This section explains how to use the AddMonitor API to add monitors of the category type 'Custom Monitors'. The following monitors are supported:

Supported HTTP methods: POST

Allowed roles: Administrator

Windows Performance Counters

Syntax

https://[HOST]:[PORT]/AppManager/xml/AddMonitor?apikey=[APIKEY]&type=[TYPE]&displayname=[DISPLAYNAME]&host=[HOST]&username=[USERNAME]&password=[PASSWORD]&pollinterval=[POLLINTERVAL]

Request Parameters

The parameters involved in the API request are described below. Also, refer the list of common request parameters.

FieldDescription        
typeThe type of the monitor you want to add. Value should be Windows Performance Counters.
hostThe name of the host where the Windows Performance Counters is running.
usernameThe user name of the host running Windows Performance Counters.
passwordThe password of the host running Windows Performance Counters.
pollintervalThe interval at which you want the polling to happen.

Sample Request

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Windows Performance Counters&host=app-xpmll&displayname=wpc&username=admin&password=appman

Database Query Monitor

Syntax

https://[HOST]:[PORT]/AppManager/xml/AddMonitor?apikey=[APIKEY]&type=[TYPE]&displayname=[DISPLAYNAME]&host=[HOST]&port=[PORT]&username=[USERNAME]&password=[PASSWORD]&databasetype=[DATABASETYPE]&databasename=[DATABASENAME]&SSLEnabled=[SSLENABLED]&showqueryoutput=[SHOWQUERYOUTPUT]&queries=[QUERIES]

Request Parameters

The parameters involved in the API request are described below. Also, refer the list of common Request Parameters.

FieldDescription
typeThe type of monitor you want to add. Value should be QueryMonitor.
hostThe name of the host where the database server is running.
portThe port number where the database is running
usernameThe user name of the database server.
passwordThe password of the database server.
databasetypeThe database type for which the query is executed.
databasenameThe name of the database server.
SSLEnabledOption to enable SSL. Possible values are either true or false.
showqueryoutputOption to specify whether you prefer query output. Values are yes or no
queriesDenotes the database query. There can be a maximum of five queries.
mysqlDriverTypeThe type of driver used to connect to the MySQL server. Values are mariadbdriver or mysqldriver.

Note: This parameter is required only for query monitors of the MySQL database type.

Sample Request

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=QueryMonitor&displayname=qury&host=app-xp2&port=1433&username=admin&password=appman&databasetype=MsSQL&databasename=AMDB&SSLEnabled=true&showqueryoutput=yes&queries=select * from user

File/Directory Monitor

Syntax

https://[HOST]:[PORT]/AppManager/xml/AddMonitor?apikey=[APIKEY]&type=[TYPE]&displayname=[DISPLAYNAME]&filepath=[FILEPATH]&serversite=[SERVERSITE]&pollinterval=[POLLINTERVAL]&timeout=[TIMEOUT]&fileDirAge=[FILEDIRAGE]&checkAvailability=[CHECKAVAILABILITY]&contentChk=[CONTENTCHK]&filterFiles=[FILTERFILES]

Request Parameters

The parameters involved in the API request are described below. Also, refer to the list of common request parameters.

FieldDescription        
typeThe type of monitor you want to add. Value should be File Monitor or Directory Monitor.
serversiteSpecifies whether the file/directory to be monitored is located on the Local or Remote server. (local or remote)
filepathAbsolute path of the file/directory to be monitored.
fileDirAgeOption to perform file/directory age check. (on or off)
selectMonStatusThe monitor availability to be set if the file/directory is MODIFIED or NOT MODIFIED within a certain time. (up or down)
selectChangeTypeThe file/directory change type for which the configured monitor availability should be set. Possible values are:
  • 0 - When file/directory is not modified
  • 1 - When file/directory is modified
timevalAmount of time for which the file/directory age should be checked.
timeUnitThe time unit for which the file/directory age should be checked.
checkAvailabilityAlerts when the file/directory does not exist in the specified location (on or off).
Default value: on
choosehostIf the File / Directory to be monitored is in the Remote Server, you can choose the host by providing the host ID if the host was already added or using the value -1 to add a new host.
hostThe name of the host where the File Monitor is running.
monitoringmodeSpecifies the Mode Of Monitoring (WMI for Windows, Telnet/SSH for Linux)
usernameThe username to connect with the host.
passwordThe password for the new host username.
promptThe Command Prompt to connect in the Telnet/SSH mode. Specify the command prompt value, which is the last character in your command prompt
portThe port number where the File/Directory Monitor is running.
Default value: 23.
contentChkSpecifies whether content check needs to be configured. (on or off)
fileCheckTypeThe File Parsing Options to perform content check. Possible Values are:
  • 0 - Perform content check to only appended content.
  • 1 - Perform content check to the whole file.
ccontentThe string for which you want to check content matching. Content should be specified in JSON array format as:

[{"severityCriteria":contentMatchSeverity, "contents": actualContent, "isRegex":regexCheck, "ruleType":ruleNum, "caseSensitive":caseSensitiveCheck, ,"matchWholeWord":matchWholeWord}]


ParameterDescription
contentMatchSeverityThe severity to be set when content match occurs. Possible values are:
  • 0 - Availability Down
  • 1 - Availability Up
  • 2 - Health Critical
  • 3 - Health Warning
  • 4 - Health Clear
actualContentThe actual content that needs to be matched.
regexCheckSpecifies whether Regex match should be performed. (true or false)
ruleNumThe number of contents that are to be matched.
caseSensitiveCheckSpecifies whether exact content match should be performed. (true or false)
matchWholeWordSpecifies whether content match should be performed for the whole word. (true or false)
clearAlertsSpecifies whether monitor status should be cleared when file is not modified. (on or off)
filterFilesThe condition to filter files in the directory. Filtering conditions should be specified in JSON array format as:

{"filepattern":"[FILE PATTERN]", "category":"[CATEGORY]", "condition":"[CONDITION]", "value":[VALUE], "unit":"[UNIT]", "alertSeverity":[SEVERITY]}


ParameterDescription
filepatternRegular expression for the file pattern (such as *.txt or *.zip)
categoryIndicates the parameters based on which the files need to be filtered. Possible values include:
  • size - Size
  • mod - Last Modified Time
  • create - Created time (supported only for Windows directory)
conditionIndicates the filter condition. Possible values are:
  • LT - Lesser than
  • GT - Greater than
valueIndicates the value specified for the filter condition. Specified value should be a positive integer.
unitThe unit for the value specified. Posssible values are either Bytes/KB/MB/GB (for Size filter category) or Minutes/Hours (for Last Modified Time and Created Time filter categories)
alertSeverityThe alert severity to be set when filtering conditions are met. Possible values are:
  • 1 - Health Critical
  • 4 - Health Warning
  • 5 - Health Clear

Sample Request

File Monitoring

For a Local File:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=File%20Monitor&displayname=test12345&filepath=D:\test.txt&serversite=local&pollinterval=5&timeout=60&fileCheckType=1

For a Remote File:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=File Monitor&displayname=test7&filepath=F:\LATEST\AppManager\logs\stdout.txt&serversite=remote&pollinterval=5&timeout=60&
choosehost=-1&monitoringmode=WMI&host=app-support-w7&username=admin&password=appman

For a Local File when Content Check is enabled:

https://apm-prod-server:8443/AppManager/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=File%20Monitor&displayname=test12345&filepath=D:\test.txt&serversite=local&pollinterval=5&timeout=60&contentChk=on&fileCheckType=1&ccontent=[{"severityCriteria":"1", "contents": ["error", "exception"], "isRegex":"false", "ruleType":"1", "caseSensitive":true,"matchWholeWord":true}]&fileCheckType=whole

For a Remote File when Content Check is enabled:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=File Monitor&displayname=test12&filepath=C:\Test\Grep.txt&serversite=remote&pollinterval=5&timeout=60&contentChk=on&
ccontent=Exception&fileCheckType=whole&choosehost=-1&monitoringmode=WMI&host=app-xp2&username=admin&password=appman

When both file/directory age check and content check are enabled:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=File Monitor&displayname=test6&filepath=F:\LATEST\AppManager\logs\stdout.txt&serversite=local&pollinterval=5&timeout=60&
fileDirAge=yes&selectMonStatus=down&selectChangeType=0&timeval=50&timeUnit=Minutes&contentChk=on&
ccontent=test&fileCheckType=whole

Directory Monitoring

For a Local Directory:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Directory Monitor&displayname=testAPI&filepath=E:\temp&serversite=local&pollinterval=5&timeout=60&checkAvailability=on

For a Remote Directory:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Directory Monitor&displayname=testAPI4123&filepath=D:\test123&serversite=remote&monitoringmode=WMI&choosehost=-1&host=172.20.18.187&username=admin&password=appman&pollinterval=5&timeout=60&checkAvailability=on

For a Local Directory when Filter Files is enabled:

https://apm-prod-server:8443/AppManager/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Directory Monitor&displayname=testAPI&filepath=E:\temp&serversite=local&pollinterval=5&timeout=60&checkAvailability=on&filterFiles={"condition":"GT","unit":"Minutes","alertSeverity":1,"filepattern":"*.txt","category":"mod","value":5}

For a Remote Directory when Filter Files is enabled:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Directory%20Monitor&displayname=testAPI4123&filepath=D:\test123&serversite=remote&monitoringmode=WMI&choosehost=-1&host=172.20.18.187&username=admin&password=appman&pollinterval=5&timeout=60&checkAvailability=on&filterFiles={"condition":"GT","unit":"Minutes","alertSeverity":1,"filepattern":"*.txt","category":"mod","value":5}

Script Monitor

Syntax

https://[HOST]:[PORT]/AppManager/xml/AddMonitor?apikey=[APIKEY]&type=[Script Monitor]&displayname=[DISPLAYNAME]&serverpath=[SERVERPATH]&workingdirectory=[FILEPATH]&serversite=[LOCAL/REMOTE]&pollinterval=[POLLINTERVAL]&timeout=[TIMEOUT]

Request Parameters

The mandatory parameters involved in the API request are described below. Also, refer to the list of common request parameters.

Mandatory parametersValueDescription        
typeScript MonitorThe type of the monitor you want to add. Value should be Script Monitor.
displayname Display name of the monitor
serverpath The path of the script file in the server to be monitored 
workingdirectory The directory in which the script will be executed
serversitelocal/remoteSpecifies whether the script to be monitored is on the Local or Remote Server.
pollinterval Set the Polling Interval.
Default value: 5 minutes
timeout Specify the Timeout value in seconds. The value can be the maximum time taken by the script to execute.
isCommand To choose the Script Location as command, use the keyword "isCommand=true" in the API call.
globalseveritytrue/falseOption to affect health when exception occurs.

If Remote Server option is selected, the parameters are:

FieldValueDescription        
host The name or IP address of the host where the script monitor is running.
monitoringmodeTELNET/SSH/POWERSHELLSpecifies the Mode Of Monitoring. ( Telnet/SSH for Linux and Powershell for Windows)
choosehost-1/hostidFor new host, use -1, else use id value from the query 'select * from AM_SCRIPTHOSTDETAILS'
port23/22The port number.
username The username to add a new host.
password The password to add a new host.
sshkeyon/offThe SSH Key for SSH authentication. Public Key Authentication (Supported for SSH2 only). Default value: off
passphrase The passphrase for key based authentication for SSH.
prompt The Command Prompt to connect in the Telnet/SSH mode. Specify the command prompt value, which is the last character in your command prompt.
Default value: $.
modeshEnter the mode.
Default value:sh
description Private key

If the Output Settings enabled, the parameters are:

FieldValueDescription        
opfiletrue/falseSpecify if you want to Get output from file.
outputfile Specify the path of the output file
string_att Enter the String attributes
numeric_att Enter the Numeric attributes
delimiter Enter the value of Delimiter used in the output file. If you don't specify a delimiter, then 'space' would be considered as a delimiter.
Default value:=

If Tables in output file is enabled, the parameters are:

FieldValueDescription        
tablespresenton/offThe state of the Output Settings.
Default value:off
table_row Number of rows in the table 
table<index> Table name
numericatt<index> Numeric attribute
stringatt<index> String attribute
pcatt<index> Unique column
cdl<index> Column delimiter
message Arguments
pollinterval Polling interval
timeout Time out
manageTableRowretain/delete/unmanageOptions to manage table row. (retain, delete, or unmanage)
healthTableRowcritical/warning/clearOptions to manage table data. (critical, warning, or clear)

Sample Request

For a local server:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Script Monitor&displayname=test1&serverpath=F:\AppManager\bin\CkServerConnection.bat&workingdirectory=
F:\Managed\AppManager\bin\&serversite=local&pollinterval=5&timeout=30&globalseverity=true

For a remote server:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Script Monitor&displayname=test2&serverpath=/home/likewise-open/ZOHOCORP/prodserver-9091/test.sh&workingdirectory=/home/ZOHOCORP/prodserver-9091&serversite=remote&pollinterval=5&timeout=60&choosehost=-1&monitoringmode=SSH&host=prodserver-9091&username=admin&password=appman&prompt=$&port=22&globalseverity=true

For a Command type script:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Script Monitor&displayname=testAPI222&serverpath= echo helo&workingdirectory=/home/test&serversite=remote&pollinterval=5&timeout=60&choosehost=5&isCommand=true&globalseverity=true

With Output Settings enabled (Give new line with %0A):

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Script Monitor&displayname=test3&serverpath=F:\AppManager\bin\ChkServerConnection.bat&workingdirectory=
F:\AppManager\bin\&serversite=local&pollinterval=5&timeout=60&opfile=true&outputfile=F:\AppManager\bin\result.txt&
string_att=Name1,Name2&numeric_att=Age1,Age2&delimiter==&globalseverity=true

With the tables in output file enabled:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Script Monitor&displayname=test3&serverpath=F:\AppManager\bin\ChkServerConnection.bat&workingdirectory=F:\AppManager\bin\
&serversite=local&pollinterval=5&timeout=60&opfile=true&outputfile=F:\AppManager\bin\result.txt&
string_att=Name1,Name2&numeric_att=Age1,Age2&delimiter==&tablespresent=on&table_row=1&
table1=Test1&numericatt1=Num1&stringatt1=Str1&pcatt1=Num1&cdl1=|&manageTableRow=delete&healthTableRow=critical&globalseverity=true

Custom Monitor Type

Syntax

https://[HOST]:[PORT]/AppManager/xml/AddMonitor?apikey=[APIKEY]&type=[CustomType]displayname=[DISPLAYNAME]&serverpath=[SERVERPATH]&workingdirectory=[FILEPATH]&serversite=[LOCAL/REMOTE]&pollInterval=[pollInterval]&timeout=[TIMEOUT]

Request Parameters

The mandatory parameters involved in the API request are described below. Also, refer to the list of common request parameters.

Mandatory parametersValueDescription        
typeCustomType_1The type of monitor you want to add. The value should be the display name of the MonitorType created with the server id appended: CustomType_1.

Note: To learn how to add a Custom Monitor type, refer to this help page.

displayname Display name of the monitor
serverpath The path of the script file in the server to be monitored.
workingdirectory The directory in which the script will be executed.
serversitelocal/remoteSpecifies whether the script to be monitored is on the Local or Remote Server.
pollinterval Set the Polling Interval.
Default value: 5 minutes
timeout Specify the Timeout  value in seconds. The value can be the maximum time taken for the script to execute.
isCommand To choose the Script Location as command, use the keyword "isCommand=true" in the API call.
globalseveritytrue/falseOption to affect health when exception occurs.

If Remote Server option is selected, the parameters are:

FieldValueDescription        
host The name or IP address of the host where the CustomType_1 is running.
monitoringmodeTELNET/SSH/POWERSHELLSpecifies the Mode Of Monitoring. ( Telnet/SSH for Linux and Powershell for Windows)
choosehost-1/hostidFor new host, use -1, else use id value from the query 'select * from AM_SCRIPTHOSTDETAILS'
port23/22The port number.
username The username to add a new host.
password The password to add a new host.
sshkeyon/offThe SSH Key for SSH authentication. Public Key Authentication (Supported for SSH2 only).
Default value:off
passphrase The passphrase for key based authentication for SSH.
prompt The Command Prompt to connect in the Telnet/SSH mode. Specify the command prompt value, which is the last character in your command prompt.
Default value: $
modeshEnter the mode.
Default value:sh
description Private key

If the Output Settings are enabled, the parameters are:

FieldValueDescription        
opfiletrue/falseSpecify if you want to get the output from the file.
outputfile Specify the path of the output file.

If Tables in the output file is configured for Custom type, the parameters are:

FieldValueDescription        
message Arguments
manageTableRowretain/delete/unmanageOptions to manage the table rows. (Possible values:retain, delete, or unmanage)
healthTableRowcritical/warning/clearOptions to manage table data. (Possible values:critical, warning, or clear)

Sample Request

For a local server:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=CustomType_1&displayname=test1&serverpath=F:\AppManager\bin\CkServerConnection.bat&workingdirectory= F:\Managed\AppManager\bin\&serversite=local&pollInterval=5&timeout=30&globalseverity=true

For a remote server:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=CustomType_1&displayname=test2&serverpath=/home/likewise-open/ZOHOCORP/prodserver-9091/test.sh&workingdirectory=/home/ZOHOCORP/prodserver-9091&serversite=remote&pollInterval=5&timeout=60&choosehost=-1&monitoringmode=SSH&host=prodserver-9091&username=admin&password=appman&prompt=$&port=22&globalseverity=true

For a Command type script:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=CustomType_1&displayname=testAPI222&serverpath= echo helo&workingdirectory=/home/test&serversite=remote&pollInterval=5&timeout=60&choosehost=5&isCommand=true&globalseverity=true

For a Output Settings script:

https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=CustomType_1&displayname=test3&serverpath=F:\AppManager\bin\ChkServerConnection.bat&workingdirectory= F:\AppManager\bin\&serversite=local&pollInterval=5&timeout=60&opfile=true&outputfile=F:\AppManager\bin\result.txt&gobalseverity=true

Loved by customers all over the world

"Standout Tool With Extensive Monitoring Capabilities"

It allows us to track crucial metrics such as response times, resource utilization, error rates, and transaction performance. The real-time monitoring alerts promptly notify us of any issues or anomalies, enabling us to take immediate action.

Reviewer Role: Research and Development

carlos-rivero
"I like Applications Manager because it helps us to detect issues present in our servers and SQL databases."
Carlos Rivero

Tech Support Manager, Lexmark

Trusted by over 6000+ businesses globally