This is a step-by-step workflow guide for how to create Monitors using REST. As a prerequisite, you should be familiar with Monitor configuration in the AppMon client, where you also get an overview over available monitor types, execution targets and schedules.
The individual steps can be tried out interactively in our REST documentation that comes with the AppMon Server at https://DTSERVER:8021/api-docs/current/.
Steps 1 to 3 are preparatory to make you familiar with the configuration options for a specific Monitor type. In an automation script you would usually only want to use steps 4 and 5.
Step 1: Create default Monitor for a specific type
To create a Monitor, first create the default setting for a specific Monitor type (for example
URL Monitor). The only required JSON field is the
type. The available Monitor types depend on your installed Monitor plug-ins, try to configure a Monitor through the AppMon client to view the available types in the Monitor Type Chooser.
Step 2: View available Monitor task parameters
Monitors can have any number of task parameters, which are defined in the respective Monitor plug-in. To get an overview over the supported parameters for the specific Monitor type used, you can query the details of the newly created Monitor. Any properties which need to be further adapted can be updated in the next step.
Step 3: Update task parameters and execution target
In order to selectively update certain properties of the Monitor, you would use the same endpoint as was used for the creation of the new Monitor. This example sets the execution target to a specific Collector, schedule the Monitor task to run periodically, and change some of the task parameters. The Collector has to be specified in the format
collectorname@collectorhost (you can view the available execution targets in the expected format in the AppMon client if you have any doubts - configure a Monitor and switch to the Schedule tab). Note that you cannot modify the type of a Monitor.
Step 4: Combine step 1 and 3 for automation scripts
Once you know the available task parameters for a specific Monitor type, you can skip the previous three steps and configure any new Monitor with only one call instead, just use the JSON body from step 3 and add the
type property from step 1.
Step 5: Add target hosts
Monitors execute separately for each specified host, so at least one host must be configured for the Monitor to execute. Select hosts using host expressions and intersections of host expressions (for example a combination of different labels). The following call can be used to add a host expressions to the specified Monitor. The host expression is the name of any configured host, site or label (the latter corresponds to the type
hostGroup in the REST call). The host expression is evaluated during runtime against the infrastructure configuration, which has to be adapted manually through the AppMon client if a yet unknown host should be monitored.